SlideShare a Scribd company logo
1 of 52
Download to read offline
Operating system
Cpu scheduling
Cpu scheduling objectives:
❖ Introduce CPU scheduling, which is the basis for multiprogrammed
operating systems.
❖ Describe various cpu-scheduling algorithms.
❖ Discuss evaluation criteria for selecting a cpu-scheduling algorithm
for a particular system.
Introduction
❖ CPU scheduling is the task performed by CPU that decidesthe way
processedwould be executed.CPU resources are allocated to a process for
only a limited period of time and then those resources are taken back. A
running process could be interrupted to execute a higher priority process.
❖ CPU scheduling is a process which allows one process to use the CPU
while the execution of another process is on hold(in waiting state) due to
unavailability of any resource like I/O etc, thereby making full use of CPU.
The aim of CPU scheduling is to make the systemefficient, fast and fair.
Cpu scheduling basis for multiprogrammed operating
system:
CPU scheduling is the basis of multiprogrammed operating systems. By
switching the CPU among processes, the operating system can make the
computer more productive. In this chapter, we introduce basic CPU-scheduling
concepts and present several CPU-scheduling algorithms.
2 Types of cpu scheduling:
• Preemptive
• Non preemptive
Preemptive scheduling:
Preemptive scheduling is when a processtransitions from a running state to
a ready state or from a waiting state to a ready state.
Most common and complex.
Example:
• when a higher priority task wants the CPU.
• SRTF
• Priority(preemptive)
• RR
Scheduling overhead:
• Additional operations that take small amount of time
• RR
• SRTF
• Priority (preemptive)
• Multi-level feedback
• Hybrid scheduling scheme
Algorithms based on preemptive scheduling are: RoundRobin (RR),Shortest RemainingTime First (SRTF), Priority
(preemptive version), etc.
Non preemptive scheduling:
Non-preemptive Scheduling is used when a process terminates,or a process
switches from running to the waiting state.In this scheduling, once the
resources (CPU cycles) are allocated to a process. In the case of non-
preemptive scheduling does not interrupt a process running CPU in the
middle of the execution. Instead, it waits till the process completes its CPU
burst time, and then it can allocate the CPU to another process.
Example:
Non-preemptive Scheduling is rigid. ShortestRemaining Time First, Round
Robin, First Come First Serve, Shortest Job First(non-preemptive), Priority
Scheduling, etc.
Algorithms based on non-preemptive scheduling are: Shortest Job First (SJF basicallynon
preemptive) and Priority (non preemptive version), etc.
How is scheduler invoked:
➢ Voluntarily
• Process block due to I/o
• Calls scheduler
• E.g. FCFS, SJF
➢ Involuntarily
• Preemption done by algorithm or timer
• Kernal calls scheduler to take necessary action
• E.g. SRTF ,RR
Scheduler policy:
➢ Ideal
• Selectable
• Changeable
➢ Practical
• Built-in os
• Different versions may have different scheduling scheme
➢ Additional
• Resource manager _ deadlock manager
Control over scheduling:
➢ Interval timer
• Time quantum _ static or dynamic
➢ Policy based
• Interactive
• Batch system
• Real time application
How policies are implemented:
➢ Mechanism behind working
➢ Requirement _ factors
• Cpu utilization
• Waiting time
• Turnaround time
➢ Controls
• Fair share among jobs
• Favor given to different jobs
• priorities
Cpu scheduling algorithms:
A Process Scheduler schedules different processes to be assigned to
the CPU based on particular scheduling algorithms. There are six
popular process scheduling algorithms which we are going to discuss in
this chapter −
Scheduling variables:
• Set of processes
• Set of states
• Service time set
• Waiting time
• Turnaround time
• Batch throughput
• Time sharing time slice(if any)
How to optimize scheduling algorithm?
➢ Scheduling function vs. Decision mode
➢ Define criteria to optimize
• Scheduling criteria
➢ Use set of methods
• Restrict no. of processes
• Pre-determine service time
• Compute run-time of all schedulers and decide the best
Types of cpu scheduling algorithm:
➢First-Come, First-Served (FCFS) Scheduling
➢Shortest-Job-Next (SJN) Scheduling
➢Priority Scheduling
➢Shortest Remaining Time
➢Round Robin(RR) Scheduling
➢Multiple-Level Queues Scheduling
First come first serve(FCFS)
• Jobs are executed on first come, first serve basis.
• It is a non-preemptive, pre-emptive scheduling algorithm.
• Easy to understand and implement.
• Its implementation is based on FIFO queue.
• Poor in performance as average wait time is high.
Waiting time of each process is as follows −
Proces
s
Wait Time : Service Time - ArrivalTime
P0 0 : 0 - 0
P1 4 : 5 - 1
P2 8 - 2 = 6
P3 16 - 3 = 13
Average Wait Time: (0+4+6+13) / 4 = 5.75
Shortest job Next(SJN)
• This is also known as shortest job first, or SJF
• This is a non-preemptive, pre-emptive scheduling algorithm.
• Best approach to minimize waiting time.
• Easy to implement in Batch systems where required CPU time is known in
advance.
• Impossible to implement in interactive systems where required CPU time is
not known.
• The processer should know in advance how much time process will take.
Waiting time of each process is as follows −
Proces
s
Waiting Time
P0 0 - 0 = 0
P1 5 - 1 = 4
P2 14 - 2 = 12
P3 8 - 3 = 5
Average Wait Time: (0 + 4 + 12 + 5)/4 = 21 / 4 = 5.25
Priority Based Scheduling
• Priority scheduling is a non-preemptive algorithm and one of the
most common scheduling algorithms in batch systems.
• Each process is assigned a priority. Process with highest priority is to
be executed first and so on.
• Processes with same priority are executed on first come first served
basis.
• Priority can be decided based on memory requirements, time
requirements or any other resource requirement.
Waiting time of each process is as follows −
Process Waiting Time
P0 0 - 0 = 0
P1 11 - 1 = 10
P2 14 - 2 = 12
P3 5 - 3 = 2
Average Wait Time: (0 + 10 + 12 + 2)/4 = 24 / 4 = 6
Shortest Remaining Time:
• Shortest remaining time (SRT) is the preemptive version of the SJN
algorithm.
• The processor is allocated to the job closest to completion but it can
be preempted by a newer ready job with shorter time to completion.
• Impossible to implement in interactive systems where required CPU
time is not known.
• It is often used in batch environments where short jobs need to give
preference.
More and short term scheduler:
➢ Works in co-operation with dispatcher
➢ Frequently occurs and decides which process runs next
➢ Uses:
• Clock interrupts
• I/o interrupts
• System calls
• Traps or signals
• Any blocking event
➢ Uses some algorithm and aims at scheduling criteria
Round Robin(RR)Scheduling:
• Round Robin is the preemptive process scheduling algorithm.
• Each process is provided a fix time to execute, it is called a quantum.
• Once a process is executed for a given time period, it is preempted
and other process executes for a given time period.
• Context switching is used to save states of preempted processes.
Wait time of each process is as follows −
Process Wait Time : Service Time - ArrivalTime
P0 (0 - 0) + (12 - 3) = 9
P1 (3 - 1) = 2
P2 (6 - 2) + (14 - 9) + (20 - 17) = 12
P3 (9 - 3) + (17 - 12) = 11
Average Wait Time: (9+2+12+11) / 4 = 8.5
Multiple-Level Queues Scheduling:
Multiple-level queues are not an independent scheduling algorithm.
They make use of other existing algorithms to group and schedule
jobs with common characteristics.
• Multiple queues are maintained for processes with common
characteristics.
• Each queue can have its own scheduling algorithms.
• Priorities are assigned to each queue.
For example: CPU-bound jobs can be scheduled in
one queue and all I/O-bound jobs in another
queue. The Process Scheduler then alternately
selects jobs from each queue and assigns them to
the CPU based on the algorithm assigned to the
queue.
Short term scheduling on multi-processor
systems:
➢ Load sharing
• Global queue for processes
• Central data structure that is properly synchronized
• Even distribution among cpus
➢ Gang scheduling
• 1:1 threads selected to be executed on a particular set of cpus
➢ Dedicated processes assignment
• Assignment threads to specific processes
➢ Dynamic scheduling
• No . of threads per application are altered by scheduler
Multi-queue scheduling:
➢ Ready queue is partitioned into multiple queue
• Real time vs. Batch processes
➢ Each queue has different scheduling algo
• Set of algorithms
➢ Scheduling among queues
• Fixed priority based
• Time slice based
Multiprocessor thread scheduling:
➢ Thread run on any cpu unless specified
➢ Affinity
▪ Soft
• Scheduler tries to keep thread on the same cpu
▪ Hard
• Threads are always bound to specific cpu
Thread scheduling states:
What is dispatching:
➢Dispatcher is built – in os and works with short term scheduler
▪ Tells cpu about the newly selected process for execution
➢Various responsibilities:
▪ Determine the process at head of ready queue
▪ Preemption of current process – various reasons
▪ Context switch
• Save stateof some process
• Load stateof some process
➢Dispatchlatency
▪ Time taken by dispatcher to stop one and start another
Mcqs OF CPU Scheduling
1. Round robin scheduling falls under the category of ____________
a) Non-preemptive scheduling
b) Preemptive scheduling
c) All of the mentioned
d) None of the mentioned
2. With round robin scheduling algorithm in a time shared system ____________
a) using very large time slices converts it intoFirst come First served scheduling
algorithm
b) using very small time slices converts it intoFirst come First served scheduling
algorithm
c) using extremely small time slices increases performance
d) using very small time slices converts it intoShortest Job First algorithm
3. The portion of the process scheduler in an operatingsystem that dispatches
processes is concerned with ____________
a) assigning ready processes to CPU
b) assigning ready processes to waitingqueue
c) assigning running processes to blocked queue
d) all of the mentioned
4. Complex scheduling algorithms ____________
a) are very appropriate for very large computers
b) use minimal resources
c) use many resources
d) all of the mentioned
5. What is FIFO algorithm?
a) first executes the job that came in last in the queue
b) first executes the job that came in first in the queue
c) first executes the job that needs minimal processor
d) first executes the job that has maximum processor needs
6. The strategy of making processes that are logicallyrunnableto be temporarilysuspended is called
____________
a) Non preemptive scheduling
b) Preemptive scheduling
c) Shortest job first
d) First come First served
7. What is Scheduling?
a) allowing a job to use the processor
b) making proper use of processor
c) all of the mentioned
d) none of the mentioned
8. There are 10 different processes running on a workstation.Idle processes are waiting for an
input event in the input queue. Busy processes are scheduled with the Round-Robin timesharing
method. Which out of the following quantum times is the best value for small response times, if
the processes have a short runtime, e.g. less than 10ms?
a) tQ = 15ms
b) tQ = 40ms
c) tQ = 45ms
d) tQ = 50ms
9. Orders are processed in the sequence they arrive if _______ rule sequences the jobs.
a) earliest due date
b) slack time remaining
c) first come, first served
d) critical ratio
10. Which of the following algorithms tends to minimize the process flow time?
a) First come First served
b) Shortest Job First
c) Earliest Deadline First
d) Longest Job First
11. Under multiprogramming, turnaroundtime for short jobs is usually ________ and that for long jobs is slightly
___________
a) Lengthened; Shortened
b) Shortened; Lengthened
c) Shortened; Shortened
d) Shortened; Unchanged
1. which of the followingcan not be scheduled by the kernel?
A. process
B. user-level thread
C. kernel-level thread
D. none of the mentioned
•What is the base of CPU scheduling?​
•What is the purpose of CPU scheduling?​
•Which is the fastest CPU scheduling algorithm?​
•Why do we need scheduling?​
•What type of scheduling is FIFO?​
•What is shortest job first scheduling?​
•What are the 2 different types of scheduling queues?​
•Is FIFO and FCFS same?​
•Which is better SJF or RR?​
•What is deadlock in OS?​
Short questions:
Cpu scheduling

