SlideShare a Scribd company logo
1 of 12
SCHEDULING
CA1
Name- Sarupya Datta Sub- Operating System
Roll No.- 13000121089 Code- PCC-CS502
Stream- CSE Sec- B
Registration No.- 211300100110097
INTRODUCTION
• CPU scheduling in operating systems is the process of determining which process or task should have access
to the CPU (Central Processing Unit) at any given time. The scheduler makes this decision based on
predefined algorithms and policies, with the goal of optimizing system performance, responsiveness, and
resource utilization. CPU scheduling enables multitasking, allowing multiple processes to run concurrently
and share the CPU's processing time, leading to efficient execution of tasks and a smooth user experience .
• There are different CPU scheduling algorithms, but here we are going to discuss only those
two type which are related to our assignment–
 SRTF
 FCFS
Shortest RemainingTime First Algorithm
(SRTF)
• Shortest Time Remaining First (STRF) is a CPU scheduling algorithm used in operating
systems. In STRF, the operating system selects the process with the smallest remaining burst
time (time required to complete its execution) to execute next.
• This ensures that the process with the least amount of work remaining is given priority.
• STRF aims to minimize the average waiting time and turnaround time for processes, making
it an efficient scheduling algorithm for certain scenarios, particularly when dealing with
short tasks.
• It is a preemptive variant of Shortest Job Next (SJN) scheduling.
• Mode -> preemptive
• Criteria -> Burst time(B.T)
Numericals
• Q1). Consider a uniprocessor system, where three processes (Process ID 1, 2, 3 respectively) are there. Arrival
time of the three processes are last 3 digits of your registration number (i.e. if your registration number is
201300100110019, arrival time of P1=0, P2=1, P3=9). Burst time of process 1 is the addition of date (dd, i.e. if
21/07/2003 is Date of Birth, then it is 2+1 = 3), process 2 is addition of month (mm, if July then 0+7, i.e. 7),
and process 3 is addition of last two digit of the year (yy, if 2003 then 0+3, i.e. 3, if it is 2000 then take first 2
digit). Assume that CPU is using Shortest remaining time first algorithm.
i. Calculate Waiting time of each of the process
ii. Calculate turnaround time of each of the process.
iii. Calculate the percentage of time CPU remains idle.
Sol-
• Priority:- Shortest Remaining Time First (SRTF)
• To Calculate:- 1) Waiting time of each process.
2) Turn around time of each of the process.
3) Percentage of time CPU remains idle.
• Registration no. 211300100110097
• Date of Birth- 02/03/2003
Processors Arrival Burst
P1 0 2
P2 9 3
P3 7 3
PROCESS
ID
ARRIVAL
TIME
(AT)
BURST
TIME
(BT)
COMPLETION
TIME
(CT)
Turn
Around
Time
(CT-AT)
WAITING
TIME
(TAT-BT)
P1 0 2 2 2 0
P2 9 3 13 4 1
P3 7 3 10 3 0
P1 --- P3 P2
0 2 7 10 13
GANTT CHART:-
i) Calculated Waiting time of each of the process:- P1=0
P2=1
P3=0
ii) Calculated Turn-around Time of each of the process:- P1=2
P2=4
P3=3
iii) Calculate the percentage of time CPU remains idle:-
(Total idle time of CPU/ Total time take for competition of whole process)*100
= (5/13)*100
= 38.46 %
FCFS
• First Come First Serve (FCFS) is a non-preemptive CPU scheduling algorithm used in operating systems.
• In FCFS, processes are executed in the order they arrive in the ready queue .
• The process that arrives first is the first to be allocated the CPU, and it continues running until it completes
its execution or enters a waiting state. Only when the first process finishes, the next process in the queue is
executed, and this process continues until all processes are completed.
• FCFS operates on a first-come, first-served basis, without any consideration of the length of the processes or
their priority.
• While FCFS is easy to implement and ensures fairness, it may lead to long average waiting times, especially
if longer processes arrive first and block shorter ones from executing.
• Criteria:- Arrival Time(A.T)
• Mode:-Non-preemptive
• FCFS is not the most efficient scheduling algorithm and may not be suitable for scenarios with varying
process execution times.
Q2) Consider a uniprocessor system, where there exist three processes (Process ID 1, 2, 3 respectively). CPU assigns priority
of the processes based on highest waiting time of the processes present at that time after every 2-unit time. In any process
terminates before the interval time then the default situation will be FCFS scheduling. Each of the process will arrive based
on the last 3 digits of your university roll number. (If Roll No. is 13000118137, arrival time of P0 =1, P1=3, P2=7). CPU
Burst time will be first three digits of your mobile number (i.e. if your mobile number is 8756540439, CPU burst time of
P1=8, P2=7, P3=5, if any number is 0, then take next non zero value from your mobile number like 7000312867, CPU burst
time of P1=7, P2=3, P3=1).
i. Calculate Average Waiting Time.
ii. Calculate Average Turnaround Time.
iii. Calculate the percentage of time CPU remains idle
Sol-
Priority:-
Highest waiting time after every 2 unit of time interval
FCFS(Default: If any process terminates before the interval )
To Calculate:-
i. Average Waiting Time
ii. Average turn around Time
iii. Percentage of time CPU remains idle
University roll number : 13000121089
Mobile number : 7003072392
Process Arrival Time Burst Time
P1 0 7
P2 8 3
P3 9 7
PROCESS
ID
ARRIVAL
TIME
(AT)
BURST
TIME
(BT)
COMPLETION
TIME
(CT)
Turn Around Time
(CT-AT)
WAITING
TIME
(TAT-BT)
P1 0 7 7 7 0
P2 8 3 13 5 2
P3 9 7 18 9 2
P1 P1 P1 P1 ----- P2 P3 P2 P3
0 2 4 6 7 8 10 12 13 18
i) Calculate Average Waiting Time: (WT of P1 + WT of P2 + WT of P3 )/3
= (0 + 2 + 2)/3
= 4/3
= 1.33 %
ii) Calculate Average Turnaround Time : (TAT of P1 + TAT of P2 + TAT of P3)/3
= (7 + 5 + 9)/3
= 21/3
= 7 %
iii) Calculate the percentage of time CPU remains idle : (Total idle time of CPU/ Total time take for competition of whole process)*100
= 1/18 * 100
= 5.55 %
Conclusion
Scheduling algorithms tell the CPU which will be the next process to have CPU time. The main goal
of scheduling algorithms in OS is to Maximize Throughput. Scheduling algorithms can be preemptive
and non-preemptive.
Thank You

