1 / 96

Process Scheduling

Process Scheduling.

lilike
Download Presentation

Process Scheduling

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Process Scheduling In multiprogramming systems, when there is more than one ready process, the operating system must decide which one to activate. The decision is made by the part of the operating system called the scheduler, using a Scheduling algorithm. There are various scheduling algorithms used for process scheduling. The applet developed support Round-Robin, Shortest Job First, and First Come First Serve scheduling algorithms. The applet also gives a performance evaluation for these algorithms for given input details. • Course Name: Networking Level(UG/PG): UG • Author(s) : Phani Swathi Chitta • Mentor: Aruna Adil *The contents in this ppt are licensed under Creative Commons Attribution-NonCommercial-ShareAlike 2.5 India license

  2. Learning Objectives After interacting with this Learning Object, the learner will be able to: • Explain various scheduling algorithms used for process scheduling

  3. Definitions of the components/Keywords: 1 • CPU Scheduling deals with the problem of deciding which of the processes in the ready queue is to be allocated the CPU. • Scheduling is important for improving the system performance. • Various CPU Scheduling algorithms are: • FCFS – First Come First Serve • Non- Preemptive • SJF – Shortest Job First • Preemptive ≈ (SRF – Shortest Remaining First) • Round Robin • A Gantt chart is a useful tool for planning and scheduling projects. • A Gantt chart is helpful when monitoring a project's progress. 2 3 4 5

  4. Definitions of the components/Keywords: • First Come First Serve (FCFS) : • This algorithm is also called First-In-First-Out (FIFO) • In this scheduling scheme, the process that requests the CPU first is allocated the CPU first. The requesting processes are managed using the First In First Out (FIFO) queue. A process entering the ready queue has its PCB linked at the tail of the queue. When the CPU is free, it s allocated to the process at the head of the queue and the running process is then removed from the queue. The average waiting time under this policy is quite long. The FCFS scheduling algorithm is non- preemptive and hence not entertained in the timesharing system. 1 2 3 4 5

  5. Definitions of the components/Keywords: • First Come First Serve (FCFS) : • Example • Suppose that the processes arrive in the order: P1, P2, P3 • The Gantt Chart for the schedule is: • Waiting time for P1= 0; P2= 24; P3 = 27 • Average waiting time: (0 + 24 + 27)/3 = 17 1 2 3 4 5

  6. Definitions of the components/Keywords: 1 • Shortest Job First (SJF) : • The SJF algorithm is a special case of the general priority scheduling algorithm wherein a priority is associated with each process and the CPU is allocated to the process with the highest priority. In case of SJF, the process with the shortest next CPU burst is assigned with the highest priority. • This is also called SPN (shortest process next). • When the CPU is available, it is assigned to the process that has the smallest next CPU burst. If the next CPU bursts of two processes are the same, FCFS scheduling is used. • In this the burst times of all the jobs which are waiting in the queue are compared. The job which is having the least CPU execution time will be given to the processor at first. • In this turnaround time and waiting times are least. 2 3 4 5

  7. Definitions of the components/Keywords: 1 • Shortest Job First (SJF): • Two schemes: • Non preemptive – once CPU given to the process it cannot be preempted until completes its CPU burst. • Preemptive – if a new process arrives with CPU burst length less than remaining time of current executing process, preempt. This scheme is know as the Shortest-Remaining-Time-First (SRTF). • SJF is optimal – gives minimum average waiting time for a given set of processes. 2 3 4 5

  8. Definitions of the components/Keywords: 1 • Shortest Job First (SJF): • Example for SJF Non Preemptive • The Gantt Chart for the schedule is: • Average waiting time: (0 + 6 + 3 + 7)/4 = 4 2 3 4 5

  9. Definitions of the components/Keywords: 1 • Shortest Job First (SJF): • Example for SJF Preemptive • The Gantt Chart for the schedule is: • Average waiting time: (9 + 1 + 0 + 2)/4 = 3 2 3 4 5

  10. Definitions of the components/Keywords: • Round Robin (RR): • The RR scheduling algorithm is designed especially for time – sharing systems. A small unit of time, called a time quantum or time slice (generally 10 to 100ms) is defined. The ready queue is maintained as a circular queue. CPU scheduler picks the first job from the ready queue, sets a timer to interrupt after one time quantum, and dispatches the process. The dispatched process will again execute when it gets another time quantum. • The period of time for which a process is allowed to run in a preemptive multitasking system is generally called the time slice, or quantum • Smaller quanta are generally desirable because they improve response time • As the time quantum grows Round Robin becomes First Come First Serve • Two possibilities arise: • Process may have a CPU burst less than the time quantum. In this case, the process itself releases the CPU voluntarily, by issuing an I/O request or terminating. • If the CPU burst of the currently running process is larger than the time quantum, the timer will go off and cause an interrupt to the operating system. The registers for the interrupted process are saved in its PCB and the process is saved at the tail of the ready queue. The scheduler then proceeds to the next job in the ready queue. 1 2 3 4 5

  11. Definitions of the components/Keywords: 1 • Round Robin (RR): • Example • The Gantt Chart for the schedule is: 2 3 4 5

  12. Definitions of the components/Keywords: Definitions of the components/Keywords: 1 1 • Turnaround Time: Interval between the time of submission and completion of the job is called Turnaround time • Burst Time: Burst Time is actually time that is required to complete execution of particular task or process • Waiting Time: Amount of time a process has been waiting in the ready queue 2 2 3 3 4 4 5 5

  13. Master Layout 1 Simulation Area Control Area • Select scheduling algorithm • First Come First Serve • Shortest Job First (Non-preemptive) • Shortest Job First (Preemptive) • Round Robin 2 3 Fig. A 4 • Give START, PAUSE and STOP/ RESET buttons • Give a slider to control the speed of animation • Give a STEPPER button that allows the user to follow the simulation procedure step by step. After every step the simulation pauses until the STEPPER button is pressed • Give an AUTO-Run button that allows user to follow the simulation continuously • Give a text area to display the status of the simulation • Give a dropdown to select scheduling algorithm • Give another dropdown box to select time slice (range 1 – 10). This should be enabled only when Round Robin algorithm is selected 5

  14. Step 1: First Come First Serve 1 Refer next slide for more details of the layout 2 3 4 5

  15. Table -1 • Give ADD, REMOVE and SUBMIT QUERY buttons • When ADD is pressed, a new process must be added with arrival time and burst time • At the max 6 processes can be there in the table • Arrival time and Burst time values can be changed but show values in table 1 as default • When any process is selected and REMOVE is pressed, the corresponding process must be removed • When SUBMIT QUERY is pressed, these processes should be shown in the simulation area with the Gantt chart below the processes Table -2

  16. Step 2: First Come First Serve 1 2 3 4 5

  17. Step 3: First Come First Serve 1 2 3 4 5

  18. Step 4: First Come First Serve 1 2 3 4 5

  19. Step 5: First Come First Serve 1 2 3 4 5

  20. Step 6: First Come First Serve 1 2 3 4 5

  21. Step 7: First Come First Serve 1 2 3 4 5

  22. Step 8: First Come First Serve 1 2 3 4 5

  23. Step 9: First Come First Serve 1 2 3 4 5

  24. Step 10: First Come First Serve 1 2 3 4 5

  25. Step 11: Shortest Job First (Non- Preemptive) 1 Refer next slide for more details of the layout 2 3 4 5

  26. Table -1 • Give ADD, REMOVE and SUBMIT QUERY buttons • When ADD is pressed, a new process must be added with arrival time and burst time • At the max 6 processes can be there in the table • Arrival time and Burst time values can be changed but show values in table 1 as default • When any process is selected and REMOVE is pressed, the corresponding process must be removed • When SUBMIT QUERY is pressed, these processes should be shown in the simulation area with the Gantt chart below the processes Table -2

  27. Step 12: Shortest Job First (Non- Preemptive) 1 2 3 4 5

  28. Step 13: Shortest Job First (Non- Preemptive) 1 2 3 4 5

  29. Step 14: Shortest Job First (Non- Preemptive) 1 2 3 4 5

  30. Step 15: Shortest Job First (Non- Preemptive) 1 2 3 4 5

  31. Step 16: Shortest Job First (Non- Preemptive) 1 2 3 4 5

  32. Step 17: Shortest Job First (Non- Preemptive) 1 2 3 4 5

  33. Step 18: Shortest Job First (Non- Preemptive) 1 2 3 4 5

  34. Step 19: Shortest Job First (Non- Preemptive) 1 2 3 4 5

  35. Step 20: Shortest Job First (Non- Preemptive) 1 2 3 4 5

  36. Step 21: Shortest Job First (Non- Preemptive) 1 2 3 4 5

  37. Step 22: Shortest Job First (Non- Preemptive) 1 2 3 4 5

  38. Step 23: Shortest Job First (Non- Preemptive) 1 2 3 4 5

  39. Step 24: Shortest Job First (Non- Preemptive) 1 2 3 4 5

  40. Step 25: Shortest Job First (Non- Preemptive) 1 2 3 4 5

  41. Step 26: Shortest Job First (Non- Preemptive) 1 2 3 4 5

  42. Step 27: Shortest Job First (Non- Preemptive) 1 2 3 4 5

  43. Step 28: Shortest Job First (Non- Preemptive) 1 2 3 4 5

  44. Step 29: Shortest Job First (Non- Preemptive) 1 2 3 4 5

  45. Step 30: Shortest Job First (Non- Preemptive) 1 2 3 4 5

  46. Step 31: Shortest Job First (Non- Preemptive) 1 2 3 4 5

  47. Step 32: Shortest Job First (Non- Preemptive) 1 2 3 4 5

  48. Step 33: Shortest Job First (preemptive) 1 Refer next slide for more details of the layout 2 3 4 5

  49. Table -1 • Give ADD, REMOVE and SUBMIT QUERY buttons • When ADD is pressed, a new process must be added with arrival time and burst time • At the max 6 processes can be there in the table • Arrival time and Burst time values can be changed but show values in table 1 as default • When any process is selected and REMOVE is pressed, the corresponding process must be removed • When SUBMIT QUERY is pressed, these processes should be shown in the simulation area with the Gantt chart below the processes Table -2

  50. Step 34: Shortest Job First (preemptive) 1 2 3 4 5

More Related