More Related Content

Similar to operating system (1).pdf

chapter 5 CPU scheduling.ppt
chapter  5 CPU scheduling.pptchapter  5 CPU scheduling.ppt
chapter 5 CPU scheduling.pptKeyreSebre
 
L6 CPU Scheduling.pptx
L6 CPU Scheduling.pptxL6 CPU Scheduling.pptx
L6 CPU Scheduling.pptxSeniorGaming
 
Ch05 cpu-scheduling
Ch05 cpu-schedulingCh05 cpu-scheduling
Ch05 cpu-schedulingNazir Ahmed
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithmsPaurav Shah
 
LM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processesLM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processesmanideepakc
 
OS Process Chapter 3.pdf
OS Process Chapter 3.pdfOS Process Chapter 3.pdf
OS Process Chapter 3.pdfKp Sharma
 
scheduling Uni processor Long-term .ppt
scheduling  Uni processor Long-term .pptscheduling  Uni processor Long-term .ppt
scheduling Uni processor Long-term .pptSaba651353
 
Operating system 28 fundamental of scheduling
Operating system 28 fundamental of schedulingOperating system 28 fundamental of scheduling
Operating system 28 fundamental of schedulingVaibhav Khanna
 
programming .pptx
programming .pptxprogramming .pptx
programming .pptxSHUJEHASSAN
 
UNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxUNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxansariparveen06
 
CPU Scheduling Lecture 5 - 6.pptx
CPU Scheduling Lecture 5 - 6.pptxCPU Scheduling Lecture 5 - 6.pptx
CPU Scheduling Lecture 5 - 6.pptxHarry83774
 
Scheduling algo(by HJ)
Scheduling algo(by HJ)Scheduling algo(by HJ)
Scheduling algo(by HJ)Harshit Jain
 
Operating system 30 preemptive scheduling
Operating system 30 preemptive schedulingOperating system 30 preemptive scheduling
Operating system 30 preemptive schedulingVaibhav Khanna
 

Similar to operating system (1).pdf (20)

chapter 5 CPU scheduling.ppt
chapter  5 CPU scheduling.pptchapter  5 CPU scheduling.ppt
chapter 5 CPU scheduling.ppt
 
L6 CPU Scheduling.pptx
L6 CPU Scheduling.pptxL6 CPU Scheduling.pptx
L6 CPU Scheduling.pptx
 
Ch6 cpu scheduling
Ch6   cpu schedulingCh6   cpu scheduling
Ch6 cpu scheduling
 
Ch05 cpu-scheduling
Ch05 cpu-schedulingCh05 cpu-scheduling
Ch05 cpu-scheduling
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
Section05 scheduling
Section05 schedulingSection05 scheduling
Section05 scheduling
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
LM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processesLM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processes
 
OS Process Chapter 3.pdf
OS Process Chapter 3.pdfOS Process Chapter 3.pdf
OS Process Chapter 3.pdf
 
scheduling Uni processor Long-term .ppt
scheduling  Uni processor Long-term .pptscheduling  Uni processor Long-term .ppt
scheduling Uni processor Long-term .ppt
 
Operating system
Operating systemOperating system
Operating system
 
Operating system 28 fundamental of scheduling
Operating system 28 fundamental of schedulingOperating system 28 fundamental of scheduling
Operating system 28 fundamental of scheduling
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
 
programming .pptx
programming .pptxprogramming .pptx
programming .pptx
 
UNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptxUNIPROCESS SCHEDULING.pptx
UNIPROCESS SCHEDULING.pptx
 
CPU Scheduling Part-III.pdf
CPU Scheduling Part-III.pdfCPU Scheduling Part-III.pdf
CPU Scheduling Part-III.pdf
 
CPU Scheduling Lecture 5 - 6.pptx
CPU Scheduling Lecture 5 - 6.pptxCPU Scheduling Lecture 5 - 6.pptx
CPU Scheduling Lecture 5 - 6.pptx
 
Scheduling algo(by HJ)
Scheduling algo(by HJ)Scheduling algo(by HJ)
Scheduling algo(by HJ)
 
Operating system 30 preemptive scheduling
Operating system 30 preemptive schedulingOperating system 30 preemptive scheduling
Operating system 30 preemptive scheduling
 
Scheduling
SchedulingScheduling
Scheduling
 

Recently uploaded

Call Girls in Dwarka Sub City 💯Call Us 🔝8264348440🔝
Call Girls in Dwarka Sub City 💯Call Us 🔝8264348440🔝Call Girls in Dwarka Sub City 💯Call Us 🔝8264348440🔝
Call Girls in Dwarka Sub City 💯Call Us 🔝8264348440🔝soniya singh
 
定制宾州州立大学毕业证(PSU毕业证) 成绩单留信学历认证原版一比一
定制宾州州立大学毕业证(PSU毕业证) 成绩单留信学历认证原版一比一定制宾州州立大学毕业证(PSU毕业证) 成绩单留信学历认证原版一比一
定制宾州州立大学毕业证(PSU毕业证) 成绩单留信学历认证原版一比一ga6c6bdl
 
VIP Call Girls Hitech City ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With R...
VIP Call Girls Hitech City ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With R...VIP Call Girls Hitech City ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With R...
VIP Call Girls Hitech City ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With R...Suhani Kapoor
 
(SANA) Call Girls Landewadi ( 7001035870 ) HI-Fi Pune Escorts Service
(SANA) Call Girls Landewadi ( 7001035870 ) HI-Fi Pune Escorts Service(SANA) Call Girls Landewadi ( 7001035870 ) HI-Fi Pune Escorts Service
(SANA) Call Girls Landewadi ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
(办理学位证)多伦多大学毕业证成绩单原版一比一
(办理学位证)多伦多大学毕业证成绩单原版一比一(办理学位证)多伦多大学毕业证成绩单原版一比一
(办理学位证)多伦多大学毕业证成绩单原版一比一C SSS
 
