SlideShare a Scribd company logo
1 of 7
Course: Operating system
Answers of Chapter(5)
5.13 Consider the following set of processes, with the length of the CPU-burst
time given in milliseconds:
PriorityBurst TimeProcess
310P1
11P2
32P3
41P4
25P5
The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at
time 0.
a. Draw four Gantt charts illustrating the execution of these processes using
FCFS, SJF, a non-preemptive priority (a smaller priority number implies a
higher priority), and RR (quantum = 1) scheduling.
b. What is the turnaround time of each process for each of the scheduling
algorithms in part a?
c. What is the waiting time of each process for each of the scheduling algorithms
in part a?
d. Which of the schedules in part a results in the minimal average waiting time
(over all processes)?
Answer:
a) Gantt charts:
FCFS:
P1 P2 P3 P4 P5
SJF
P2 P4 P3 P5 P1
Non-preemptive priority
P2 P5 P1 P3 P4
..... ))‫ل‬ ‫أخيتي‬‫تنسينا‬‫من‬‫صالح‬((‫دعائك‬
1
0 10 11 13 14 19
0 1 2 4 9 19
0 1 6 16 18 19
Course: Operating system
RR (quantum = 1)
P1 P2 P3 P4 P5 P1 P3 P5 P1 P5 P1 P5 P1 P5 P1
b) Turnaround time = finish time- arrival time
OR: Turnaround time = CPU burst time+ wait time
By using the first law (Turnaround time = finish time- arrival time) and getting finish time
from Gantt chart:
Turnaround time
FCFS RR SJF Priority
P1 10-0=10 19-0=19 19-0=19 16-0=16
P2 11 2 1 1
P3 13 7 4 18
P4 14 4 2 19
P5 19 14 9 6
c) Waiting time = Turnaround time - CPU burst time
Waiting time
FCFS RR SJF Priority
P1 10-10=0 19-10=9 19-10=9 16-10=6
P2 10 1 0 0
P3 11 5 2 16
P4 13 3 1 18
P5 14 9 4 1
Average waiting time 9.6 5.4 3.2 8.2
d) The minimal average waiting time is found in SJF algorithm
* * * *
5.17 Suppose that the following processes arrive for execution at the times
indicated. Each process will run the listed amount of time. In answering the
questions, use non-preemptive scheduling and base all decisions on the
information you have at the time the decision must be made.
Burst TimeArrival TimeProcess
80.0P1
40.4P2
11.0P3
..... ))‫ل‬ ‫أخيتي‬‫تنسينا‬‫من‬‫صالح‬((‫دعائك‬
2
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 19
Course: Operating system
(a) What is the average turnaround time for these processes with the FCFS
scheduling algorithm?
(b) What is the average turnaround time for these processes with the SJF
scheduling algorithm?
(c) The SJF algorithm is supposed to improve performance, but notice that we
chose to run process P1 at time 0 because we did not know that two shorter
processes would arrive soon. Compute what the average turnaround time will be
if the CPU is left idle for the first 1 unit and then SJF scheduling is used.
Remember that processes P1 and P2 are waiting during this idle time, so their
waiting time may increase. This algorithm could be known as future-knowledge
scheduling.
Answer:
a) Average turnaround time with FCFS :
We need to draw the Gantt chart to find the finish time then calculate the turnaround time
(Turnaround time = finish time- arrival time)
P1 P2 P3
turnaround time
P1 8-0=8
P2 12-0.4=11.6
P3 13-1=12
Average turnaround
time
10.53
b)Average turnaround time with SJF :
We need to draw the Gantt chart to find the finish time then calculate the turnaround time
(Turnaround time = finish time- arrival time)
P1 P3 P2
turnaround time
P1 8-0=8
P2 13-0.4=12.6
P3 9-1=8
Average turnaround
time
9.53
..... ))‫ل‬ ‫أخيتي‬‫تنسينا‬‫من‬‫صالح‬((‫دعائك‬
3
0 8 12 13
0 8 9 13
Course: Operating system
c) Average turnaround time with future-knowledge scheduling.
We need to draw the Gantt chart to find the finish time then calculate the turnaround time
(Turnaround time = finish time- arrival time)
P3 P2 P1
turnaround time
P1 14-0=14
P2 6-0.4=5.6
P3 2-1=1
Average turnaround
time
6.87
* * * *
5.9 Which of the following scheduling algorithms could result in starvation?
a. First-come, first-served
b. Shortest job first
c. Round robin
d. Priority
Answer:
In FCFS algorithm, all jobs is executed in sequence & no job will wait for infinity to be executed
 So, No starvation
SJF could make some long jobs wait for infinity to be executed if shorter jobs continuously arrive
to the ready queue  So, SJF could result in starvation.
RR treats all jobs equally and no job will wait for infinity to be executed  So, No starvation
Priority algorithm could make some low-priority jobs wait for infinity to be executed if higher-
priority jobs continuously arrive to the ready queue  So, Priority algorithm could result in
starvation.
Finally, Shortest job first (SJF) and priority-based scheduling algorithms could result in
starvation.
* * * *
5.7 Explain the differences in the degree to which the following scheduling
algorithms discriminate in favor of short processes:
a. FCFS
b. RR
c. Multilevel feedback queues
Answer:
a. FCFS—discriminates against short jobs since any short jobs arriving after long jobs will have a
longer waiting time.
b. RR—treats all jobs equally (giving them equal bursts of CPU time) so short jobs will be able to
leave the system faster since they will finish first.
..... ))‫ل‬ ‫أخيتي‬‫تنسينا‬‫من‬‫صالح‬((‫دعائك‬
4
0 1 2 6 14
Course: Operating system
c. Multilevel feedback queues work similar to the RR algorithm— they discriminate favorably
toward short jobs.
* * * *
5.8 Consider the exponential average formula used to predict the length of the
next CPU burst. What are the implications of assigning the following values to
the parameters used by the algorithm?
a. α= 0 and τ0 = 100milliseconds
b. α= 0.99 and τ0 = 10milliseconds
Answer:
a) Τn+1= α * tn + (1- α) * τn
When α = 0 andτ0 = 100 milliseconds, the equation will be:
Τn+1= 0* tn + (1- 0) * 100 = 100 milliseconds
So, in this case the formula always makes a prediction of (100 milliseconds) for
the next CPU burst.
b) Τn+1= α * tn + (1- α) * τn
. When α = 0.99 and τ0 = 10 milliseconds, the equation will be:
Τn+1= 0.99* tn + (1- 0.99) * 10 = [ 0.99 tn + 0.1] milliseconds
So, in this case the most recent behavior (tn ) of the process is given much higher
weight (99% with comparison to 1%) than the past history associated with the
process (τn=10).
* * * *
5.4 What advantage is there in having different time-quantum sizes at different
levels of a multilevel queuing system?
Answer:
Processes that need more frequent servicing, for example, interactive processes such
as editors, can be in a queue with a small time quantum (because it has high
input/output interrupts).
Processes with no need for frequent servicing (e.g. batch process) can be in a queue
with a larger quantum, requiring fewer context switches to complete the processing
(because it has very low input/output interrupts).
So, the multilevel queuing algorithm makes more efficient use of the computer.
* * * *
Good Luck
..... ))‫ل‬ ‫أخيتي‬‫تنسينا‬‫من‬‫صالح‬((‫دعائك‬
5
Course: Operating system
Reem Al_Salih
..... ))‫ل‬ ‫أخيتي‬‫تنسينا‬‫من‬‫صالح‬((‫دعائك‬
6
Course: Operating system
Reem Al_Salih
..... ))‫ل‬ ‫أخيتي‬‫تنسينا‬‫من‬‫صالح‬((‫دعائك‬
6

More Related Content

What's hot

Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Ravindra Raju Kolahalam
 
Deadlock Avoidance - OS
Deadlock Avoidance - OSDeadlock Avoidance - OS
Deadlock Avoidance - OSMsAnita2
 
Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Mukesh Chinta
 
Operating system 25 classical problems of synchronization
Operating system 25 classical problems of synchronizationOperating system 25 classical problems of synchronization
Operating system 25 classical problems of synchronizationVaibhav Khanna
 
Multilevel queue scheduling
Multilevel queue schedulingMultilevel queue scheduling
Multilevel queue schedulingAditiPawaskar5
 
Lecture 26 local beam search
Lecture 26 local beam searchLecture 26 local beam search
Lecture 26 local beam searchHema Kashyap
 
Real-Time Scheduling
Real-Time SchedulingReal-Time Scheduling
Real-Time Schedulingsathish sak
 
Structure of shared memory space
Structure of shared memory spaceStructure of shared memory space
Structure of shared memory spaceCoder Tech
 
Operating Systems: Process Scheduling
Operating Systems: Process SchedulingOperating Systems: Process Scheduling
Operating Systems: Process SchedulingDamian T. Gordon
 
Operating system 11 system calls
Operating system 11 system callsOperating system 11 system calls
Operating system 11 system callsVaibhav Khanna
 
ContikiMAC : Radio Duty Cycling Protocol
ContikiMAC : Radio Duty Cycling ProtocolContikiMAC : Radio Duty Cycling Protocol
ContikiMAC : Radio Duty Cycling ProtocolSalah Amean
 
Virtual memory ppt
Virtual memory pptVirtual memory ppt
Virtual memory pptRITULDE
 
Round Robin Algorithm.pptx
Round Robin Algorithm.pptxRound Robin Algorithm.pptx
Round Robin Algorithm.pptxSanad Bhowmik
 
Operating Systems Process Scheduling Algorithms
Operating Systems   Process Scheduling AlgorithmsOperating Systems   Process Scheduling Algorithms
Operating Systems Process Scheduling Algorithmssathish sak
 

What's hot (20)

5 Process Scheduling
5 Process Scheduling5 Process Scheduling
5 Process Scheduling
 
Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]
 
Distributed Operating System_1
Distributed Operating System_1Distributed Operating System_1
Distributed Operating System_1
 
Deadlock Avoidance - OS
Deadlock Avoidance - OSDeadlock Avoidance - OS
Deadlock Avoidance - OS
 
Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)
 
