Presentation is loading. Please wait.

Presentation is loading. Please wait.

Process Scheduling In multiprogramming systems, when there is more than one ready process, the operating system must decide which one to activate. The.

Similar presentations


Presentation on theme: "Process Scheduling In multiprogramming systems, when there is more than one ready process, the operating system must decide which one to activate. The."— 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: 5 3 2 4 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.

4 Definitions of the components/Keywords: 5 3 2 4 1 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.

5 Definitions of the components/Keywords: 5 3 2 4 1 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 ProcessBurst time P1P1 24 P2P2 3 P3P3 3

6 Definitions of the components/Keywords: 5 3 2 4 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.

7 Definitions of the components/Keywords: 5 3 2 4 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.

8 Definitions of the components/Keywords: 5 3 2 4 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 ProcessArrival TimeBurst Time P1P1 07 P2P2 24 P3P3 41 P4P4 54

9 Definitions of the components/Keywords: 5 3 2 4 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 ProcessArrival TimeBurst Time P1P1 07 P2P2 24 P3P3 41 P4P4 54

10 Definitions of the components/Keywords: 5 3 2 4 1 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.

11 Definitions of the components/Keywords: 5 3 2 4 1 Round Robin (RR): Example The Gantt Chart for the schedule is: ProcessBurst Time P1P1 53 P2P2 17 P3P3 68 P4P4 24

12 Definitions of the components/Keywords: 5 3 2 4 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 Definitions of the components/Keywords: 5 3 2 4 1

13 Master Layout 5 3 2 4 1 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 Fig. A Simulation AreaControl Area  Select scheduling algorithm First Come First Serve Shortest Job First (Non-preemptive) Shortest Job First (Preemptive) Round Robin

14 Step 1: 1 5 3 2 4 First Come First Serve I nstruction for the animator T ext to be displayed in the working area (DT) Initially display first 2 sentences in DT User selects scheduling algorithm When Simulate button is pressed, a dialogue box must appear and show message “ Enter the no. of processes ( not more than 6 for graphical visualization) When ‘OK’ is pressed, in another box show the table of processes as shown in next slide Also show the text “ Enter the values of arrival time and burst time and click ‘Submit Query’ “ in text area When ‘submit query’ is pressed, - Display table 2 (next slide), time line (ms-milliseconds) and Gantt chart - show text “ Press Auto-run or stepper button” in text area The text in DT should appear in parallel to the figure Select scheduling algorithm Then click simulate button to begin Enter the values of arrival time and burst time and click ‘Submit Query’ Press Auto-run or stepper button Refer next slide for more details of the layout

15 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 -1 Table -2

16 Step 2: 1 5 3 2 4 First Come First Serve I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Give different color to each process Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Processes 1, 2 and 3 are ready in queue to be processed

17 Step 3: 1 5 3 2 4 First Come First Serve I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Processes 1, 2 and 3 are ready in queue to be processed

18 Step 4: 1 5 3 2 4 First Come First Serve I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 1 is in running state Processes 2 and 3 are ready in queue to be processed

19 Step 5: 1 5 3 2 4 First Come First Serve I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 1 is in running state Processes 2 and 3 are ready in queue to be processed

20 Step 6: 1 5 3 2 4 First Come First Serve I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 1 is in running state Processes 2 and 3 are ready in queue to be processed

21 Step 7: 1 5 3 2 4 First Come First Serve I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 2 is in running state Process 3 is ready in queue to be processed Process 1 is completed and terminated

22 Step 8: 1 5 3 2 4 First Come First Serve I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 3 is in running state Processes 1 and 2 are completed and terminated

23 Step 9: 1 5 3 2 4 First Come First Serve I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 3 is in running state Processes 1 and 2 are completed and terminated

24 Step 10: 1 5 3 2 4 First Come First Serve I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Processes 1,2 and 3 are completed and terminated Waiting time for P1 = 0, P2 =1, P3 = 0 Average waiting time: (0+1+0)/3 = 0.33 End of animation

