0% found this document useful (0 votes)
4 views

operating system assignment

The document discusses various CPU scheduling algorithms including Short Job First, First Come First Serve, Round Robin, Priority Scheduling, and Multiple Queues, detailing their advantages and disadvantages. It also introduces the Ostrich Algorithm, which suggests ignoring certain problems like deadlocks when they occur infrequently and the cost of prevention is high. Each scheduling method is evaluated based on its efficiency, implementation complexity, and performance in different scenarios.

Uploaded by

douglaskpt
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

operating system assignment

The document discusses various CPU scheduling algorithms including Short Job First, First Come First Serve, Round Robin, Priority Scheduling, and Multiple Queues, detailing their advantages and disadvantages. It also introduces the Ostrich Algorithm, which suggests ignoring certain problems like deadlocks when they occur infrequently and the cost of prevention is high. Each scheduling method is evaluated based on its efficiency, implementation complexity, and performance in different scenarios.

Uploaded by

douglaskpt
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

COURSE: CERTIFICATE IN INFORMATION TECHNOLOGY

UNIT CODE:1 301

UNIT NAME: INTRODUCTION TO WINDOWS AND OPERATING SYSTEM

REG NO:CIT/2021 /71 986

NAME :SHARON CHEPNGETICH LANGAT

PRESENTED TO: LECTURE THOMAS PAUL NGUGI

TASK NAME : ASSIGNMENT

DATE OF SUBMISSION:3RD MARCH 2022


Discuss the following scheduling algorithms mentioning the advantages and disadvantages
of each

Short job first

First come first serve

Priority scheduling

Pre-emptive scheduling

Multiple queues

Short job first(SJF)

It is a scheduling algorithm in which the process having the smallest execution time is
choose for the next execution.The scheduling method can be preemptive or non- preemptive
it is significantly reduces the average waiting time for other process awaiting execution.

Types of short job first

Non-preemptive short job first

Preemptive short job first

Non- preemptive short job first

In non-preemptive scheduling,once the cpu cycle is allocated to process,the process hold it till
it reaches awaiting state or terminated

Preemptive

In preemptive short job first scheduling job are out into ready queue as they come.a process
with shortest burst time begins execution.if a process with even shorter burst time arrives,the
current process is removed or preempted from execution and the shorten job is allocated
CPU cycle

Advantages

Short job first is frequently used for long term scheduling

It reduces the average waiting time over first come first serve algorithm

Short job first iss probably optimal with regard to average turn around time

It is appropriate for jobs running in batch where run times are known in advance

Short job first method gives the lowest average waiting time for specific process
Disadvantages

Job completion time must be known,earlier but it is hard to predict

It is often used in batch system for long term scheduling

This short job first algorithm may cause very long turn around time or starvation

It requires knowledge of how long process or job will run

Elapsed time should be recorded,the results in more overhead on the processor

First come first serve

First come first serve is an operating system scheduling algorithm that automatically
execute queued requests and processors in order of their arrival

It is the easiest and simple CPU scheduling algorithms.in this type of algorithm,processes
which request the cpu first get the cpu allocation first ,this is managed with first come first
serve que

Characteristics of first come first serve

It support non-preemptive and preemptive scheduling algorithm

Jobs are always executed on a first come first serve basis

It is easy to use and implement

Disadvantages

It is a non-preemptive CPU scheduling algorithm so that the process has been


allocated to the cpu ,it will never release the cpu untill it finishes executing

The average awaiting time is high

Short processes that are at the back of the queue have to wait for long process at
the front finish

First come first serve is not an ideal technique for time sharing systems

Round-robin algorithm schedule


The name algorithm comes from the round-robin principle,where each person got an
equal share of something in turns ,it is the oldest ,simplest scheduling algorithm
which mostly used for multitasking

In a round robin scheduling,each ready task run by turn only in a cyclic queue for
a limited time slice.this algorithm also offer starvation free execution of process
.

Characteristics of round-robin scheduling algorithm

Round- robin is one of the oldest ,fairest and easiest algorithm

It is real time algorithm which respond to the event within a specific time limit

Round robin is a hybrid model which is clock driven

Round robin is widely used in scheduling method in traditional operating

system Advantages of round-robin scheduling algorithm

It does not face the issue of starvation of convey offered all jobs get a fair allocation
of cpu

It deal with all process without any priority

It gives the best performance in form of average response

It allows or to use the context switching method to save of preempted processes

This scheduling method doesn't depend upon burst time ,that is why it is
easly implemented on the system

If you only know the total number of processes on the run queue ,then you can
also assume the worst-case response for the same process

Disadvantages of round robin scheduling algorithm

It's slicing time of os is low ,the processor output will be reduced

This method spends more time on context switching

It's performance heavily depend on time quantum

Priorities can not be set for the processes

Round-robin scheduling doesn't give aa special priority to more important task


Lower the quantum results in higher the context switching overhead in the system

Finding a correct time quantum Is quite difficult task in this system

Priority scheduling algorithm

It is a method of scheduling processes that is based on priority in this algorithm


the scheduler selects the task to work as per the priority

The processes with higher priority should be arrived out first, whereas jobs
with equal priorities are carried out on a round robin on first come first serve
basis depend upon memory requirements and time requirements
Types of priority scheduling algorithm

Preemptive scheduling

Non-preemptive scheduling

Preemptive scheduling

The task are mostly assigned with their priorities sometimes it is important to run a
task with a higher priority before another lower lower priority task,even if the lower
priority task is still running ,the lower priority task holds for some time and
assumes when the higher task finishes it's execution