Deadlock
DeadlockDeadlock
Deadlock
 
Operating system 25 classical problems of synchronization
Operating system 25 classical problems of synchronizationOperating system 25 classical problems of synchronization
Operating system 25 classical problems of synchronization
 
Process state in OS
Process state in OSProcess state in OS
Process state in OS
 
Multilevel queue scheduling
Multilevel queue schedulingMultilevel queue scheduling
Multilevel queue scheduling
 
Lecture 26 local beam search
Lecture 26 local beam searchLecture 26 local beam search
Lecture 26 local beam search
 
Real-Time Scheduling
Real-Time SchedulingReal-Time Scheduling
Real-Time Scheduling
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
 
Structure of shared memory space
Structure of shared memory spaceStructure of shared memory space
Structure of shared memory space
 
Operating Systems: Process Scheduling
Operating Systems: Process SchedulingOperating Systems: Process Scheduling
Operating Systems: Process Scheduling
 
Operating system 11 system calls
Operating system 11 system callsOperating system 11 system calls
Operating system 11 system calls
 
ContikiMAC : Radio Duty Cycling Protocol
ContikiMAC : Radio Duty Cycling ProtocolContikiMAC : Radio Duty Cycling Protocol
ContikiMAC : Radio Duty Cycling Protocol
 
