CPU SCHEDULING SIMULATION Towson University – COS519 – Fall 2018 Members of Group #5:
Outlines: PURPOSE OF THE PROJECT INTRODUCTION TO CPU SCHEDULING ATTRIBUTES OF THE PROCESS SCHEDULING ALGORITHMS IMPLEMENTATION SIMULATION OUTPUTS ANALYSIS OF ALGORITHMS CONCLUSION REFERENCES
Purpose of the Project: To understand how CPU scheduling works in an Operating System. To analyze First In First Out, Shortest Job First and Round Robin Scheduling algorithms that determine the sequence of execution by CPU. To compare the efficiency of each algorithm by measuring the Burst time, waiting time, and turn-around time.
Introduction to CPU Scheduling CPU scheduling is a process which allows one process to use the CPU while the execution of another process is in waiting state due to unavailability of any resource like I/O etc, thereby making the maximum utilization of CPU. Whenever the CPU becomes idle, it selects another process from the ready queue to run next. To select this process, scheduling algorithm are used. There are several algorithms to choose from, as well as numerous adjustable parameters for each algorithm. The algorithms implemented are: First In First Out Shortest Job First Round Robin
Attributes of Processes Process ID: a unique value for each process. Wait Time: The duration of time the process waits to utilize CPU is called wait time. It can be calculated by the difference of turn-around time and burst time. Burst Time: The duration of time where the process gets to utilize the CPU is called burst time. Turn Around Time: The turn-around time the sum of waiting time of the process to get into the ready queue, execution on CPU and executing input/output. Arrival Time: It can be given as the time at which the process arrives in the ready queue.
scheduling algorithms used First-Come, First-Served Allocating the CPU to the process that requests the CPU first. Using a FIFO queue Average waiting time is more Process Burst Time P1 24 P2 3 P3 3 Average waiting time: (0 + 24 + 27)/3 = 17 ms Average wait time of ( 0 + 3 + 6 ) / 3 = 3.0 ms Fig. Gantt chart for process in the order p2,p3,p1
scheduling algorithms used Shortest-Job-First Scheduling Depends on the length of the next CPU burst of a process. If the next CPU bursts of two processes are the same, FCFS scheduling is used. Two types: Pre-emptive, Non-pre-emptive. Preemptive SJF algorithm will preempt the currently executing process. Non-preemptive SJF algorithm will allow the currently running process to finish its CPU burst. Non-pre-emptive: consider the following set of processes p1, p2, p3, p4 and their CPU burst given in milliseconds with arrival time as 0 for all the processes. Process Burst Time P1 6 P2 8 P3 7 P4 3
scheduling algorithms used Round-Robin Scheduling Round Robin is a preemptive scheduling algorithm. A small unit of time, called a time quantum CPU scheduler selects the process from the queue and allocates the CPU to each process for a time interval of one quantum. All the processes in the queue are executed in the cyclic way. Switching Overhead is the main problem. Fig. Representation of the Round Robin Implementation
Implementation Technical Details: Data Structures: Language: Java Platform: Linux (open source O/S) Algorithms Used: FIFO, SJF, Round Robin Data Structures: Array – to keep the track of the processes as a queue – to keep the track of Burst Time of the processes – to keep the track of Arrival Time of the processes
CPU scheduling Simulator Output: FIFO Algorithm Result Set
CPU scheduling Simulator Output: SJF Algorithm Result Set
CPU scheduling Simulator Output: RR Algorithm Result Set
Analysis of First In First Out (FIFO) For different burst times, the wait time have variations between the same range (0 –1600) Wait time is dependent of arrival time, as it increases linearly when the arrival time increment too
Analysis of Shortest Job First (SJF) No correlation between the arrival time and the process waiting time as expected Wait time increase as it does the burst time.
Analysis of Round Robin (RR) For different burst times, the wait time have variations between the same range (0 –1600) Wait time is dependent of arrival time, as it increases linearly when the arrival time increment too
Analysis summary of the 3 algorithms Variation of the average wait time as the number of processes completed increase for each algorithm.
Conclusion FIFO - SJF – RR FIFO : Convey Effect – short process behind long process SJF : Starvation RR : Overhead FIFO
REFERENCES Research papers: Books: Websites: Kishor, L., & Goyal, D. (2013). Comparative analysis of various scheduling algorithms. International Journal of Advanced Research in Computer Engineering & Technology (IJARCET), 2(4), pp-1488. Abhijit A. Rajguru, S. A. (July 2013). A Performance Analysis of Task Scheduling Algorithms using Qualitative Parameters. International Journal of Computer Applications, 33-38. Books: Silberschatz, A., Galvin, P., and Gagne, G., "Operating System Concepts," (Sixth Edition), Wiley & Sons, 2002. Websites: https://www.studytonight.com/operating-system/shortest-job-first http://orion.towson.edu/~karne/teaching/projos/procmgmt2.pdf https://www.geeksforgeeks.org/gate-notes-operating-system-process-scheduling/ https://en.wikipedia.org/wiki/Process_management_(computing) https://www.tutorialspoint.com/operating_system/os_process_scheduling.htm
Thank You !