(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Russian Call Girls Kolkata Chhaya 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls Kolkata Chhaya 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls Kolkata Chhaya 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls Kolkata Chhaya 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
《伯明翰城市大学毕业证成绩单购买》学历证书学位证书区别《复刻原版1:1伯明翰城市大学毕业证书|修改BCU成绩单PDF版》Q微信741003700《BCU学...
《伯明翰城市大学毕业证成绩单购买》学历证书学位证书区别《复刻原版1:1伯明翰城市大学毕业证书|修改BCU成绩单PDF版》Q微信741003700《BCU学...《伯明翰城市大学毕业证成绩单购买》学历证书学位证书区别《复刻原版1:1伯明翰城市大学毕业证书|修改BCU成绩单PDF版》Q微信741003700《BCU学...
《伯明翰城市大学毕业证成绩单购买》学历证书学位证书区别《复刻原版1:1伯明翰城市大学毕业证书|修改BCU成绩单PDF版》Q微信741003700《BCU学...ur8mqw8e
 
Beautiful Sapna Call Girls CP 9711199012 ☎ Call /Whatsapps
Beautiful Sapna Call Girls CP 9711199012 ☎ Call /WhatsappsBeautiful Sapna Call Girls CP 9711199012 ☎ Call /Whatsapps
Beautiful Sapna Call Girls CP 9711199012 ☎ Call /Whatsappssapnasaifi408
 
如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一
如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一
如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一ga6c6bdl
 
Papular No 1 Online Istikhara Amil Baba Pakistan Amil Baba In Karachi Amil B...
Papular No 1 Online Istikhara Amil Baba Pakistan  Amil Baba In Karachi Amil B...Papular No 1 Online Istikhara Amil Baba Pakistan  Amil Baba In Karachi Amil B...
Papular No 1 Online Istikhara Amil Baba Pakistan Amil Baba In Karachi Amil B...Authentic No 1 Amil Baba In Pakistan
 
定制(USF学位证)旧金山大学毕业证成绩单原版一比一
定制(USF学位证)旧金山大学毕业证成绩单原版一比一定制(USF学位证)旧金山大学毕业证成绩单原版一比一
定制(USF学位证)旧金山大学毕业证成绩单原版一比一ss ss
 
如何办理(Adelaide毕业证)阿德莱德大学毕业证成绩单Adelaide学历认证真实可查
如何办理(Adelaide毕业证)阿德莱德大学毕业证成绩单Adelaide学历认证真实可查如何办理(Adelaide毕业证)阿德莱德大学毕业证成绩单Adelaide学历认证真实可查
如何办理(Adelaide毕业证)阿德莱德大学毕业证成绩单Adelaide学历认证真实可查awo24iot
 
Slim Call Girls Service Badshah Nagar * 9548273370 Naughty Call Girls Service...
Slim Call Girls Service Badshah Nagar * 9548273370 Naughty Call Girls Service...Slim Call Girls Service Badshah Nagar * 9548273370 Naughty Call Girls Service...
Slim Call Girls Service Badshah Nagar * 9548273370 Naughty Call Girls Service...nagunakhan
 
如何办理萨省大学毕业证(UofS毕业证)成绩单留信学历认证原版一比一
如何办理萨省大学毕业证(UofS毕业证)成绩单留信学历认证原版一比一如何办理萨省大学毕业证(UofS毕业证)成绩单留信学历认证原版一比一
如何办理萨省大学毕业证(UofS毕业证)成绩单留信学历认证原版一比一ga6c6bdl
 
Call Girls Service Kolkata Aishwarya 🤌 8250192130 🚀 Vip Call Girls Kolkata
Call Girls Service Kolkata Aishwarya 🤌  8250192130 🚀 Vip Call Girls KolkataCall Girls Service Kolkata Aishwarya 🤌  8250192130 🚀 Vip Call Girls Kolkata
Call Girls Service Kolkata Aishwarya 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单留信学历认证原版一比一
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单留信学历认证原版一比一如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单留信学历认证原版一比一
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单留信学历认证原版一比一ga6c6bdl
 
Call Girls Delhi {Rs-10000 Laxmi Nagar] 9711199012 Whats Up Number
Call Girls Delhi {Rs-10000 Laxmi Nagar] 9711199012 Whats Up NumberCall Girls Delhi {Rs-10000 Laxmi Nagar] 9711199012 Whats Up Number
Call Girls Delhi {Rs-10000 Laxmi Nagar] 9711199012 Whats Up NumberMs Riya
 
定制(UI学位证)爱达荷大学毕业证成绩单原版一比一
定制(UI学位证)爱达荷大学毕业证成绩单原版一比一定制(UI学位证)爱达荷大学毕业证成绩单原版一比一
定制(UI学位证)爱达荷大学毕业证成绩单原版一比一ss ss
 

Recently uploaded (20)

Call Girls in Dwarka Sub City 💯Call Us 🔝8264348440🔝
Call Girls in Dwarka Sub City 💯Call Us 🔝8264348440🔝Call Girls in Dwarka Sub City 💯Call Us 🔝8264348440🔝
Call Girls in Dwarka Sub City 💯Call Us 🔝8264348440🔝
 
定制宾州州立大学毕业证(PSU毕业证) 成绩单留信学历认证原版一比一
定制宾州州立大学毕业证(PSU毕业证) 成绩单留信学历认证原版一比一定制宾州州立大学毕业证(PSU毕业证) 成绩单留信学历认证原版一比一
定制宾州州立大学毕业证(PSU毕业证) 成绩单留信学历认证原版一比一
 
VIP Call Girls Hitech City ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With R...
VIP Call Girls Hitech City ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With R...VIP Call Girls Hitech City ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With R...
VIP Call Girls Hitech City ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With R...
 
(SANA) Call Girls Landewadi ( 7001035870 ) HI-Fi Pune Escorts Service
(SANA) Call Girls Landewadi ( 7001035870 ) HI-Fi Pune Escorts Service(SANA) Call Girls Landewadi ( 7001035870 ) HI-Fi Pune Escorts Service
(SANA) Call Girls Landewadi ( 7001035870 ) HI-Fi Pune Escorts Service
 
(办理学位证)多伦多大学毕业证成绩单原版一比一
(办理学位证)多伦多大学毕业证成绩单原版一比一(办理学位证)多伦多大学毕业证成绩单原版一比一
(办理学位证)多伦多大学毕业证成绩单原版一比一
 
(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(PARI) Alandi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Russian Call Girls Kolkata Chhaya 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls Kolkata Chhaya 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls Kolkata Chhaya 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls Kolkata Chhaya 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
《伯明翰城市大学毕业证成绩单购买》学历证书学位证书区别《复刻原版1:1伯明翰城市大学毕业证书|修改BCU成绩单PDF版》Q微信741003700《BCU学...
《伯明翰城市大学毕业证成绩单购买》学历证书学位证书区别《复刻原版1:1伯明翰城市大学毕业证书|修改BCU成绩单PDF版》Q微信741003700《BCU学...《伯明翰城市大学毕业证成绩单购买》学历证书学位证书区别《复刻原版1:1伯明翰城市大学毕业证书|修改BCU成绩单PDF版》Q微信741003700《BCU学...
《伯明翰城市大学毕业证成绩单购买》学历证书学位证书区别《复刻原版1:1伯明翰城市大学毕业证书|修改BCU成绩单PDF版》Q微信741003700《BCU学...
 
Beautiful Sapna Call Girls CP 9711199012 ☎ Call /Whatsapps
Beautiful Sapna Call Girls CP 9711199012 ☎ Call /WhatsappsBeautiful Sapna Call Girls CP 9711199012 ☎ Call /Whatsapps
Beautiful Sapna Call Girls CP 9711199012 ☎ Call /Whatsapps
 
9953330565 Low Rate Call Girls In Jahangirpuri Delhi NCR
9953330565 Low Rate Call Girls In Jahangirpuri  Delhi NCR9953330565 Low Rate Call Girls In Jahangirpuri  Delhi NCR
9953330565 Low Rate Call Girls In Jahangirpuri Delhi NCR
 
如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一
如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一
如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一
 
Papular No 1 Online Istikhara Amil Baba Pakistan Amil Baba In Karachi Amil B...
Papular No 1 Online Istikhara Amil Baba Pakistan  Amil Baba In Karachi Amil B...Papular No 1 Online Istikhara Amil Baba Pakistan  Amil Baba In Karachi Amil B...
Papular No 1 Online Istikhara Amil Baba Pakistan Amil Baba In Karachi Amil B...
 
定制(USF学位证)旧金山大学毕业证成绩单原版一比一
定制(USF学位证)旧金山大学毕业证成绩单原版一比一定制(USF学位证)旧金山大学毕业证成绩单原版一比一
定制(USF学位证)旧金山大学毕业证成绩单原版一比一
 
如何办理(Adelaide毕业证)阿德莱德大学毕业证成绩单Adelaide学历认证真实可查
如何办理(Adelaide毕业证)阿德莱德大学毕业证成绩单Adelaide学历认证真实可查如何办理(Adelaide毕业证)阿德莱德大学毕业证成绩单Adelaide学历认证真实可查
如何办理(Adelaide毕业证)阿德莱德大学毕业证成绩单Adelaide学历认证真实可查
 
Slim Call Girls Service Badshah Nagar * 9548273370 Naughty Call Girls Service...
Slim Call Girls Service Badshah Nagar * 9548273370 Naughty Call Girls Service...Slim Call Girls Service Badshah Nagar * 9548273370 Naughty Call Girls Service...
Slim Call Girls Service Badshah Nagar * 9548273370 Naughty Call Girls Service...
 
如何办理萨省大学毕业证(UofS毕业证)成绩单留信学历认证原版一比一
如何办理萨省大学毕业证(UofS毕业证)成绩单留信学历认证原版一比一如何办理萨省大学毕业证(UofS毕业证)成绩单留信学历认证原版一比一
如何办理萨省大学毕业证(UofS毕业证)成绩单留信学历认证原版一比一
 
Call Girls Service Kolkata Aishwarya 🤌 8250192130 🚀 Vip Call Girls Kolkata
Call Girls Service Kolkata Aishwarya 🤌  8250192130 🚀 Vip Call Girls KolkataCall Girls Service Kolkata Aishwarya 🤌  8250192130 🚀 Vip Call Girls Kolkata
Call Girls Service Kolkata Aishwarya 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单留信学历认证原版一比一
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单留信学历认证原版一比一如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单留信学历认证原版一比一
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单留信学历认证原版一比一
 
Call Girls Delhi {Rs-10000 Laxmi Nagar] 9711199012 Whats Up Number
Call Girls Delhi {Rs-10000 Laxmi Nagar] 9711199012 Whats Up NumberCall Girls Delhi {Rs-10000 Laxmi Nagar] 9711199012 Whats Up Number
Call Girls Delhi {Rs-10000 Laxmi Nagar] 9711199012 Whats Up Number
 
定制(UI学位证)爱达荷大学毕业证成绩单原版一比一
定制(UI学位证)爱达荷大学毕业证成绩单原版一比一定制(UI学位证)爱达荷大学毕业证成绩单原版一比一
定制(UI学位证)爱达荷大学毕业证成绩单原版一比一
 

operating system (1).pdf

  • 2. Cpu scheduling objectives: ❖ Introduce CPU scheduling, which is the basis for multiprogrammed operating systems. ❖ Describe various cpu-scheduling algorithms. ❖ Discuss evaluation criteria for selecting a cpu-scheduling algorithm for a particular system.
  • 3. Introduction ❖ CPU scheduling is the task performed by CPU that decidesthe way processedwould be executed.CPU resources are allocated to a process for only a limited period of time and then those resources are taken back. A running process could be interrupted to execute a higher priority process. ❖ CPU scheduling is a process which allows one process to use the CPU while the execution of another process is on hold(in waiting state) due to unavailability of any resource like I/O etc, thereby making full use of CPU. The aim of CPU scheduling is to make the systemefficient, fast and fair.
  • 4. Cpu scheduling basis for multiprogrammed operating system: CPU scheduling is the basis of multiprogrammed operating systems. By switching the CPU among processes, the operating system can make the computer more productive. In this chapter, we introduce basic CPU-scheduling concepts and present several CPU-scheduling algorithms.
  • 5. 2 Types of cpu scheduling: • Preemptive • Non preemptive
  • 6. Preemptive scheduling: Preemptive scheduling is when a processtransitions from a running state to a ready state or from a waiting state to a ready state. Most common and complex. Example: • when a higher priority task wants the CPU. • SRTF • Priority(preemptive) • RR
  • 7. Scheduling overhead: • Additional operations that take small amount of time • RR • SRTF • Priority (preemptive) • Multi-level feedback • Hybrid scheduling scheme
  • 8. Algorithms based on preemptive scheduling are: RoundRobin (RR),Shortest RemainingTime First (SRTF), Priority (preemptive version), etc.
  • 9. Non preemptive scheduling: Non-preemptive Scheduling is used when a process terminates,or a process switches from running to the waiting state.In this scheduling, once the resources (CPU cycles) are allocated to a process. In the case of non- preemptive scheduling does not interrupt a process running CPU in the middle of the execution. Instead, it waits till the process completes its CPU burst time, and then it can allocate the CPU to another process. Example: Non-preemptive Scheduling is rigid. ShortestRemaining Time First, Round Robin, First Come First Serve, Shortest Job First(non-preemptive), Priority Scheduling, etc.
  • 10. Algorithms based on non-preemptive scheduling are: Shortest Job First (SJF basicallynon preemptive) and Priority (non preemptive version), etc.
  • 11. How is scheduler invoked: ➢ Voluntarily • Process block due to I/o • Calls scheduler • E.g. FCFS, SJF ➢ Involuntarily • Preemption done by algorithm or timer • Kernal calls scheduler to take necessary action • E.g. SRTF ,RR
  • 12. Scheduler policy: ➢ Ideal • Selectable • Changeable ➢ Practical • Built-in os • Different versions may have different scheduling scheme ➢ Additional • Resource manager _ deadlock manager
  • 13. Control over scheduling: ➢ Interval timer • Time quantum _ static or dynamic ➢ Policy based • Interactive • Batch system • Real time application
  • 14. How policies are implemented: ➢ Mechanism behind working ➢ Requirement _ factors • Cpu utilization • Waiting time • Turnaround time ➢ Controls • Fair share among jobs • Favor given to different jobs • priorities
  • 15. Cpu scheduling algorithms: A Process Scheduler schedules different processes to be assigned to the CPU based on particular scheduling algorithms. There are six popular process scheduling algorithms which we are going to discuss in this chapter −
  • 16. Scheduling variables: • Set of processes • Set of states • Service time set • Waiting time • Turnaround time • Batch throughput • Time sharing time slice(if any)
  • 17. How to optimize scheduling algorithm? ➢ Scheduling function vs. Decision mode ➢ Define criteria to optimize • Scheduling criteria ➢ Use set of methods • Restrict no. of processes • Pre-determine service time • Compute run-time of all schedulers and decide the best
  • 18. Types of cpu scheduling algorithm: ➢First-Come, First-Served (FCFS) Scheduling ➢Shortest-Job-Next (SJN) Scheduling ➢Priority Scheduling ➢Shortest Remaining Time ➢Round Robin(RR) Scheduling ➢Multiple-Level Queues Scheduling
  • 19. First come first serve(FCFS) • Jobs are executed on first come, first serve basis. • It is a non-preemptive, pre-emptive scheduling algorithm. • Easy to understand and implement. • Its implementation is based on FIFO queue. • Poor in performance as average wait time is high.
  • 20.
  • 21. Waiting time of each process is as follows −
  • 22. Proces s Wait Time : Service Time - ArrivalTime P0 0 : 0 - 0 P1 4 : 5 - 1 P2 8 - 2 = 6 P3 16 - 3 = 13 Average Wait Time: (0+4+6+13) / 4 = 5.75
  • 23. Shortest job Next(SJN) • This is also known as shortest job first, or SJF • This is a non-preemptive, pre-emptive scheduling algorithm. • Best approach to minimize waiting time. • Easy to implement in Batch systems where required CPU time is known in advance. • Impossible to implement in interactive systems where required CPU time is not known. • The processer should know in advance how much time process will take.
  • 24.
  • 25. Waiting time of each process is as follows −
  • 26. Proces s Waiting Time P0 0 - 0 = 0 P1 5 - 1 = 4 P2 14 - 2 = 12 P3 8 - 3 = 5 Average Wait Time: (0 + 4 + 12 + 5)/4 = 21 / 4 = 5.25
  • 27. Priority Based Scheduling • Priority scheduling is a non-preemptive algorithm and one of the most common scheduling algorithms in batch systems. • Each process is assigned a priority. Process with highest priority is to be executed first and so on. • Processes with same priority are executed on first come first served basis. • Priority can be decided based on memory requirements, time requirements or any other resource requirement.
  • 28.
  • 29. Waiting time of each process is as follows −
  • 30. Process Waiting Time P0 0 - 0 = 0 P1 11 - 1 = 10 P2 14 - 2 = 12 P3 5 - 3 = 2 Average Wait Time: (0 + 10 + 12 + 2)/4 = 24 / 4 = 6
  • 31. Shortest Remaining Time: • Shortest remaining time (SRT) is the preemptive version of the SJN algorithm. • The processor is allocated to the job closest to completion but it can be preempted by a newer ready job with shorter time to completion. • Impossible to implement in interactive systems where required CPU time is not known. • It is often used in batch environments where short jobs need to give preference.
  • 32.
  • 33. More and short term scheduler: ➢ Works in co-operation with dispatcher ➢ Frequently occurs and decides which process runs next ➢ Uses: • Clock interrupts • I/o interrupts • System calls • Traps or signals • Any blocking event ➢ Uses some algorithm and aims at scheduling criteria
  • 34. Round Robin(RR)Scheduling: • Round Robin is the preemptive process scheduling algorithm. • Each process is provided a fix time to execute, it is called a quantum. • Once a process is executed for a given time period, it is preempted and other process executes for a given time period. • Context switching is used to save states of preempted processes.
  • 35.
  • 36. Wait time of each process is as follows −
  • 37. Process Wait Time : Service Time - ArrivalTime P0 (0 - 0) + (12 - 3) = 9 P1 (3 - 1) = 2 P2 (6 - 2) + (14 - 9) + (20 - 17) = 12 P3 (9 - 3) + (17 - 12) = 11 Average Wait Time: (9+2+12+11) / 4 = 8.5
  • 38. Multiple-Level Queues Scheduling: Multiple-level queues are not an independent scheduling algorithm. They make use of other existing algorithms to group and schedule jobs with common characteristics. • Multiple queues are maintained for processes with common characteristics. • Each queue can have its own scheduling algorithms. • Priorities are assigned to each queue.
  • 39. For example: CPU-bound jobs can be scheduled in one queue and all I/O-bound jobs in another queue. The Process Scheduler then alternately selects jobs from each queue and assigns them to the CPU based on the algorithm assigned to the queue.
  • 40.
  • 41. Short term scheduling on multi-processor systems: ➢ Load sharing • Global queue for processes • Central data structure that is properly synchronized • Even distribution among cpus ➢ Gang scheduling • 1:1 threads selected to be executed on a particular set of cpus ➢ Dedicated processes assignment • Assignment threads to specific processes ➢ Dynamic scheduling • No . of threads per application are altered by scheduler
  • 42. Multi-queue scheduling: ➢ Ready queue is partitioned into multiple queue • Real time vs. Batch processes ➢ Each queue has different scheduling algo • Set of algorithms ➢ Scheduling among queues • Fixed priority based • Time slice based
  • 43. Multiprocessor thread scheduling: ➢ Thread run on any cpu unless specified ➢ Affinity ▪ Soft • Scheduler tries to keep thread on the same cpu ▪ Hard • Threads are always bound to specific cpu
  • 45. What is dispatching: ➢Dispatcher is built – in os and works with short term scheduler ▪ Tells cpu about the newly selected process for execution ➢Various responsibilities: ▪ Determine the process at head of ready queue ▪ Preemption of current process – various reasons ▪ Context switch • Save stateof some process • Load stateof some process ➢Dispatchlatency ▪ Time taken by dispatcher to stop one and start another
  • 46.
  • 47. Mcqs OF CPU Scheduling
  • 48. 1. Round robin scheduling falls under the category of ____________ a) Non-preemptive scheduling b) Preemptive scheduling c) All of the mentioned d) None of the mentioned 2. With round robin scheduling algorithm in a time shared system ____________ a) using very large time slices converts it intoFirst come First served scheduling algorithm b) using very small time slices converts it intoFirst come First served scheduling algorithm c) using extremely small time slices increases performance d) using very small time slices converts it intoShortest Job First algorithm 3. The portion of the process scheduler in an operatingsystem that dispatches processes is concerned with ____________ a) assigning ready processes to CPU b) assigning ready processes to waitingqueue c) assigning running processes to blocked queue d) all of the mentioned
  • 49. 4. Complex scheduling algorithms ____________ a) are very appropriate for very large computers b) use minimal resources c) use many resources d) all of the mentioned 5. What is FIFO algorithm? a) first executes the job that came in last in the queue b) first executes the job that came in first in the queue c) first executes the job that needs minimal processor d) first executes the job that has maximum processor needs 6. The strategy of making processes that are logicallyrunnableto be temporarilysuspended is called ____________ a) Non preemptive scheduling b) Preemptive scheduling c) Shortest job first d) First come First served
  • 50. 7. What is Scheduling? a) allowing a job to use the processor b) making proper use of processor c) all of the mentioned d) none of the mentioned 8. There are 10 different processes running on a workstation.Idle processes are waiting for an input event in the input queue. Busy processes are scheduled with the Round-Robin timesharing method. Which out of the following quantum times is the best value for small response times, if the processes have a short runtime, e.g. less than 10ms? a) tQ = 15ms b) tQ = 40ms c) tQ = 45ms d) tQ = 50ms 9. Orders are processed in the sequence they arrive if _______ rule sequences the jobs. a) earliest due date b) slack time remaining c) first come, first served d) critical ratio
  • 51. 10. Which of the following algorithms tends to minimize the process flow time? a) First come First served b) Shortest Job First c) Earliest Deadline First d) Longest Job First 11. Under multiprogramming, turnaroundtime for short jobs is usually ________ and that for long jobs is slightly ___________ a) Lengthened; Shortened b) Shortened; Lengthened c) Shortened; Shortened d) Shortened; Unchanged 1. which of the followingcan not be scheduled by the kernel? A. process B. user-level thread C. kernel-level thread D. none of the mentioned
  • 52. •What is the base of CPU scheduling?​ •What is the purpose of CPU scheduling?​ •Which is the fastest CPU scheduling algorithm?​ •Why do we need scheduling?​ •What type of scheduling is FIFO?​ •What is shortest job first scheduling?​ •What are the 2 different types of scheduling queues?​ •Is FIFO and FCFS same?​ •Which is better SJF or RR?​ •What is deadlock in OS?​ Short questions: Cpu scheduling