25 1 5 3 2 4 Shortest Job First (Non- Preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) Initially display first 2 sentences in DT User selects scheduling algorithm When Simulate button is pressed, a dialogue box must appear and show message “ Enter the no. of processes ( not more than 6 for graphical visualization) When ‘OK’ is pressed, in another box show the table of processes as shown in next slide Also show the text “ Enter the values of arrival time and burst time and click ‘Submit Query’ “ in text area When ‘submit query’ is pressed, - Display table 2 (next slide), time line (ms-milliseconds) and Gantt chart - show text “ Press Auto-run or stepper button” in text area The text in DT should appear in parallel to the figure Select scheduling algorithm Then click simulate button to begin Enter the values of arrival time and burst time and click ‘Submit Query’ Press Auto-run or stepper button Step 11: Refer next slide for more details of the layout

26 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 -1 Table -2

27 1 5 3 2 4 Shortest Job First (Non- Preemptive) Step 12: Instruction for the animatorText to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Give different color to each process Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Once CPU given to the process it cannot be preempted until completes its CPU burst Processes 1, 2 and 3 are ready in queue to be processed

28 1 5 3 2 4 Shortest Job First (Non- Preemptive) Step 13: I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Processes 1, 2 and 3 are ready in queue to be processed

29 1 5 3 2 4 Shortest Job First (Non- Preemptive) Step 14: I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 1 is in running state Processes 2 and 3 are ready in queue to be processed

30 1 5 3 2 4 Shortest Job First (Non- Preemptive) Step 15: I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 1 is in running state Processes 2 and 3 are ready in queue to be processed

31 1 5 3 2 4 Shortest Job First (Non- Preemptive) Step 16: I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 1 is in running state Processes 2 and 3 are ready in queue to be processed

32 1 5 3 2 4 Shortest Job First (Non- Preemptive) Step 17: I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 1 is in running state Processes 2 and 3 are ready in queue to be processed

33 1 5 3 2 4 Shortest Job First (Non- Preemptive) Step 18: I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 3 is in running state Process 2 is ready in queue to be processed Process 1 is completed and terminated

34 1 5 3 2 4 Shortest Job First (Non- Preemptive) Step 19: I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 3 is in running state Process 2 is ready in queue to be processed Process 1 is completed and terminated

35 1 5 3 2 4 Shortest Job First (Non- Preemptive) Step 20: I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 3 is in running state Process 2 is ready in queue to be processed Process 1 is completed and terminated

36 1 5 3 2 4 Shortest Job First (Non- Preemptive) Step 21: I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 3 is in running state Process 2 is ready in queue to be processed Process 1 is completed and terminated

37 1 5 3 2 4 Shortest Job First (Non- Preemptive) Step 22: I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 3 is in running state Process 2 is ready in queue to be processed Process 1 is completed and terminated

