CPU Scheduling Algorithms PDF
Document Details
Uploaded by EntrancingOnomatopoeia5884
Tags
Summary
This document provides examples of CPU scheduling algorithms, focusing on First-Come, First-Served (FCFS). It details calculations for waiting time and turnaround time for different processes under the FCFS method.
Full Transcript
Computer dept./4th stage/Os lecture/lect.5 11/11/2023 CPU Scheduling Algorithms are:- 1. First-Come, First Serve (FCFS or FIFO) (non-preemptive) 2. Priority (e.g., Shortest Job First (SJF; non-preemptive) or Shortest Remaining Time First (SRTF; preempt...
Computer dept./4th stage/Os lecture/lect.5 11/11/2023 CPU Scheduling Algorithms are:- 1. First-Come, First Serve (FCFS or FIFO) (non-preemptive) 2. Priority (e.g., Shortest Job First (SJF; non-preemptive) or Shortest Remaining Time First (SRTF; preemptive)) 3. Round Robin (preemptive) 4. Multi-level Queue 5. Multi-level Feedback Queue First-Come, First Serve are:- non-preemptive scheduling management ready queue is managed as a FIFO queue Example: Three jobs arrive at time 0 in the following order (batch processing): Burst Process Arrival Time 1 24 0 2 3 0 3 3 0 Draw the table for computing start time , wait, finish, turnaround time for each process then compute the average waiting time and average turnaround time by using FCFS scheduling algorithm. Solution Burst Wait= Finish= TA Process Arrival Start Time (start – arrival) Start + burst (finish- arrival) 1 24 0 0 0 24 24 2 3 0 24 24 27 27 3 3 0 27 27 30 30 average waiting time: (0+24+27)/3 = 17 average turnaround time: (24+27+30)/3 = 27 if the process arrival as order: 2, 3, 1 Computer dept./4th stage/Os lecture/lect.5 11/11/2023 Wait= Finish= TA= Process Burst Time Arrival Start start–arrival Start +burst finish- arrival 2 3 0 0 0 3 3 3 3 0 3 3 6 6 1 24 0 6 6 30 30 average waiting time: (0+3+6)/3 = 3 average turnaround time: (3+6+30) /3= 13 Example2: perform the FCFS scheduling algorithm for the following process table Process Burst Time Arrival 1 12 0 2 6 1 3 9 4 Solution Burst Wait= Finish= TA= Process Arrival Start Time Start- arrival Start+burst finish- arrival 1 12 0 0 0 12 12 2 6 1 12 11 18 17 3 9 4 18 14 27 23 average waiting time: = (0+11+14)/3 = 8.33 average turnaround time: = (12+17+23)/3 = 52/3 = 17.33 Example3: perform the FCFS scheduling algorithm for the following process table Process Burst Time Arrival 1 10 0 2 29 0 3 3 0 4 7 0 5 12 0 Solution Burst Wait= Finish= TA= Process Arrival Start Time Start- arrival Start +burst finish- arrival 1 10 0 0 0 10 10 2 29 0 10 10 39 39 Computer dept./4th stage/Os lecture/lect.5 11/11/2023 3 3 0 39 39 42 42 4 7 0 42 42 49 49 5 12 0 49 49 61 61 average waiting time= (0+10+39+42+49)/5 = 28 average turnaround time= (10+39+42+49+61)/5 = 40.2