Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
Project 1: Process and Memory Management
1 Background
In this project, you will familiarise yourself with process scheduling and memory management. You will simulate a process manager in a system where all processes are fully CPU-bound (i.e., have a single CPU burst and do no I/O). The process manager i) allocates processes to a CPU in a round-robin manner and ii) supports contiguous, paged, and virtual memory management.
2 Process Manager Overview
The process manager runs in cycles. A cycle occurs after one quantum has elapsed. The process manager has its own notion of time, referred to from here on as the simulation time. The simulation time (TS ) starts at 0 and increases by the length of the quantum (Q) every cycle. For this project, Q will be an integer value between 1 and 3 (1 ≤ Q ≤ 3).
At the start of each cycle, the process manager must carry out the following tasks in se- quence:
1. Identify all processes that have been submitted to the system since the last cycle occurred and add them to the process queue in the order they appear in the process file. A process is considered to have been submitted to the system if its arrival time is less than or equal to the current simulation time Ts.
2. Identify whether the process (if any) that is currently running (i.e., was given CPU time in the previous cycle) has completed its execution. If it has:
– The process’s state is updated (see Section 3)
– The process is removed from the process queue
– The process’s memory is deallocated
3. Determine the process that runs in this cycle. This decision is made based on the scheduling algorithm (round robin) and the memory allocation strategy. This step entails:
– Updating the state of the process that is currently running (if any) and the state of the newly allocated process (see Section 3)
– Updating the process queue if needed
A detailed explanation of this stage is given for each task.
4. Increment the simulation time by Q seconds.
This cycle is repeated iteratively until all the processes that were submitted to the system have completed their execution.
3 Process Lifecycle
The lifecycle of a process is as follows:
1. A process is submitted to the process manager via an input file (See Section 6 for more details). Note that you may read all the processes in the input file into a data structure, and use said data structure to determine which processes should be added to the process queue based on their arrival time and the current simulation time.
2. A process is in a READY state after it has arrived (arrival time less than or equal to the simulation time). READY processes are considered by the scheduling algorithm as candidates to be allocated to the CPU.
3. The process that has been selected to use the CPU enters a RUNNING state.
4. After running for one quantum,
– If the process has completed its execution, the process is terminated and moves to the FINISHED state.
– If the process requires more CPU time and there are other READY processes, the process transitions back to the READY state to await more CPU time.
– If the process requires more CPU time and there are no other READY processes, the process remains in the RUNNING state and runs for another quantum.
For simplicity, a process can only transition to the FINISHED state at the end of a quantum. This means that, in cases in which the service time of a process is not a multiple of the quantum, the total amount of time the process spends in the RUNNING state will be greater than its service time.