Using C Language
Budget: $30 – $250 USD
You need to implement using C with pthread library!!! (no Java)
Objective
● Learn and practice CPU scheduling algorithms by implementing them
● Learn and practice process/thread synchronization mechanisms by implementing them
● Practice system calls and library functions
Description
you are asked to implement a multithreaded program that will allow us to measure the performance (i.e., CPU utilization, Throughput, Turnaround time, and Waiting time in Ready Queue) of the four basic CPU scheduling algorithms (namely, FIFO, SJF, PR, and RR). Your program will be emulating/simulating the processes whose priority, sequence of CPU burst time(ms) and I/O burst time(ms) will be given in an input file.
Assume that all scheduling algorithms except RR will be non-preemptive, and all scheduling algorithms except PR will ignore process priorities (i.e., all processes have the same priority in FIFO, SJF and RR). Also assume that there is only one IO device and all IO requests will be served using that device in a FIFO manner.
Your program will take the name of the scheduling algorithm, related parameters (if any), and an input file name from command line. Here how your program should be executed:
prog -alg [FIFO|SJF|PR|RR] [-quantum [integer(ms)]] -input [file name]
The output of your program will be as follows:
Input File Name : file name
CPU Scheduling Alg : FIFO|SJF|PR|RR (quantum)
CPU utilization : ....
Throughput : ....
Avg. Turnaround time : ....
Avg. Waiting time in R queue : ....
The input file is formatted such that each line starts with proc, sleep, stop keywords.
� Following proc, there will be a sequence of integer numbers: the first one represents the priority (1: lowest, ..., 5: normal, ..., 10: highest). The second number shows the number of remaning integers representing CPU burst and I/O burst times (ms) in an alternating manner. The last number will be the last CPU burst time after which that process exits. Following sleep, there will be an integer number representing the time (ms) after which there will be another process.
So one of the threads in your program (e.g., FileRead_thread()) would be responsible for processing this file as follows. As long as it reads proc, it will create a new process and put it in a ready queue (clearly this process is not an actual one, it will be just a simple data structure (similar to PCB) that contains the given priority and the sequence of CPU burst and I/O burst times, and other fields). When this thread reads sleep x, it will sleep x ms and then try to read new processes from the file. Upon reading stop, this thread will quit.
Objective
● Learn and practice CPU scheduling algorithms by implementing them
● Learn and practice process/thread synchronization mechanisms by implementing them
● Practice system calls and library functions
Description
you are asked to implement a multithreaded program that will allow us to measure the performance (i.e., CPU utilization, Throughput, Turnaround time, and Waiting time in Ready Queue) of the four basic CPU scheduling algorithms (namely, FIFO, SJF, PR, and RR). Your program will be emulating/simulating the processes whose priority, sequence of CPU burst time(ms) and I/O burst time(ms) will be given in an input file.
Assume that all scheduling algorithms except RR will be non-preemptive, and all scheduling algorithms except PR will ignore process priorities (i.e., all processes have the same priority in FIFO, SJF and RR). Also assume that there is only one IO device and all IO requests will be served using that device in a FIFO manner.
Your program will take the name of the scheduling algorithm, related parameters (if any), and an input file name from command line. Here how your program should be executed:
prog -alg [FIFO|SJF|PR|RR] [-quantum [integer(ms)]] -input [file name]
The output of your program will be as follows:
Input File Name : file name
CPU Scheduling Alg : FIFO|SJF|PR|RR (quantum)
CPU utilization : ....
Throughput : ....
Avg. Turnaround time : ....
Avg. Waiting time in R queue : ....
The input file is formatted such that each line starts with proc, sleep, stop keywords.
� Following proc, there will be a sequence of integer numbers: the first one represents the priority (1: lowest, ..., 5: normal, ..., 10: highest). The second number shows the number of remaning integers representing CPU burst and I/O burst times (ms) in an alternating manner. The last number will be the last CPU burst time after which that process exits. Following sleep, there will be an integer number representing the time (ms) after which there will be another process.
So one of the threads in your program (e.g., FileRead_thread()) would be responsible for processing this file as follows. As long as it reads proc, it will create a new process and put it in a ready queue (clearly this process is not an actual one, it will be just a simple data structure (similar to PCB) that contains the given priority and the sequence of CPU burst and I/O burst times, and other fields). When this thread reads sleep x, it will sleep x ms and then try to read new processes from the file. Upon reading stop, this thread will quit.