Non-preemptive scheduling

In this type of scheduling,the cpu has been allocated to a specific process that's
keeps the cpu busy ,will release thee cou either by switching context or
terminating,it is the only method that can be used for various hardware platforms

Characteristics of priority scheduling

A CPU Algorithm that schedules processes based on priority

It is used in operating system for performing batch processes

In priority scheduling a number is assigned the each processes that indicate


it's priority but Lower the number ,higher is the priority
Advantages of priority scheduling algorithm

It is a easy to use scheduling method


Processes are executed on the basis of priority does not need to wait for
long which saves time

This method provide a good mechanism where the relative important of


each process maybe precisely defined

Suitable for application with fluctuating and resource requirements

Disadvantages of priority scheduling algorithms

If the system eventually crushes ,all low priority gets lost

If higer priority processes takes alot of cpu time then the lower the
priority processes may starve and will be postponed for an indefinite time

The scheduling algorithm may leave some priority processes


awaiting indefinitely

A process will be blocked when it is ready to run but to wait for the
cpu because some other process is running currently

If a new priority process keeps on coming in the ready queue ,then


the processor which is awaiting state may need to wait for a long
duration time

Preemptive scheduling algorithm

Preemptive scheduling is a scheduling method where the task are


mostly assigned with their priorities.sometimes it is important to run a
task with a priority task is even if the lower priority is still running

All the time ,the lower the priority task hold for some time and
resumes when the higher priority task finishes it's execution

Advantages of preemptive scheduling algorithm

Preemptive scheduling method is more robust ,approach so


one process cannot monopolize the cpu

Choice of running task considered after each interruption

Each event cause interruption of running task

The operating system makes sure that the cpu equally

This scheduling method also approve the average response time


Preemptive scheduling is beneficial when we use it for
multi programming environment

Disadvantages of preemptive scheduling algorithm

Needed limited computational resources for scheduling

Takes a higher time by the scheduler to suspend the running


task ,switch the context ,and dispatch the new incoming task

The process which has low priority need to wait for longer time
if some higher priority processes arrives continuously

Multiple queue scheduling algorithm

Mulitple que scheduling is used when the processor in the


ready queue can be divided into different class has its own
scheduling needs

For instance , foreground or interactive processor are commonly


divided , foreground and background processors have different
time requirements and hence will have different scheduling
needs
.in this case multiple queue scheduling will be used

Advantages of multiple queue scheduling algorithm

Mulitple queue scheduling helps us apply different


scheduling algorithm for different processes

It will have a low scheduling overhead

Disadvantages of multiple scheduling algorithm

There are chances of starving for the lower


priority processes

It is flexible in nature
Explain the concept of ostrich algorithm

Ostrich algorithm

The Algorithm is a well used method to ignore problems


,it gets its name from ostrich and the way it stick it's head
in the sand and ingnore everything happening around

Analysis of ostrich algorithm


Different people react to this stategy in different ways ,if
the deadlock occurs on average once every five years
,but system crushes due to hardware failures ,compiler
error,and operating system bugs occur once a
week,most engineeers would not be willing to pay a
large penalty in performance of convinience to
eliminate deadlock

Most operating system potentially suffer from deadlock


that are not detected ,let alone automatically broken
.the total number of processes in a system is
determined by the number of entries in the process
table .the process table (data structure maintained by
os for context switching and scheduling) .slots
are finite resources,if a folk (calls to create a new
process from existing running process )fails becouse
the table is full,a reasonable approach for the
program doing the folk is to wait a random time
and try again

Now suppose that a Unix system has 1 00 processors


slots 1 0 programs running each of which need to create( 1
2 sub) process (total 1 0*1 2=1 20) .after each process has
created 9process ,the 1 0original processors and the 90
new processers have exhausted the table .each of
the 1 0 original processes now sits in an endless
loop forking and failing a deadlock

The probability of this happening is minusle ,but it


could happen,in that case should we abandon
processes and frok calls to eliminate the problem

The maximum number of open files is similarly restricted


by the size of their node table ,so a similar problem occur
when it fills up ,swap space on the disk is another limited
resource , almost every table in the operating system
represent a finite resources should we abolish all of
those becouse it might happen that a collection of
processes might each claim input output of the total
,and then each try to claim another one

Which operating system uses the ostrich algorithm

Most operating system,Unix and windows ,just ignore the


problem on the assumption that most users would prefer
an occasional deadlock to rule a restricting all users to
one
process ,one open file ,and one of everything if deadlock
could be eliminated for free,there would be much
discussion.the problem is that the high price , mostly in
terms of putting inconvenient restrictions on the
processor
.this we are faced with unpleasant trade off
between convinience and correctness under those
conditions,general solution are hard to find

When to use the ostrich algorithm

Ostrich algorithm can be used when;

Deadlock occur very rarely

Deadlock is difficult to detect it

The cost of prevention of deadlock is high

Trade-offs using ostrich algorithm

Although efficient,using ostrich trade correctness


for inconvenience,as the algorithm directly deals
with extreme cases it is not a large trade off ,in
fact ,the simplest and most used method to
recover from a deadlock is a reboot

Some algorithms with worst case performance are


commonly used as they exhibit poor performance
on artificial cases that do not occur in practice for
example ,the simplex algorithm type inference
algorithm for standard ml,integer overflow I
programming languages with fixed with integer are
also ignored becouse they occur in every
exceptional cases .

You might also like