CPU SCHEDULING SIMULATION TOWSON UNIVERSITY COS 519 FALL

  • Slides: 19
Download presentation
CPU SCHEDULING SIMULATION TOWSON UNIVERSITY – COS 519 – FALL 2018 Members of Group

CPU SCHEDULING SIMULATION TOWSON UNIVERSITY – COS 519 – FALL 2018 Members of Group #5:

OUTLINES: PURPOSE OF THE PROJECT INTRODUCTION TO CPU SCHEDULING ATTRIBUTES OF THE PROCESS SCHEDULING

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.

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 hat etermine the sequence of execution by PU. To  ompare 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

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: 1. First In First Out 2. Shortest Job First 3. Round Robin

ATTRIBUTES OF PROCESSES Process ID: a unique value for each process. Wait Time: The

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 1. Allocating the CPU to the process that requests

SCHEDULING ALGORITHMS USED First-Come, First-Served 1. Allocating the CPU to the process that requests the CPU first. 2. Using a FIFO queue 3. Average waiting time is more Process Burst Time P 1 24 P 2 3 P 3 3 Average waiting time: (0 + 24 + 27)/3 = 17 ms Fig. Gantt chart for process in the order Average wait time of ( 0 + 3 + 6 ) / 3 = 3. 0 ms p 2, p 3, p 1

SCHEDULING ALGORITHMS USED Shortest-Job-First Scheduling 1. Depends on the length of the next CPU

SCHEDULING ALGORITHMS USED Shortest-Job-First Scheduling 1. Depends on the length of the next CPU burst of a process. 2. If the next CPU bursts of two processes are the same, FCFS scheduling is used. 3. Two types: Pre-emptive, Non-pre-emptive. 4. Preemptive SJF algorithm will preempt the currently executing process. 5. Non-preemptive SJF algorithm will allow the currently running process to finish its CPU burst. � Non-pre-emptive: consider the following set of processes p 1, p 2, p 3, p 4 and their CPU burst given in milliseconds with arrival time as 0 for all the processes. Process Burst Time P 1 6 P 2 8 P 3 7 P 4 3

SCHEDULING ALGORITHMS USED Round-Robin Scheduling 1. Round Robin is a preemptive scheduling algorithm. 2.

SCHEDULING ALGORITHMS USED Round-Robin Scheduling 1. Round Robin is a preemptive scheduling algorithm. 2. A small unit of time, called a time quantum 3. CPU scheduler selects the process from the queue and allocates the CPU to each process for a time interval of one quantum. 4. All the processes in the queue are executed in the cyclic way. 5. Switching Overhead is the main problem. Fig. Representation of the Round Robin Implementation

IMPLEMENTATION Technical Details: 1. Language: Java 2. Platform: Linux (open source O/S) 3. Algorithms

IMPLEMENTATION Technical Details: 1. Language: Java 2. Platform: Linux (open source O/S) 3. Algorithms Used: FIFO, SJF, Round Robin Data Structures: 1. 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: FIFO Algorithm Result Set

CPU SCHEDULING SIMULATOR OUTPUT: SJF Algorithm Result Set

CPU SCHEDULING SIMULATOR OUTPUT: SJF Algorithm Result Set

CPU SCHEDULING SIMULATOR OUTPUT: RR Algorithm Result Set

CPU SCHEDULING SIMULATOR OUTPUT: RR Algorithm Result Set

ANALYSIS OF FIRST IN FIRST OUT (FIFO) • For different burst times, the wait

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) Wait time increase as it does the burst

ANALYSIS OF SHORTEST JOB FIRST (SJF) Wait time increase as it does the burst time. No correlation between the arrival time and the process waiting time as expected

ANALYSIS OF ROUND ROBIN (RR) • For different burst times, the wait time have

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

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

CONCLUSION FIFO - SJF – RR FIFO : Convey Effect – short process behind long process SJF : Starvation RR : Overhead FIFO

REFERENCES Research papers: Kishor, L. , & Goyal, D. (2013). Comparative analysis of various

REFERENCES Research papers: Kishor, L. , & Goyal, D. (2013). Comparative analysis of various scheduling algorithms.  nternational Journal of Advanced Research in Computer Engineering & Technology (IJARCET),  (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/procmgmt 2. 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 !

THANK YOU !