Virtual memory ppt
Virtual memory pptVirtual memory ppt
Virtual memory ppt
 
OS - Deadlock
OS - DeadlockOS - Deadlock
OS - Deadlock
 
Round Robin Algorithm.pptx
Round Robin Algorithm.pptxRound Robin Algorithm.pptx
Round Robin Algorithm.pptx
 
Operating Systems Process Scheduling Algorithms
Operating Systems   Process Scheduling AlgorithmsOperating Systems   Process Scheduling Algorithms
Operating Systems Process Scheduling Algorithms
 

Similar to Ch5 answers

Scheduling algorithm (chammu)
Scheduling algorithm (chammu)Scheduling algorithm (chammu)
Scheduling algorithm (chammu)Nagarajan
 
Operating System 5
Operating System 5Operating System 5
Operating System 5tech2click
 
cpu sechduling
cpu sechduling cpu sechduling
cpu sechduling gopi7
 
Csc4320 chapter 5 2
Csc4320 chapter 5 2Csc4320 chapter 5 2
Csc4320 chapter 5 2pri534
 
Ch6
Ch6Ch6
Ch6C.U
 
Operating Systems Third Unit - Fourth Semester - Engineering
Operating Systems Third Unit  - Fourth Semester - EngineeringOperating Systems Third Unit  - Fourth Semester - Engineering
Operating Systems Third Unit - Fourth Semester - EngineeringYogesh Santhan
 
