Get Instant Help From 5000+ Experts For
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing:Proofread your work by experts and improve grade at Lowest cost

And Improve Your Grades
myassignmenthelp.com
loader
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!
Free Quote
wave
Operating System Simulation: Virtual Memory and Process Scheduling

The main objective of this assignment is to simulate operating systems virtual memory management, process scheduling and concurrency/synchronization control as discussed during the Lab sessions.

The following features should be considered for this simulation:

1- Processes should be simulated by threads in the application. Each process has a starting time and duration (burst time). processes.txtis the input file which contains the number of processes N followed by N lines. Each line contains the process start time and duration.

2- Process Scheduler: A process scheduling thread should be implemented based on the Round Robin policy that schedules the processes as discussed during the lab sessions. In this assignment (#3) we assume that the simulated system has two CPUs (or CPU cores). Therefore, two processes can be executed at the same time, i.e. the scheduler must select two processes (from the head of the waiting queue) for execution during each cycle. Additionally, the time slice must be set to 3000 ms.(Alternatively we can use FIFO as specified in the tutorial!)

 

3- Virtual Memory Management: Virtual memory consists of a fixed size main memory and unlimited disk space. The main memory is divided into frames while the virtual memory is divided into pages. A page has the same size as a frame. The size of the main memory will be given as an input in a file called memconfig.txt. This file contains a number indicating number of frames in main memory. The disk space is assumed to be unlimited. Notice that frames in the main memory should be simulated by an array (or vector) in the actual computer physical memory, while virtual memory pages are simulated by an array stored in a text file such as vm.txt, which must be accessed every time we need to access the disk space.

 

4- Processes try to store, release and retrieve variablesto/from the memory. Each page contains only one variableId and its value. Of course, working with memory can only happen when the process is running. Each variable in the memory has a Last Access property which is a time stamp indicating the last time this variable was accessed.

 

5- Virtual memory manager should be implemented with a set of APIs (functions) as follows:

 

a. memStore (string variableId, unsigned int value): This instruction stores the given variableId and its value in the first unassigned spot in the memory.

 

b. memFree (string variableId): This instruction removes the variableId and its value from the memory, so the page which was holding this variable becomes available for storage.

 

memLookup (string variableId): If the variableId exists in the main memory it returns its value. If the variableId is not in the main memory but exists in disk space (i.e. page fault occurs), then it should move this variable into the memory. Notice that if no spot is available in the memory, program needs to swap this variable with the least recently accessed variable, i.e. the variable with smallest Last Access time, in the main memory. Finally, if the variableId does not exist in the main memory and disk space, the API should return -1.

 

6- The processes should continuously pick one command from a given list of commands located in the input file called commands.txt. The processes should then call the suitable API of virtual memory manager based on the picked command.

 

a. memStore [variableId] [value]: e.g. “memStore 10 5

 

b. memFree [variableId]: e.g. memFree 10

 

c. memLookup [variableId]: e.g. memLookup 10

 

7- Output of the program should be a text file “output.txt” which includes the following events:

 

a. Threads start, resume, pause and finish.

 

b. Each instruction executed by each thread

 

c. Page swapping between the main memory and the disk space

support
Whatsapp
callback
sales
sales chat
Whatsapp
callback
sales chat
close