More Related Content

Similar to Priority Scheduling.pptx

Document 14 (6).pdf
Document 14 (6).pdfDocument 14 (6).pdf
Document 14 (6).pdfRajMantry
 
OS Process Chapter 3.pdf
OS Process Chapter 3.pdfOS Process Chapter 3.pdf
OS Process Chapter 3.pdfKp Sharma
 
Operating System-Process Scheduling
Operating System-Process SchedulingOperating System-Process Scheduling
Operating System-Process SchedulingShipra Swati
 
Scheduling algo(by HJ)
Scheduling algo(by HJ)Scheduling algo(by HJ)
Scheduling algo(by HJ)Harshit Jain
 
CPU scheduling
CPU schedulingCPU scheduling
CPU schedulingAmir Khan
 
Process management in os
Process management in osProcess management in os
Process management in osMiong Lazaro
 
Introduction to shortest job first scheduling
Introduction to shortest job first schedulingIntroduction to shortest job first scheduling
Introduction to shortest job first schedulingZeeshan Iqbal
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithmsPaurav Shah
 
Ch6
Ch6Ch6
Ch6C.U
 
chapter 5 CPU scheduling.ppt
chapter  5 CPU scheduling.pptchapter  5 CPU scheduling.ppt
chapter 5 CPU scheduling.pptKeyreSebre
 
Ch05 cpu-scheduling
Ch05 cpu-schedulingCh05 cpu-scheduling
Ch05 cpu-schedulingNazir Ahmed
 
Comparision of different Round Robin Scheduling Algorithm using Dynamic Time ...
Comparision of different Round Robin Scheduling Algorithm using Dynamic Time ...Comparision of different Round Robin Scheduling Algorithm using Dynamic Time ...
Comparision of different Round Robin Scheduling Algorithm using Dynamic Time ...Editor IJMTER
 
Lecture 5, 6 and 7 cpu scheduling
Lecture 5, 6 and 7  cpu schedulingLecture 5, 6 and 7  cpu scheduling
Lecture 5, 6 and 7 cpu schedulingRushdi Shams
 

Similar to Priority Scheduling.pptx (20)

Document 14 (6).pdf
Document 14 (6).pdfDocument 14 (6).pdf
Document 14 (6).pdf
 