Process management in os
Process management in osProcess management in os
Process management in osMiong Lazaro
 
RR and priority scheduling
RR and priority schedulingRR and priority scheduling
RR and priority schedulingA. S. M. Shafi
 
Cpu scheduling qusetions
Cpu scheduling qusetionsCpu scheduling qusetions
Cpu scheduling qusetionsJasonMarandi1
 
Preemptive process example.pptx
Preemptive process example.pptxPreemptive process example.pptx
Preemptive process example.pptxjamilaltiti1
 
Process Scheduling Algorithms.pdf
Process Scheduling Algorithms.pdfProcess Scheduling Algorithms.pdf
Process Scheduling Algorithms.pdfRakibul Rakib
 
OS Process Chapter 3.pdf
OS Process Chapter 3.pdfOS Process Chapter 3.pdf
OS Process Chapter 3.pdfKp Sharma
 

Similar to Ch5 answers (20)

Scheduling algorithm (chammu)
Scheduling algorithm (chammu)Scheduling algorithm (chammu)
Scheduling algorithm (chammu)
 
OSCh6
OSCh6OSCh6
OSCh6
 
OS_Ch6
OS_Ch6OS_Ch6
OS_Ch6
 
Ch5
Ch5Ch5
Ch5
 
Operating System 5
Operating System 5Operating System 5
Operating System 5
 
Ch05
Ch05Ch05
Ch05
 
cpu sechduling
cpu sechduling cpu sechduling
cpu sechduling
 
Os..
Os..Os..
Os..
 
Csc4320 chapter 5 2
Csc4320 chapter 5 2Csc4320 chapter 5 2
Csc4320 chapter 5 2
 
Ch6
Ch6Ch6
Ch6
 
Operating Systems Third Unit - Fourth Semester - Engineering
Operating Systems Third Unit  - Fourth Semester - EngineeringOperating Systems Third Unit  - Fourth Semester - Engineering
Operating Systems Third Unit - Fourth Semester - Engineering
 
CH06.pdf
CH06.pdfCH06.pdf
CH06.pdf
 
Process management in os
Process management in osProcess management in os
Process management in os
 
RR and priority scheduling
RR and priority schedulingRR and priority scheduling
RR and priority scheduling
 
Cpu scheduling qusetions
Cpu scheduling qusetionsCpu scheduling qusetions
Cpu scheduling qusetions
 
Preemptive process example.pptx
Preemptive process example.pptxPreemptive process example.pptx
Preemptive process example.pptx
 
Process Scheduling Algorithms.pdf
Process Scheduling Algorithms.pdfProcess Scheduling Algorithms.pdf
Process Scheduling Algorithms.pdf
 
OS Process Chapter 3.pdf
OS Process Chapter 3.pdfOS Process Chapter 3.pdf
OS Process Chapter 3.pdf
 
Os module 2 ba
Os module 2 baOs module 2 ba
Os module 2 ba
 
CPU Scheduling Part-II.pdf
CPU Scheduling Part-II.pdfCPU Scheduling Part-II.pdf
CPU Scheduling Part-II.pdf
 

Recently uploaded

꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Callshivangimorya083
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...soniya singh
 
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...Pooja Nehwal
 
Data Science Jobs and Salaries Analysis.pptx
Data Science Jobs and Salaries Analysis.pptxData Science Jobs and Salaries Analysis.pptx
Data Science Jobs and Salaries Analysis.pptxFurkanTasci3
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfgstagge
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]📊 Markus Baersch
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPramod Kumar Srivastava
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Customer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxCustomer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxEmmanuel Dauda
 
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfKantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfSocial Samosa
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsappssapnasaifi408
 
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Sapana Sha
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptxthyngster
 
