Find Jobs
Hire Freelancers

Operating systems -- 2

$10-30 USD

Teljesítve
Kiadva ekkor: körülbelül 3 évvel ezelőtt

$10-30 USD

Teljesítéskor fizetve
Build on top of zip file that is provided. Part 1 – Examine the new “base shell” I removed all of the “callable” material. It does not really simulate processes correctly anymore, but it is simpler and it will be easier to work with for the rest of the semester. Part 2 – add “getMemorySize” to GenericHal This will tell the kernel how much memory is installed in our system. For now, it can return 2^20 bytes (1 MB). This amount should be an int. Part 3 – Build a structure to track free memory The kernel needs to track which memory is in use and which is free. The constraint that real kernels have (which we do not) is that you do not want to use a lot of memory to track free memory. We are not taking our structure out of our memory “budget” but we still want to constrain ourselves so that we do a realistic simulation. The typical approach is to use a bitmap. 1 bit (in use or free) is used to indicate the status of some amount of memory. This is, of course, a tradeoff – the smaller the memory “chunk” for each bit, the less memory we waste with each allocation. On the other hand, smaller memory chunk sizes means more bits to walk through and manipulate with every allocation/free. Java provides us a really nice class for working with an array of bits. Use the BitSet class (found in [login to view URL]) to track the available memory at a granularity of 1K. Remember that how much memory we have could change; don’t depend on the 2^20 value, but get the value from getMemorySize and calculate your BitSet size. Put this into a class as a private member that offers some functionality: Note – size is in bytes, location is a byte-based address (like a C pointer) int GetMemory(int size) – finds contiguous memory of the size indicated (rounding up to the next largest K). Returns the address of the start or -1 if no such memory exists. Mark this memory as in use. void FreeMemory(int location, int size) – marks all of the blocks, starting at location address and continuing on for size bytes, as free. Part 4 – Change the PCB & HAL to have segments Each process needs to have 3 segments – program, stack, heap. A segment is a base address and a limit, both integers. Segmented architectures have hardware registers that enforce bounds checking – they prevent you from accessing memory that you shouldn’t. These registers are only visible to the kernel. Add the same 3 segments to the GenericHAL that you added to the PCB. Also add methods to the GenericHAL: public static void AccessProgram(int address) public static void AccessStack(int address) public static void AccessHeap(int address) These should return if the address is inside the segment and call Print(“Segfault”), then Exit() on the kernel otherwise. Part 5 – Make a reschedule system call and system calls for allocation/freeing When we were working with processes, we wanted scheduling to be something that the kernel controlled. Now we want to control the reschedule. I changed reschedule to take a PID. Complete it by setting the segments from the current PCB and make it a system call. Add system calls for allocation and freeing: Boolean AllocateXXXXXXXXMemory(int pid, int amount) Object FreeXXXXXXXXMemory(int pid); Where XXXXXXXX is Program, Stack or Heap. If the segment already exists, free it first, and then allocate it. In reality, we would allocate and copy the existing memory into the new space. Allocate and Free should, of course, update the bitmap through the existing methods. Allocate can fail (return false) if it was unable to supply the requested memory. Part 6 – Test it In main, create some processes. Use KernelBindings, but make sure that you get the PIDs. Set memory for the processes. Make sure that allocate, reallocation and freeing work. Make sure that accessing memory that does not belong to the current process works. You can use our new reschedule(int) method to change the current process.
Projektazonosító: 29795146

A projektről

2 ajánlat
Távolról teljesíthető projekt
Aktiválva: 3 évvel ezelőtt

Szeretne pénzt keresni?

A Freelancer oldalán történő árajánlatadás előnyei

Határozzon meg költségvetést és időkeretet
Kapja meg fizetését a munkáért
Vázolja ajánlatát
Ingyen regisztrálhat és adhat árajánlatot munkákra
Neki odaítélve:
Felhasználó avatár
Hello, I've complete MS Software Engineering. I've 5-Year experience in Java development and algorithm implementation. My Core Expertise in Java - C++ - C - object-oriented - Data Structure - Swing - OpenGL - JavaFX. I have got your project requirement enough, Please leave a message on my chat so we can discuss the project. Best Regards: Aqeel Ahmed
$20 USD 1 napon belül
4,9 (126 értékelés)
6,4
6,4
2 szabadúszó adott átlagosan $135 USD összegű árajánlatot erre a munkára
Felhasználó avatár
Hi there. I am a Java Expert, Computwr Hardware Designer and an Operating Systems Geek since 8 years and developed 400+ solutions for enterprise level clients and various Business Giants. I have worked on cross platforms applications and Which includes AIX, Linux, IBM Machines with support of all sort of Java Development toolkit. I have a vast portfolio in Application development with every Java framework. If you are interested, I can do this project for you . Lets discuss.
$250 USD 3 napon belül
5,0 (3 értékelés)
2,2
2,2

Az ügyfélről

UNITED STATES zászlója
Troy, United States
5,0
1
Fizetési mód hitelesítve
Tagság kezdete: márc. 24, 2021

Ügyfél-hitelesítés

További munkák ettől az ügyféltől

Operating systems
$10-30 USD
Köszönjük! E-mailben elküldtük a linket, melyen átveheti ajándék egyenlegét.
E-mailje elküldése során valami hiba történt. Kérjük, próbálja újra.
Regisztrált Felhasználók Összes Közzétett Munka
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Előnézet betöltése
Hozzáférést adott a helymeghatározáshoz.
Belépési munkamenete lejárt, és kijelentkeztettük. Kérjük, lépjen be újra.