OS Process Chapter 3.pdf
OS Process Chapter 3.pdfOS Process Chapter 3.pdf
OS Process Chapter 3.pdf
 
Fcfs and sjf
Fcfs and sjfFcfs and sjf
Fcfs and sjf
 
Operating System-Process Scheduling
Operating System-Process SchedulingOperating System-Process Scheduling
Operating System-Process Scheduling
 
UNIT II - CPU SCHEDULING.docx
UNIT II - CPU SCHEDULING.docxUNIT II - CPU SCHEDULING.docx
UNIT II - CPU SCHEDULING.docx
 
Scheduling algo(by HJ)
Scheduling algo(by HJ)Scheduling algo(by HJ)
Scheduling algo(by HJ)
 
CPU scheduling
CPU schedulingCPU scheduling
CPU scheduling
 
Cpu Scheduling Galvin
Cpu Scheduling GalvinCpu Scheduling Galvin
Cpu Scheduling Galvin
 
Process management in os
Process management in osProcess management in os
Process management in os
 
Introduction to shortest job first scheduling
Introduction to shortest job first schedulingIntroduction to shortest job first scheduling
Introduction to shortest job first scheduling
 
Os module 2 ba
Os module 2 baOs module 2 ba
Os module 2 ba
 
ch_scheduling (1).ppt
ch_scheduling (1).pptch_scheduling (1).ppt
ch_scheduling (1).ppt
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
Ch6
Ch6Ch6
Ch6
 
chapter 5 CPU scheduling.ppt
chapter  5 CPU scheduling.pptchapter  5 CPU scheduling.ppt
chapter 5 CPU scheduling.ppt
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
Ch05 cpu-scheduling
Ch05 cpu-schedulingCh05 cpu-scheduling
Ch05 cpu-scheduling
 
Comparision of different Round Robin Scheduling Algorithm using Dynamic Time ...
Comparision of different Round Robin Scheduling Algorithm using Dynamic Time ...Comparision of different Round Robin Scheduling Algorithm using Dynamic Time ...
Comparision of different Round Robin Scheduling Algorithm using Dynamic Time ...
 
Lecture 5, 6 and 7 cpu scheduling
Lecture 5, 6 and 7  cpu schedulingLecture 5, 6 and 7  cpu scheduling
Lecture 5, 6 and 7 cpu scheduling
 
exp 3.docx
exp 3.docxexp 3.docx
exp 3.docx
 

Recently uploaded

VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAbhinavSharma374939
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 

Recently uploaded (20)

VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog Converter
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 