9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home ServiceSapana Sha
 
Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...
Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...
Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...ThinkInnovation
 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptSonatrach
 

Recently uploaded (20)

꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
 
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
 
Data Science Jobs and Salaries Analysis.pptx
Data Science Jobs and Salaries Analysis.pptxData Science Jobs and Salaries Analysis.pptx
Data Science Jobs and Salaries Analysis.pptx
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdf
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 
Customer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxCustomer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptx
 
E-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptxE-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptx
 
Call Girls in Saket 99530🔝 56974 Escort Service
Call Girls in Saket 99530🔝 56974 Escort ServiceCall Girls in Saket 99530🔝 56974 Escort Service
Call Girls in Saket 99530🔝 56974 Escort Service
 
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfKantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
 
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
 
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
 
9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service
 
Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...
Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...
Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...
 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
 

Ch5 answers

  • 1. Course: Operating system Answers of Chapter(5) 5.13 Consider the following set of processes, with the length of the CPU-burst time given in milliseconds: PriorityBurst TimeProcess 310P1 11P2 32P3 41P4 25P5 The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0. a. Draw four Gantt charts illustrating the execution of these processes using FCFS, SJF, a non-preemptive priority (a smaller priority number implies a higher priority), and RR (quantum = 1) scheduling. b. What is the turnaround time of each process for each of the scheduling algorithms in part a? c. What is the waiting time of each process for each of the scheduling algorithms in part a? d. Which of the schedules in part a results in the minimal average waiting time (over all processes)? Answer: a) Gantt charts: FCFS: P1 P2 P3 P4 P5 SJF P2 P4 P3 P5 P1 Non-preemptive priority P2 P5 P1 P3 P4 ..... ))‫ل‬ ‫أخيتي‬‫تنسينا‬‫من‬‫صالح‬((‫دعائك‬ 1 0 10 11 13 14 19 0 1 2 4 9 19 0 1 6 16 18 19
  • 2. Course: Operating system RR (quantum = 1) P1 P2 P3 P4 P5 P1 P3 P5 P1 P5 P1 P5 P1 P5 P1 b) Turnaround time = finish time- arrival time OR: Turnaround time = CPU burst time+ wait time By using the first law (Turnaround time = finish time- arrival time) and getting finish time from Gantt chart: Turnaround time FCFS RR SJF Priority P1 10-0=10 19-0=19 19-0=19 16-0=16 P2 11 2 1 1 P3 13 7 4 18 P4 14 4 2 19 P5 19 14 9 6 c) Waiting time = Turnaround time - CPU burst time Waiting time FCFS RR SJF Priority P1 10-10=0 19-10=9 19-10=9 16-10=6 P2 10 1 0 0 P3 11 5 2 16 P4 13 3 1 18 P5 14 9 4 1 Average waiting time 9.6 5.4 3.2 8.2 d) The minimal average waiting time is found in SJF algorithm * * * * 5.17 Suppose that the following processes arrive for execution at the times indicated. Each process will run the listed amount of time. In answering the questions, use non-preemptive scheduling and base all decisions on the information you have at the time the decision must be made. Burst TimeArrival TimeProcess 80.0P1 40.4P2 11.0P3 ..... ))‫ل‬ ‫أخيتي‬‫تنسينا‬‫من‬‫صالح‬((‫دعائك‬ 2 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 19
  • 3. Course: Operating system (a) What is the average turnaround time for these processes with the FCFS scheduling algorithm? (b) What is the average turnaround time for these processes with the SJF scheduling algorithm? (c) The SJF algorithm is supposed to improve performance, but notice that we chose to run process P1 at time 0 because we did not know that two shorter processes would arrive soon. Compute what the average turnaround time will be if the CPU is left idle for the first 1 unit and then SJF scheduling is used. Remember that processes P1 and P2 are waiting during this idle time, so their waiting time may increase. This algorithm could be known as future-knowledge scheduling. Answer: a) Average turnaround time with FCFS : We need to draw the Gantt chart to find the finish time then calculate the turnaround time (Turnaround time = finish time- arrival time) P1 P2 P3 turnaround time P1 8-0=8 P2 12-0.4=11.6 P3 13-1=12 Average turnaround time 10.53 b)Average turnaround time with SJF : We need to draw the Gantt chart to find the finish time then calculate the turnaround time (Turnaround time = finish time- arrival time) P1 P3 P2 turnaround time P1 8-0=8 P2 13-0.4=12.6 P3 9-1=8 Average turnaround time 9.53 ..... ))‫ل‬ ‫أخيتي‬‫تنسينا‬‫من‬‫صالح‬((‫دعائك‬ 3 0 8 12 13 0 8 9 13
  • 4. Course: Operating system c) Average turnaround time with future-knowledge scheduling. We need to draw the Gantt chart to find the finish time then calculate the turnaround time (Turnaround time = finish time- arrival time) P3 P2 P1 turnaround time P1 14-0=14 P2 6-0.4=5.6 P3 2-1=1 Average turnaround time 6.87 * * * * 5.9 Which of the following scheduling algorithms could result in starvation? a. First-come, first-served b. Shortest job first c. Round robin d. Priority Answer: In FCFS algorithm, all jobs is executed in sequence & no job will wait for infinity to be executed  So, No starvation SJF could make some long jobs wait for infinity to be executed if shorter jobs continuously arrive to the ready queue  So, SJF could result in starvation. RR treats all jobs equally and no job will wait for infinity to be executed  So, No starvation Priority algorithm could make some low-priority jobs wait for infinity to be executed if higher- priority jobs continuously arrive to the ready queue  So, Priority algorithm could result in starvation. Finally, Shortest job first (SJF) and priority-based scheduling algorithms could result in starvation. * * * * 5.7 Explain the differences in the degree to which the following scheduling algorithms discriminate in favor of short processes: a. FCFS b. RR c. Multilevel feedback queues Answer: a. FCFS—discriminates against short jobs since any short jobs arriving after long jobs will have a longer waiting time. b. RR—treats all jobs equally (giving them equal bursts of CPU time) so short jobs will be able to leave the system faster since they will finish first. ..... ))‫ل‬ ‫أخيتي‬‫تنسينا‬‫من‬‫صالح‬((‫دعائك‬ 4 0 1 2 6 14
  • 5. Course: Operating system c. Multilevel feedback queues work similar to the RR algorithm— they discriminate favorably toward short jobs. * * * * 5.8 Consider the exponential average formula used to predict the length of the next CPU burst. What are the implications of assigning the following values to the parameters used by the algorithm? a. α= 0 and τ0 = 100milliseconds b. α= 0.99 and τ0 = 10milliseconds Answer: a) Τn+1= α * tn + (1- α) * τn When α = 0 andτ0 = 100 milliseconds, the equation will be: Τn+1= 0* tn + (1- 0) * 100 = 100 milliseconds So, in this case the formula always makes a prediction of (100 milliseconds) for the next CPU burst. b) Τn+1= α * tn + (1- α) * τn . When α = 0.99 and τ0 = 10 milliseconds, the equation will be: Τn+1= 0.99* tn + (1- 0.99) * 10 = [ 0.99 tn + 0.1] milliseconds So, in this case the most recent behavior (tn ) of the process is given much higher weight (99% with comparison to 1%) than the past history associated with the process (τn=10). * * * * 5.4 What advantage is there in having different time-quantum sizes at different levels of a multilevel queuing system? Answer: Processes that need more frequent servicing, for example, interactive processes such as editors, can be in a queue with a small time quantum (because it has high input/output interrupts). Processes with no need for frequent servicing (e.g. batch process) can be in a queue with a larger quantum, requiring fewer context switches to complete the processing (because it has very low input/output interrupts). So, the multilevel queuing algorithm makes more efficient use of the computer. * * * * Good Luck ..... ))‫ل‬ ‫أخيتي‬‫تنسينا‬‫من‬‫صالح‬((‫دعائك‬ 5
  • 6. Course: Operating system Reem Al_Salih ..... ))‫ل‬ ‫أخيتي‬‫تنسينا‬‫من‬‫صالح‬((‫دعائك‬ 6
  • 7. Course: Operating system Reem Al_Salih ..... ))‫ل‬ ‫أخيتي‬‫تنسينا‬‫من‬‫صالح‬((‫دعائك‬ 6