38 1 5 3 2 4 Shortest Job First (Non- Preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 3 is in running state Process 2 is ready in queue to be processed Process 1 is completed and terminated Step 23:

39 1 5 3 2 4 Shortest Job First (Non- Preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 2 is in running state processes 1 and 3 are completed and terminated Step 24:

40 1 5 3 2 4 Shortest Job First (Non- Preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 2 is in running state processes 1 and 3 are completed and terminated Step 25:

41 1 5 3 2 4 Shortest Job First (Non- Preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 2 is in running state processes 1 and 3 are completed and terminated Step 26:

42 1 5 3 2 4 Shortest Job First (Non- Preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 2 is in running state processes 1 and 3 are completed and terminated Step 27:

43 1 5 3 2 4 Shortest Job First (Non- Preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 2 is in running state processes 1 and 3 are completed and terminated Step 28:

44 1 5 3 2 4 Shortest Job First (Non- Preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 2 is in running state processes 1 and 3 are completed and terminated Step 29:

45 1 5 3 2 4 Shortest Job First (Non- Preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 2 is in running state processes 1 and 3 are completed and terminated Step 30:

46 1 5 3 2 4 Shortest Job First (Non- Preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 2 is in running state processes 1 and 3 are completed and terminated Step 31:

47 1 5 3 2 4 Shortest Job First (Non- Preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Processes 1, 2 and 3 are completed and terminated Waiting time for P1=0, P2 =9, P3= 2 Average waiting time: (0+9+2)/3 = 3.67 End of animation Step 32:

48 1 5 3 2 4 Shortest Job First (preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) Initially display first 2 sentences in DT User selects scheduling algorithm When Simulate button is pressed, a dialogue box must appear and show message “ Enter the no. of processes ( not more than 6 for graphical visualization) When ‘OK’ is pressed, in another box show the table of processes as shown in next slide Also show the text “ Enter the values of arrival time and burst time and click ‘Submit Query’ “ in text area When ‘submit query’ is pressed, - Display table 2 (next slide), time line (ms-milliseconds) and Gantt chart - show text “ Press Auto-run or stepper button” in text area The text in DT should appear in parallel to the figure Select scheduling algorithm Then click simulate button to begin Enter the values of arrival time and burst time and click ‘Submit Query’ Press Auto-run or stepper button Step 33: Refer next slide for more details of the layout

49 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 -1 Table -2

50 1 5 3 2 4 Shortest Job First (preemptive) Instruction for the animator Text to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Give different color to each process Update the status / state of the process accordingly The text in DT should appear in parallel to the figure If a new process arrives with CPU burst length less than remaining time of current executing process, preempt Process 1 is in running state Processes 2, 3 and 4 are ready in queue to be processed Step 34:

51 1 5 3 2 4 Shortest Job First (preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 1 is in running state Processes 2, 3 and 4 are ready in queue to be processed Step 35:

52 1 5 3 2 4 Shortest Job First (preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 2 is in running state Process 1 is suspended and waiting in queue to be processed Processes 3 and 4 are ready in queue to be processed Step 36:

53 1 5 3 2 4 Shortest Job First (preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 2 is in running state Process 1 is suspended and waiting in queue to be processed Processes 3 and 4 are ready in queue to be processed Step 37:

54 1 5 3 2 4 Shortest Job First (preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 3 is in running state Processes 1 and 2 are suspended and waiting in queue to be processed Process 4 is ready in queue to be processed Step 38:

55 1 5 3 2 4 Shortest Job First (preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 2 is in running state Process 1 is suspended and waiting in queue to be processed Process 4 is ready in queue to be processed Process 3 is completed and terminated Step 39:

56 1 5 3 2 4 Shortest Job First (preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 2 is in running state Process 1 is suspended and waiting in queue to be processed Process 4 is ready in queue to be processed Process 3 is completed and terminated Step 40:

57 1 5 3 2 4 Shortest Job First (preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 4 is in running state Process 1 is suspended and waiting in queue to be processed Processes 2 and 3 are completed and terminated Step 41:

58 1 5 3 2 4 Shortest Job First (preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 4 is in running state Process 1 is suspended and waiting in queue to be processed Processes 2 and 3 are completed and terminated Step 42:

59 1 5 3 2 4 Shortest Job First (preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 4 is in running state Process 1 is suspended and waiting in queue to be processed Processes 2 and 3 are completed and terminated Step 43:

60 1 5 3 2 4 Shortest Job First (preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 4 is in running state Process 1 is suspended and waiting in queue to be processed Processes 2 and 3 are completed and terminated Step 44:

61 1 5 3 2 4 Shortest Job First (preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 1 is in running state Processes 2, 3 and 4 are completed and terminated Step 45:

62 1 5 3 2 4 Shortest Job First (preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 1 is in running state Processes 2, 3 and 4 are completed and terminated Step 46:

63 1 5 3 2 4 Shortest Job First (preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 1 is in running state Processes 2, 3 and 4 are completed and terminated Step 47:

64 1 5 3 2 4 Shortest Job First (preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 1 is in running state Processes 2, 3 and 4 are completed and terminated Step 48:

65 1 5 3 2 4 Shortest Job First (preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 1 is in running state Processes 2, 3 and 4 are completed and terminated Step 49:

66 1 5 3 2 4 Shortest Job First (preemptive) I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Processes 1, 2, 3 and 4 are completed and terminated Waiting time for P1=9, P2 =1, P3= 0, P4 = 2 Average waiting time: (9+1+0 +2)/4 = 3 End of animation Step 50:

67 1 5 3 2 4 Round Robin I nstruction for the animator T ext to be displayed in the working area (DT) Initially display first 2 sentences in DT User selects scheduling algorithm After Round Robin is selected, enable “Select time slice” dropdown When Simulate button is pressed, a dialogue box must appear and show message “ Enter the no. of processes ( not more than 6 for graphical visualization) When ‘OK’ is pressed, in another box show the table of processes as shown in next slide Also show the text “ Enter the values of arrival time and burst time and click ‘Submit Query’ “ in text area When ‘submit query’ is pressed, - Display table 2 (next slide), time line (ms-milliseconds) and Gantt chart - show text “ Press Auto-run or stepper button” in text area The text in DT should appear in parallel to the figure Select scheduling algorithm Then click simulate button to begin Enter the values of arrival time and burst time and click ‘Submit Query’ Press Auto-run or stepper button Step 51: Refer next slide for more details of the layout

68 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 -1 Table -2

69 1 5 3 2 4 Round Robin I nstruction for the animator Text to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Give different color to each process Update the status / state of the process accordingly The text in DT should appear in parallel to the figure If the CPU burst of the currently running process is larger than the time quantum, the timer will go off and cause an interrupt Process 1 is in running state Processes 2, 3 and 4 are ready in queue to be processed Step 52:

70 1 5 3 2 4 Round Robin I nstruction for the animator Text to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 1 is in running state Processes 2, 3 and 4 are ready in queue to be processed Step 53:

71 1 5 3 2 4 Round Robin I nstruction for the animator Text to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 2 is in running state Process 1 is suspended and waiting in queue to be processed Processes 3 and 4 are ready in queue to be processed Step 54:

72 1 5 3 2 4 Round Robin I nstruction for the animator Text to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 2 is in running state Process 1 is suspended and waiting in queue to be processed Processes 3 and 4 are ready in queue to be processed Step 55:

73 1 5 3 2 4 Round Robin I nstruction for the animator Text to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 3 is in running state Processes 1 and 2 are suspended and waiting in queue to be processed Process 4 is ready in queue to be processed Step 56:

74 1 5 3 2 4 Round Robin I nstruction for the animator Text to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 3 is in running state Processes 1 and 2 are suspended and waiting in queue to be processed Process 4 is ready in queue to be processed Step 57:

75 1 5 3 2 4 Round Robin I nstruction for the animator Text to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 1 is in running state Processes 2 and 3 are suspended and waiting in queue to be processed Process 4 is ready in queue to be processed Step 58:

76 1 5 3 2 4 Round Robin I nstruction for the animator Text to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 1 is in running state Processes 2 and 3 are suspended and waiting in queue to be processed Process 4 is ready in queue to be processed Step 59:

77 1 5 3 2 4 Round Robin I nstruction for the animator Text to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 2 is in running state Process 3 is suspended and waiting in queue to be processed Process 4 is ready in queue to be processed Process 1 is completed and terminated Step 60:

78 1 5 3 2 4 Round Robin I nstruction for the animator Text to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 2 is in running state Process 3 is suspended and waiting in queue to be processed Process 4 is ready in queue to be processed Process 1 is completed and terminated Step 61:

79 1 5 3 2 4 Round Robin I nstruction for the animator Text to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 3 is in running state Process 2 is suspended and waiting in queue to be processed Process 4 is ready in queue to be processed Process 1 is completed and terminated Step 62:

80 1 5 3 2 4 Round Robin I nstruction for the animator Text to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 3 is in running state Process 2 is suspended and waiting in queue to be processed Process 4 is ready in queue to be processed Process 1 is completed and terminated Step 63:

81 1 5 3 2 4 Round Robin I nstruction for the animator Text to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 4 is in running state Processes 2 and 3 are suspended and waiting in queue to be processed Process 1 is completed and terminated Step 64:

82 1 5 3 2 4 Round Robin I nstruction for the animator Text to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 4 is in running state Processes 2 and 3 are suspended and waiting in queue to be processed Process 1 is completed and terminated Step 65:

83 1 5 3 2 4 Round Robin I nstruction for the animator Text to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 2 is in running state Process 3 is suspended and waiting in queue to be processed Processes 1 and 4 are completed and terminated Step 66:

84 1 5 3 2 4 Round Robin I nstruction for the animator Text to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 2 is in running state Process 3 is suspended and waiting in queue to be processed Processes 1 and 4 are completed and terminated Step 67:

85 1 5 3 2 4 Round Robin I nstruction for the animator Text to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 2 is in running state Process 3 is suspended and waiting in queue to be processed Processes 1 and 4 are completed and terminated Step 68:

86 1 5 3 2 4 Round Robin I nstruction for the animator Text to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 3 is in running state Process 2 is suspended and waiting in queue to be processed Processes 1 and 4 are completed and terminated Step 69:

87 1 5 3 2 4 Round Robin I nstruction for the animator Text to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Process 2 is in running state Processes 1, 3 and 4 are completed and terminated Step 70:

88 1 5 3 2 4 Round Robin I nstruction for the animator T ext to be displayed in the working area (DT) When Stepper or Auto-run button is pressed, the simulation starts Display the figure as shown above Update the status / state of the process accordingly The text in DT should appear in parallel to the figure Processes 1, 2, 3 and 4 are completed and terminated Waiting time for P1=4, P2 =10, P3= 9, P4 = 4 Average waiting time: (4+10+9 +4)/4 = 6.5 End of animation Step 71:

89 1 5 3 2 4 Round Robin I nstruction for the animator T ext to be displayed in the working area (DT) If the burst time given is more, a dialogue box should appear and show the text “ Exceeding the limit, reset to simulate again” The text in DT should appear in parallel to the figure “ Exceeding the limit, reset to simulate again” Step 72:

90 Introduction Credits 90 Definitions Test your understanding (questionnaire) ‏ Lets Sum up (summary) ‏ Want to know more… (Further Reading) ‏ Try it yourself Interactivity: Analogy Slide 1 Slide 3 Slide 91 – 95 Slide 96 Electrical Engineering The demo itself is interactivity in this LO

91 Questionnaire 1. FIFO scheduling is ________. Answers: a) Preemptive Scheduling b) Non Preemptive Scheduling c) Deadline Scheduling d) Fair share scheduling 1 5 2 4 3

92 Questionnaire 2. When time quantum in Round Robin scheduling grows, it acts as ________. Answers: a) FCFS b) Shortest job first c) Shortest remaining d) Longest time first 1 5 2 4 3

93 Questionnaire 3. Which scheduling policy is most suitable for a time-shared operating system? Answers: a) Shortest-job First b) Priority c) Round-Robin d) First-Come-First-Serve 1 5 2 4 3

94 Questionnaire 4. Five jobs (A, B, C, D, E) are waiting to be processed. Their processing times and due dates are given below. Using the shortest processing time dispatching rule, in which order should the jobs be processed? Answers: a) A, B, C, D, E b) C, E, A, D, B c) B, D, A, E, C d) D, A, E, B, C 1 5 2 4 3 JobBurst Time A4 B1 C8 D1 E5

95 Questionnaire 5. The scheduling in which CPU is allocated to the process with least CPU-burst time is called _________ Answers: a) Priority Scheduling b) Shortest job first Scheduling c) Round Robin Scheduling d) Multilevel Queue Scheduling 1 5 2 4 3

96 Links for further reading Reference websites: http://www.cs.utexas.edu/~lorenzo/corsi/cs372/03F/notes/10-09.pdf http://www.slideshare.net/abhisheknagar/process-scheduling http://www.cse.buffalo.edu/~bina/cse421/spring2003/ScheduleFeb19.pdf http://iete-elan.ac.in/SolQP/soln/DC14_sol.pdf http://www.gitam.edu/eresource/comp/gvr%28os%29/5.3.htm Books:


Download ppt "Process Scheduling In multiprogramming systems, when there is more than one ready process, the operating system must decide which one to activate. The."

Similar presentations


Ads by Google