Professional Documents
Culture Documents
Unit 4
Unit 4
Structure
4.0 Introduction
4.1 Objectives
4.2 Types of Processor Scheduling
4.2.1 Long-Term Scheduling
4.2.2 Medium-Term Scheduling
4.2.3 Short-Term Scheduling
4.3 Scheduling Algorithms
4.3.1 Short-term Scheduling Criteria
4.3.2 First-Come-First-Served
4.3.3. Round Robin
4.3.4 Shortest Process Next
4.3.5 Fair-Share Scheduling
Check your progress
4.4 I/O Devices
4.5 Organization I/O Function
4.5.1 The Evolution of the I/O function
4.5.2 Direct Memory Access
4.6 Operating System Design Issues
4.7 I/O Buffering
4.8 Disk Scheduling
4.8.1 Disk performance parameters
4.8.2 Disk Scheduling Policies
4.9 Disk Cache
Check your progress
4.10 Let us Sum up
4.0 Introduction
The first half of this unit begins with an examination of types of processor scheduling
showing the way in which they are related. We will see how short-term scheduling is
used on a single processor system and discuss the various Scheduling algorithms. The
next part of this unit focuses on discussion of I/O devices, Organization of I/O functions,
Operating design issues, the way in I/O function can be structured and also we will
examine the different disk scheduling algorithms.
4.1 Objectives
At the end of this unit you will be able to
• Identify the various external devices that are used in I/O
• Discuss the various techniques for performing I/O
• Explain the concept of DMA
• List the various design issues of Operating System
• Describe the various I/O buffering
• Explain the working of Disk Scheduling
• Capture the concept of Disk Cache.
Ready/
Runnin
Suspen Ready Exit
g
d
Medium-term Short-term scheduling
Scheduling
Blocked
/
Blocked
Suspen
d
Figure 4.1 Scheduling and Process State Transitions
4.3.2 First-come-First-Served
The simplest scheduling policy is first-come-first-served (FCFS), also known as
first-in-first-out (FIFO) or a strict queue scheme. As each process becomes ready, it joins
the ready queue. When the currently running process finished execution the process that
has been in the ready queue the longest is selected.
In terms of the queuing model, Turn Around Time (TAT) is the residence time Tr,
or total time that the item spends in the system. (Waiting time plus service time).The
normalized turnaround time, which is the ratio of turnaround time to service time. This
value indicates the relative delay experienced by a process. Typically, the longer the
process execution time, the greater the absolute amount of delay that can be tolerated.
The minimum possible value for this ratio is 1.0 increasing values correspond to a
decreasing level of service. FCFS performs much better for long processes than short
ones and it favor processor-bound processes over I/O bound processes.
Time-out
Admit Ready Queue Dispatch Release
Processor
Auxiliary queue
I/O 1 wait
I/O 1 queue
I/O 2 wait
I/O 2 queue
I/O n wait
I/O n queue
n
Sn+1 =1/n ΣT i
i=1
Where
Ti = processor execution time for the ith instance of this process
S = Predicated value for the ith instance
S1 = predicated value for first instance; not calculated
Data count
Data Register
Data lines
DMA request
DMA acknowledge
Control Logic Interrupt
Read
rEAD
Write
…
Processor
DMA I/O I/O Memory
DMA
Processor DMA Memory
I/O
I/O I/O
Single Buffer
The simplest type of buffering is single buffering. When a user process issues and
I/O request, the operating system assigns a buffer in the system portion of main
memory to the operation. For block-oriented devices, the single buffering scheme can
be described as follows: Input transfers are made to the system buffer. When the
transfer is complete, the process moves the block into user space and immediately
requests another block.
Operating System User Process
I/O devices
In
(a) No buffering
I/Odevice In Move
(c)Double buffering
. .
(d) Circular Buffering
Circular Buffering
Double buffering may be inadequate if the process performs rapid bursts of I/O.
In this case, the problem can be solved by using more than one buffer. When more
than two buffers are used, the collection of buffers is itself referred to as a circular
buffer.
MRU LRU
Re-reference;
count unchanged Re-reference
Count:=count+1
(a) FIIFO