Priority Scheduling.pptx

  • 1. SCHEDULING CA1 Name- Sarupya Datta Sub- Operating System Roll No.- 13000121089 Code- PCC-CS502 Stream- CSE Sec- B Registration No.- 211300100110097
  • 2. INTRODUCTION • CPU scheduling in operating systems is the process of determining which process or task should have access to the CPU (Central Processing Unit) at any given time. The scheduler makes this decision based on predefined algorithms and policies, with the goal of optimizing system performance, responsiveness, and resource utilization. CPU scheduling enables multitasking, allowing multiple processes to run concurrently and share the CPU's processing time, leading to efficient execution of tasks and a smooth user experience . • There are different CPU scheduling algorithms, but here we are going to discuss only those two type which are related to our assignment–  SRTF  FCFS
  • 3. Shortest RemainingTime First Algorithm (SRTF) • Shortest Time Remaining First (STRF) is a CPU scheduling algorithm used in operating systems. In STRF, the operating system selects the process with the smallest remaining burst time (time required to complete its execution) to execute next. • This ensures that the process with the least amount of work remaining is given priority. • STRF aims to minimize the average waiting time and turnaround time for processes, making it an efficient scheduling algorithm for certain scenarios, particularly when dealing with short tasks. • It is a preemptive variant of Shortest Job Next (SJN) scheduling. • Mode -> preemptive • Criteria -> Burst time(B.T)
  • 4. Numericals • Q1). Consider a uniprocessor system, where three processes (Process ID 1, 2, 3 respectively) are there. Arrival time of the three processes are last 3 digits of your registration number (i.e. if your registration number is 201300100110019, arrival time of P1=0, P2=1, P3=9). Burst time of process 1 is the addition of date (dd, i.e. if 21/07/2003 is Date of Birth, then it is 2+1 = 3), process 2 is addition of month (mm, if July then 0+7, i.e. 7), and process 3 is addition of last two digit of the year (yy, if 2003 then 0+3, i.e. 3, if it is 2000 then take first 2 digit). Assume that CPU is using Shortest remaining time first algorithm. i. Calculate Waiting time of each of the process ii. Calculate turnaround time of each of the process. iii. Calculate the percentage of time CPU remains idle. Sol- • Priority:- Shortest Remaining Time First (SRTF) • To Calculate:- 1) Waiting time of each process. 2) Turn around time of each of the process. 3) Percentage of time CPU remains idle. • Registration no. 211300100110097 • Date of Birth- 02/03/2003
  • 5. Processors Arrival Burst P1 0 2 P2 9 3 P3 7 3 PROCESS ID ARRIVAL TIME (AT) BURST TIME (BT) COMPLETION TIME (CT) Turn Around Time (CT-AT) WAITING TIME (TAT-BT) P1 0 2 2 2 0 P2 9 3 13 4 1 P3 7 3 10 3 0 P1 --- P3 P2 0 2 7 10 13 GANTT CHART:-
  • 6. i) Calculated Waiting time of each of the process:- P1=0 P2=1 P3=0 ii) Calculated Turn-around Time of each of the process:- P1=2 P2=4 P3=3 iii) Calculate the percentage of time CPU remains idle:- (Total idle time of CPU/ Total time take for competition of whole process)*100 = (5/13)*100 = 38.46 %
  • 7. FCFS • First Come First Serve (FCFS) is a non-preemptive CPU scheduling algorithm used in operating systems. • In FCFS, processes are executed in the order they arrive in the ready queue . • The process that arrives first is the first to be allocated the CPU, and it continues running until it completes its execution or enters a waiting state. Only when the first process finishes, the next process in the queue is executed, and this process continues until all processes are completed. • FCFS operates on a first-come, first-served basis, without any consideration of the length of the processes or their priority. • While FCFS is easy to implement and ensures fairness, it may lead to long average waiting times, especially if longer processes arrive first and block shorter ones from executing. • Criteria:- Arrival Time(A.T) • Mode:-Non-preemptive • FCFS is not the most efficient scheduling algorithm and may not be suitable for scenarios with varying process execution times.
  • 8. Q2) Consider a uniprocessor system, where there exist three processes (Process ID 1, 2, 3 respectively). CPU assigns priority of the processes based on highest waiting time of the processes present at that time after every 2-unit time. In any process terminates before the interval time then the default situation will be FCFS scheduling. Each of the process will arrive based on the last 3 digits of your university roll number. (If Roll No. is 13000118137, arrival time of P0 =1, P1=3, P2=7). CPU Burst time will be first three digits of your mobile number (i.e. if your mobile number is 8756540439, CPU burst time of P1=8, P2=7, P3=5, if any number is 0, then take next non zero value from your mobile number like 7000312867, CPU burst time of P1=7, P2=3, P3=1). i. Calculate Average Waiting Time. ii. Calculate Average Turnaround Time. iii. Calculate the percentage of time CPU remains idle Sol- Priority:- Highest waiting time after every 2 unit of time interval FCFS(Default: If any process terminates before the interval ) To Calculate:- i. Average Waiting Time ii. Average turn around Time iii. Percentage of time CPU remains idle University roll number : 13000121089 Mobile number : 7003072392
  • 9. Process Arrival Time Burst Time P1 0 7 P2 8 3 P3 9 7 PROCESS ID ARRIVAL TIME (AT) BURST TIME (BT) COMPLETION TIME (CT) Turn Around Time (CT-AT) WAITING TIME (TAT-BT) P1 0 7 7 7 0 P2 8 3 13 5 2 P3 9 7 18 9 2 P1 P1 P1 P1 ----- P2 P3 P2 P3 0 2 4 6 7 8 10 12 13 18
  • 10. i) Calculate Average Waiting Time: (WT of P1 + WT of P2 + WT of P3 )/3 = (0 + 2 + 2)/3 = 4/3 = 1.33 % ii) Calculate Average Turnaround Time : (TAT of P1 + TAT of P2 + TAT of P3)/3 = (7 + 5 + 9)/3 = 21/3 = 7 % iii) Calculate the percentage of time CPU remains idle : (Total idle time of CPU/ Total time take for competition of whole process)*100 = 1/18 * 100 = 5.55 %
  • 11. Conclusion Scheduling algorithms tell the CPU which will be the next process to have CPU time. The main goal of scheduling algorithms in OS is to Maximize Throughput. Scheduling algorithms can be preemptive and non-preemptive.