0% found this document useful (0 votes)
69 views8 pages

Cpu Scheduling Assignment-Cs 303

This document discusses CPU scheduling algorithms. It covers the differences between I/O-bound and CPU-bound programs and how scheduling can prioritize I/O-bound programs. It also discusses preemptive vs non-preemptive scheduling and the objectives of CPU scheduling algorithms. Various scheduling algorithms like FCFS, SJF, priority, and round robin are described and compared based on average wait time, turnaround time, and CPU utilization. Implementation challenges of SJF and shortest remaining time first are also noted.

Uploaded by

nimesha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views8 pages

Cpu Scheduling Assignment-Cs 303

This document discusses CPU scheduling algorithms. It covers the differences between I/O-bound and CPU-bound programs and how scheduling can prioritize I/O-bound programs. It also discusses preemptive vs non-preemptive scheduling and the objectives of CPU scheduling algorithms. Various scheduling algorithms like FCFS, SJF, priority, and round robin are described and compared based on average wait time, turnaround time, and CPU utilization. Implementation challenges of SJF and shortest remaining time first are also noted.

Uploaded by

nimesha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

CPU SCHEDULING ASSIGNMENT-CS 303

1)I/O-bound programs have the property of performing only a small amount of


computation before performing
I/O. Such programs typically do not use up their entire CPU quantum. but CPU-
bound programs use their entire quantum without performing any blocking I/O
operations. Cm
making use of the computer’s resources by giving higher priority to I/O bound
programs can be done by allowing them
to execute ahead of the CPU-bound programs.
Also there exists a CPU and I/O burst cycle where;
the process execution begins with a CPU burst which is followed by another
I/O burst. And it is followed by another CPU burst and so on.
The final CPU burst ends with a system request to end the execution.
for this switching, it is important to distinguish between I/O bound and CPU
bound programs.

2) in preemptive scheduling the CPU is allocated to the processes for a


restricted time and let the next process in if its burst time is lesser than the
remaining time of the former process, by the time the next process arrives.
in Non-preemptive scheduling, the CPU is allocated to the process till it
terminates or switches to waiting state.

3)
Objectives of CPU scheduling algorithms:
1.Maximum throughput
2.Efficient and effective system
3.Less turn around time
4.Less waiting time
5. Less response time
4)
1. CPU utilization and response time: CPU utilization is increased if the
overheads associated with
context switching is reduced.

The context switching overheads could be lowered by performing


context switches.
This could result in increasing the response time for
processes.

2. Average turnaround time and maximum waiting time: Average turnaround


time is minimized by
executing the shortest tasks first. Such a scheduling policy could starve long-
running tasks and it increase their waiting time.

3. I/O device utilization and CPU utilization:


CPU utilization is maximized by running long-running CPU- bound tasks without
performing context switches. I/O device utilization is maximized by scheduling
I/O-bound jobs once they become ready to run, by incurring the overheads of
context switches
5)
1.
P2 P4 P3 P1

0 12 17 23 27

2.
AWT: 0+12+17+23/4= 52/4=13

5.3.
No it is not optimal because, under FCFS method, the early arrived processes
are served first although they take a long time to proceed. the later arrived
processes are there with a very small amount of burst time. But those
processes are ineffectively and unnecessarily waiting for the prior processes to
complete which is increasing the waiting time, turn around time and
completion time; Eventually leading to high average wait time whoch is not a
good outcome.

6)

SJF and SRTF is difficult to implement is OS because:


SJF can't be implemented for CPU scheduling for the short term. It is because
there is no specific method to predict the length of the upcoming CPU burst.
This algorithm may cause very long turnaround times.
And it is hard to know the length of the upcoming CPU request.Elapsed time
should be recorded, that results in more overhead on the processor.
Round robin can be used instead of SJF

7)
1.Shortest job first
2. Shortest Remaining time first (preemptive)
3.preemptive and non preemptive prioroty queue
8)
1.FCFC
P1 P2 P3 P4 P5

0 2 3 11 15 20

Turn around time(TAT) and wait time under FCFC(with averages)

Process TAT WT
(CT-AT) (TA-BT)
P1 2 2-2=0
P2 3 3-1=0
P3 11 11-8=3
P4 15 15-4=11
P5 20 20-5=15
Total=51 Total=31

ATT=51/5=10.2 AWT=31/5=6.2

2.SJF
P2 P1 P4 P5 P3

0 1 3 7 12 20
Turn around time(TAT) and wait time under SJF(with averages)
Process TAT WT
(CT-AT) (TA-BT)
P2 1 0
P1 3 1
P4 7 3
P5 12 7
P3 20 12
Total=43 Total=23

ATT=43/5=8.3 AWT=23/5=4.6

3.Non pre-emptive priority scheduling

P3 P5 P1 P4 P2

0 8 12 15 19 20

Process TAT WT
(CT-AT) (TA-BT)
P3 8 0
P5 13 8
P1 15 13
P4 19 15
P2 20 19
Total=75 Total=55

ATT=75/5=15 AWT=55/5=11
4.Round Robin

P1 P2 P3 P4 P5 P3 P4 P5 P3 P5 P3

0 2 3 5 7 9 11 13 15 17 18 20

Process TAT WT
(CT-AT) (TA-BT)
P1 2 0
P2 3 2
P3 20 12
P4 13 9
P5 18 13
Total=56 Total=36

ATT=56/5=11.2 AWT=36/5=7.2

8.4) shortest job first incurs the minimum average wait time
9) SRTN

A B A C E D

0 3 5 8 12 15 21
Process TAT WT
A 8 2
B 2 0
C 7 3
D 14 8
E 5 2
Total: 36 Total: 15

ATT: 36/5=7.2 AWT: 15/5=3

10)
P1 P1 Iddle P2 P3 P2 P3 P4 P4 P2 P3 Iddle P5 P6 P5

0 10 20 25 35 45 55 60 70 75 80 90 100 105 115 120

Process TAT WT
P1 20 0
P2 55 30
P3 60 35
P4 15 0
P5 20 10
P6 10 0
Total: 180 Total: 75

ATT: 180/6=30 AWT: 75/6=12.5


CPU Utilization: 105/120*100=87.5%

H.M.M.S.N.Deshapriya
S/16/909

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy