A CPU scheduler determines an order for the execution of its scheduled processes. It decides which process will run according to a certain data structure that keeps track of the processes in the system and their status. A process, upon creation, has one of the three states: Running, Ready, Blocked (doing I/O, using other resources than CPU or waiting on unavailable resource). A bad scheduler will make a very bad operating system, so our scheduler is optimized in terms of memory and time usage. The project consists of two phases:
-
Assume a Computer with 1-CPU and infinite memory. It is required to make a scheduler with its complementary components as sketched in the following diagrams.
-
Memory allocation capabilities included using the buddy memory allocation system. It should allocate memory space for processes as they enter the system and free it as they leave so that it canbe re-used by later processes.
Same assumptions of phase one in addtion to:- The total memory size is 1024 bytes
- Each process size is less than or equal 1024 bytes.
- The memory allocated for a process as it enters the system is constant over the time it spends in the system.
- We slightly modified the the Process Generator (in code file process generator.c) to accept an extra process information which is memsize "size of the process".
- The process generator should do the following tasks...
- The clock module is used to emulate an integer time clock.
- The scheduler is the core of your work, it should keep track of the processes and their states and it decides - based on the used algorithm - which process will run and for how long.
-
Each process should act as if it is CPU-bound.
Again, when a process finishes it should notify the scheduler on termination, the scheduler does NOT terminate the process.
• Read the input files (check the input/output section below).
• Ask the user for the chosen scheduling algorithm and its parameters, if there are any.
• Initiate and create the scheduler and clock processes.
• Create a data structure for processes and provide it with its parameters.
• Send the information to the scheduler at the appropriate time (when a process arrives), so that it will be put it in its turn.
• At the end, clear IPC resources.
it manages the process uisng one of the following algorithms (depends on the user choice)
1. Non-preemptive Highest Priority First (HPF).
2. Shortest Remaining time Next (SRTN).
3. Round Robin (RR)
The scheduling algorithm only works on the processes in the ready queue. (Processes that have already arrived.)
The scheduler should be able to:
1. Start a new process. (Fork it and give it its parameters.)
2. Switch between two processes according to the scheduling algorithm. (Stop the old process and save its state and start/resume another one.)
3. Keep a process control block (PCB) for each process in the system. A PCB
should keep track of the state of a process; running/waiting, execution time, remaining time, waiting time, etc. 4. Delete the data of a process when it gets notifies that it finished. When a process finishes it should notify the scheduler on termination, the scheduler does NOT terminate the process.
5. Report the following information
(a) CPU utilization.
(b) Average weighted turnaround time.
(c) Average waiting time.
(d) Standard deviation for average weighted turnaround time.
6. Generate two files: (check the input/output section below)
(a) Scheduler.log
(b) Scheduler.perf
(c) In addition to memory.log in phase two
You can use Makefile to build and run the project.
To compile your project, use the command:
make
To run your project, use the command:
make run
- Only three algorithms included "mentioned above"
- max number of processes is 15 to guarantee correct results
- Bemoi Erian
- Mark Yasser
- Peter Atef
- Doaa Ashraf