SlideShare a Scribd company logo
1 of 63
Chapter 5
I/O Management and Disk
Scheduling
Dave Bremer
Otago Polytechnic, NZ
©2008, Prentice Hall
Operating Systems:
Internals and Design Principles, 6/E
William Stallings
Roadmap
– I/O Devices
– Organization of the I/O Function
– Operating System Design Issues
– I/O Buffering
– Disk Scheduling
– Raid
– Disk Cache
Categories of
I/O Devices
• Difficult area of OS design
– Difficult to develop a consistent solution due
to a wide variety of devices and applications
• Three Categories:
– Human readable
– Machine readable
– Communications
Human readable
• Devices used to communicate with the
user
• Printers and terminals
– Video display
– Keyboard
– Mouse etc
Machine readable
• Used to communicate with electronic
equipment
– Disk drives
– USB keys
– Sensors
– Controllers
– Actuators(electric motors, stepper motors)
Communication
• Used to communicate with remote
devices
– Digital line drivers(connect a CD player to an
amplified speaker system.)
– Modems
Differences in
I/O Devices
• Devices differ in a number of areas
– Data Rate
– Application
– Complexity of Control
– Unit of Transfer
– Data Representation
– Error Conditions
Data
Rate
• May be
massive
difference
between the
data transfer
rates of
devices
Application
– Disk used to store files requires file
management software
– Disk used to store virtual memory pages
needs special hardware and software to
support it
– Terminal used by system administrator may
have a higher priority
Complexity of control
• A printer requires a relatively simple
control interface.
• A disk is much more complex.
• This complexity is filtered to some extent
by the complexity of the I/O module that
controls the device.
Unit of transfer
• Data may be transferred as
– a stream of bytes or characters (e.g., terminal
I/O)
– or in larger blocks (e.g., disk I/O).
Data representation
• Different data encoding schemes are used
by different devices,
–including differences in character code and
parity conventions.
Error Conditions
• The nature of errors differ widely from one
device to another.
• Aspects include:
– the way in which they are reported,
– their consequences,
– the available range of responses
Roadmap
– I/O Devices
– Organization of the I/O Function
– Operating System Design Issues
– I/O Buffering
– Disk Scheduling
– Raid
– Disk Cache
– UNIX SVR4 I/O
– LINUX I/O
– Windows I/O
Techniques for
performing I/O
• Programmed I/O
• Interrupt-driven I/O
• Direct memory access (DMA)
• In this mode the data transfer is initiated by the instructions written in a
computer program.
• An input instruction is required to store the data from the device to the CPU and
a store instruction is required to transfer the data from the CPU to the device.
• Data transfer through this mode requires constant monitoring of the peripheral
device by the CPU and also monitor the possibility of new transfer once the
transfer has been initiated.
• Thus CPU stays in a loop until the I/O device indicates that it is ready for data
transfer.
• Thus programmed I/O is a time consuming process that keeps the processor busy
needlessly and leads to wastage of the CPU cycles.
Programmed I/O
• This mode uses an interrupt facility and special commands to inform
the interface to issue the interrupt command when data becomes
available and interface is ready for the data transfer.
• In the meantime CPU keeps on executing other tasks and need not
check for the flag.
• When the flag is set, the interface is informed and an interrupt is
initiated.
• Its module is faster than programmed I/O module.
• The CPU cycles are not wasted as CPU continues with other work
during this time and hence this method is more efficient.
Interrupt-driven I/O
• DMA modules controls the exchange of data between main memory and I/O
module.
• The data transfer between a fast storage media such as magnetic disk and memory unit
is limited by the speed of the CPU.
• we can allow the peripherals directly communicate with each other using the memory
buses, removing the intervention of the CPU.
Direct Memory Access (DMA)
• This type of data transfer technique is known as DMA or direct memory access.
• During DMA the CPU is idle and it has no control over the memory buses. The DMA
controller takes over the buses to manage the transfer directly between the I/O devices
and the memory unit.
Direct Memory Access (DMA)
Evolution of the
I/O Function
1. Processor directly controls a peripheral
device
2. Controller or I/O module is added
– Processor uses programmed I/O without
interrupts
– Processor does not need to handle details of
external devices
Evolution of the
I/O Function
cont…
3. Controller or I/O module with interrupts
– Efficiency improves as processor does not
spend time waiting for an I/O operation to be
performed
4. Direct Memory Access
– Blocks of data are moved into memory
without involving the processor
– Processor involved at beginning and end only
Evolution of the
I/O Function
cont…
5. I/O module is a separate processor
– CPU directs the I/O processor to execute
an I/O program in main memory.
6. I/O processor
– I/O module has its own local memory
– Commonly used to control communications
with interactive terminals
Direct Memory Address
•
•
•
Processor delegates I/O operation to the DMA
module
• DMA module transfers data directly to or form memory
When complete DMA module sends an interrupt
signal to the processor.
For DMA to be implemented, processor has to share
its’ system bus with the DMA module. Therefore, the
DMA module must use the bus only when the
processor does not need it, or it must force the
processor to suspend operation temporarily.
DMA Configurations:
Single Bus
• DMA can be configured in several ways
• Shown here, all modules share the same
system bus
DMA Configurations:
Integrated DMA & I/O
• This means that there is a path between the DMA module and
one or more I/O modules that does not include the system bus.
The DMA logic may actually be a part of an I/O module, or it may be
a separate module that controls one or more I/O modules.
DMA Configurations:
I/O Bus
• Reduces the number of I/O interfaces in the
DMA module
Roadmap
– I/O Devices
– Organization of the I/O Function
– Operating System Design Issues
– I/O Buffering
– Disk Scheduling
– Raid
– Disk Cache
– UNIX SVR4 I/O
– LINUX I/O
– Windows I/O
Goals: Efficiency
• Most I/O devices extremely slow
compared to main memory
• Use of multiprogramming allows for some
processes to be waiting on I/O while
another process executes
• I/O cannot keep up with processor speed
– Swapping used to bring in ready processes
– But this is an I/O operation itself
Generality
• For simplicity and freedom from error it is
desirable to handle all I/O devices in a
uniform manner
• Hide most of the details of device I/O in
lower-level routines
• Difficult to completely generalize, but can
use a hierarchical modular design of I/O
functions
Hierarchical design
• A hierarchical philosophy leads to
organizing an OS into layers
• Each layer relies on the next lower layer to
perform more primitive functions
• It provides services to the next higher
layer.
• Changes in one layer should not require
changes in other layers
Model of I/O organization
• Local peripheral device
• Communications port
• Filesystems
Local peripheral device
• Logical I/O:
– Deals with the device as a logical
resource
– Concerned with managing general I/O
functions on behalf of user processes,
allowing them to deal with the device in
terms of a device identifier and simple
commands such as open, close, read,
write.
Local peripheral device
• Device I/O:
– Converts requested operations into
sequence of I/O instructions
• Scheduling and Control
– Performs actual queuing and control
operations
Communications Port
• Similar to previous but the logical
I/O module is replaced by a
communications architecture,
– This consist of a number of layers.
– An example is TCP/IP,
File System
• Directory management
– Concerned with user operations
affecting files
• File System
– Logical structure and operations
• Physical organisation]
– Converts logical names to physical
addresses
Roadmap
– I/O Devices
– Organization of the I/O Function
– Operating System Design Issues
– I/O Buffering
– Disk Scheduling
– Raid
– Disk Cache
– UNIX SVR4 I/O
– LINUX I/O
– Windows I/O
I/O Buffering
• The buffer is an area in the main
memory used to store or hold the
data temporarily. In other words, buffer
temporarily stores data transmitted from
one place to another, either between two
devices or an application. The act of storing
data temporarily in the buffer is
called buffering.
Uses of I/O Buffering :
1.It helps in matching speed between two
devices in which the data is transmitted.
For example, a hard disk has to store the file
received from the modem.
As we know, the transmission speed of a modem
is slow compared to the hard disk.
So bytes coming from the modem is accumulated
in the buffer space, and when all the bytes of a
file has arrived at the buffer, the entire data is
written to the hard disk in a single operation.
Uses of I/O Buffering :
2. It helps the devices with different sizes of data
transfer to get adapted to each other. It helps
devices to manipulate data before sending or
receiving it. In computer networking, the large
message is fragmented into small fragments and
sent over the network. The fragments are
accumulated in the buffer at the receiving end
and reassembled to form a complete large
message.
Types of I/O
• Block-oriented device
• Stream-oriented device
Block-oriented Device
• Information is stored in fixed sized blocks
• Transfers are made a block at a time
–Can reference data b block number
• Used for disks and USB keys
Stream-Oriented
Device
• Transfer information as a stream of bytes
• Used for terminals, printers,
communication ports, mouse and other
pointing devices, and most other devices
that are not secondary storage
I/O buffering schemes
• No buffering
• Single buffering
• Double buffering
• Circular buffering
No Buffer
• Without a buffer, the OS directly access
the device as and when it needs
Single Buffer
• Operating system assigns a buffer in main
memory for an I/O request
Block Oriented Single Buffer
• System buffer takes the input.
• After taking the input, the block gets transferred
to the user space by the process and then the
process requests for another block.
• Two blocks works simultaneously, when one bloc
of data is processed by the user process, the next
block is being read in.
• OS can swap the processes.
• OS can record the data of system buffer to user
processes.
Stream Oriented Single Buffer
• Line- at a time operation is used for scroll made
terminals. User inputs one line at a time, with a
carriage return signaling at the end of a line.
Double Buffer
• Use two system buffers instead of one
• A process can transfer data to or from one
buffer while the operating system empties
or fills the other buffer
Circular Buffer
• More than two buffers are used
• Each individual buffer is one unit in a
circular buffer
• Used when I/O operation must keep up
with process
Roadmap
– I/O Devices
– Organization of the I/O Function
– Operating System Design Issues
– I/O Buffering
– Disk Scheduling
– Raid
– Disk Cache
– UNIX SVR4 I/O
– LINUX I/O
– Windows I/O
Disk Performance
Parameters
• The actual details of disk I/O operation
depend on many things
–A general timing diagram of disk I/O transfer
is shown here.
Positioning the
Read/Write Heads
• When the disk drive is operating, the disk
is rotating at constant speed.
• Track selection involves moving the head
in a movable-head system or electronically
selecting one head on a fixed-head system.
Disk Performance
Parameters
 Seek Time:Seek time is the time taken to locate the disk arm to a
specified track where the data is to be read or write. So the disk
scheduling algorithm that gives minimum average seek time is
better.
 Rotational Latency: Rotational Latency is the time taken by the
desired sector of disk to rotate into a position so that it can access
the read/write heads. So the disk scheduling algorithm that gives
minimum rotational latency is better.
 Transfer Time: Transfer time is the time to transfer the data. It
depends on the rotating speed of the disk and number of bytes to
be transferred.
 Disk Access Time: Disk Access Time is:
Disk Access Time = Seek Time + Rotational Latency + Transfer Time
Roadmap
– I/O Devices
– Organization of the I/O Function
– Operating System Design Issues
– I/O Buffering
– Disk Scheduling
– Raid
– Disk Cache
– UNIX SVR4 I/O
– LINUX I/O
– Windows I/O
RAID
• Redundant Array of Independent Disks
• RAID or redundant array of independent disks
is a data storage virtualization technology that
combines multiple physical disk drive
components into one or more logical units for
data redundancy, performance improvement,
or both.
RAID
Each of RAID levels has its own characteristics
of:
Fault-tolerance is the ability to survive one or
several disk failures.
Performance shows the change in the read and
writes speed of the entire array compared to a
single disk.
RAID 0 – Stripped-
RAID 0 is taking any number of disks and merging them into
one large volume. It will increase speeds as you're reading and
writing from multiple disks at a time. But all data on all disks is
lost if any one disk fails.
RAID 1 -Mirrored
• It duplicates data across two disks in the array,
providing full redundancy. Both disks are store exactly
the same data, at the same time, and at all times.
Data is not lost as long as one disk survives.
RAID 2
(Using Hamming code)
• In a parallel access array, all member disks participate in the execution of
every I/O request.
• Typically, the spindles of the individual drives are synchronized so that each disk
head is in the same position on each disk at any given time.
• Data stripping is used (extremely small)
• Hamming code used to correct single bit errors and detect double-bit errors.
• Not implemented in practice due to high costs and overheads.
RAID 3
bit-interleaved parity
•
•
•
– Instead of an error-correcting code, a simple parity bit is computed for the set of individual
bits in the same position on all of the data disks.
– In case of disk failure,the parity drive is accessed and data is reconstructed from the
remaining devices.
RAID 3 is organized in a similar fashion to RAID 2.
The difference is that RAID 3 requires only a single redundant disk, no matter how
large the disk array.
RAID 3 employs parallel access, with data distributed in small strips.
RAID 4
Block-level parity
• A bit-by-bit parity strip is calculated across corresponding strips on
each data disk.
• The parity bits are stored in the corresponding strip on the parity disk.
• Read performance is very good because of the blocks.
• Lowest overhead of check disks.
• Bottleneck
RAID 5
•
•
Block-level Distributed parity
RAID 5 is organized in a similar fashion to RAID 4.
RAID 5 distributes the parity strips across all disks.
• A typical allocation is a round-robin scheme
• For an n-disk array, the parity strip is on a different disk for the first n stripes, and the pattern
then repeats.
• The distribution of parity strips across all drives avoids the potential I/O bottleneck of
the single parity disk found in RAID 4.
RAID 6
Dual Redundancy
• Two different parity calculations are
carried out
–stored in separate blocks on different disks.
• Can recover from two disks failing

More Related Content

Similar to I/o management and disk scheduling .pptx

Similar to I/o management and disk scheduling .pptx (20)

I/O systems chapter 12 OS
I/O systems chapter 12 OS I/O systems chapter 12 OS
I/O systems chapter 12 OS
 
In out system
In out systemIn out system
In out system
 
Weeks [01 02] 20100921
Weeks [01 02] 20100921Weeks [01 02] 20100921
Weeks [01 02] 20100921
 
Hardware I/O organization
Hardware  I/O organization Hardware  I/O organization
Hardware I/O organization
 
Chapter 7
Chapter 7Chapter 7
Chapter 7
 
computer system structure
computer system structurecomputer system structure
computer system structure
 
ch1.pptx
ch1.pptxch1.pptx
ch1.pptx
 
5120224.ppt
5120224.ppt5120224.ppt
5120224.ppt
 
Comp 501.pptx
Comp 501.pptxComp 501.pptx
Comp 501.pptx
 
Unit 6
Unit 6Unit 6
Unit 6
 
What is operating system
What is operating systemWhat is operating system
What is operating system
 
A transfer from I/O device to memory requires the execution of several instru...
A transfer from I/O device to memory requires the execution of several instru...A transfer from I/O device to memory requires the execution of several instru...
A transfer from I/O device to memory requires the execution of several instru...
 
Chapter 4
Chapter 4Chapter 4
Chapter 4
 
Cao u1
Cao u1Cao u1
Cao u1
 
Chapter 4
Chapter 4Chapter 4
Chapter 4
 
Coa presentation4
Coa presentation4Coa presentation4
Coa presentation4
 
Ch1 introduction
Ch1   introductionCh1   introduction
Ch1 introduction
 
Computer architecture presentation
Computer architecture presentationComputer architecture presentation
Computer architecture presentation
 
comporgppt.pptx
comporgppt.pptxcomporgppt.pptx
comporgppt.pptx
 
E.s unit 4 and 5
E.s unit 4 and 5E.s unit 4 and 5
E.s unit 4 and 5
 

Recently uploaded

POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 

Recently uploaded (20)

POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 

I/o management and disk scheduling .pptx

  • 1. Chapter 5 I/O Management and Disk Scheduling Dave Bremer Otago Polytechnic, NZ ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William Stallings
  • 2. Roadmap – I/O Devices – Organization of the I/O Function – Operating System Design Issues – I/O Buffering – Disk Scheduling – Raid – Disk Cache
  • 3. Categories of I/O Devices • Difficult area of OS design – Difficult to develop a consistent solution due to a wide variety of devices and applications • Three Categories: – Human readable – Machine readable – Communications
  • 4. Human readable • Devices used to communicate with the user • Printers and terminals – Video display – Keyboard – Mouse etc
  • 5. Machine readable • Used to communicate with electronic equipment – Disk drives – USB keys – Sensors – Controllers – Actuators(electric motors, stepper motors)
  • 6. Communication • Used to communicate with remote devices – Digital line drivers(connect a CD player to an amplified speaker system.) – Modems
  • 7. Differences in I/O Devices • Devices differ in a number of areas – Data Rate – Application – Complexity of Control – Unit of Transfer – Data Representation – Error Conditions
  • 8. Data Rate • May be massive difference between the data transfer rates of devices
  • 9. Application – Disk used to store files requires file management software – Disk used to store virtual memory pages needs special hardware and software to support it – Terminal used by system administrator may have a higher priority
  • 10. Complexity of control • A printer requires a relatively simple control interface. • A disk is much more complex. • This complexity is filtered to some extent by the complexity of the I/O module that controls the device.
  • 11. Unit of transfer • Data may be transferred as – a stream of bytes or characters (e.g., terminal I/O) – or in larger blocks (e.g., disk I/O).
  • 12. Data representation • Different data encoding schemes are used by different devices, –including differences in character code and parity conventions.
  • 13. Error Conditions • The nature of errors differ widely from one device to another. • Aspects include: – the way in which they are reported, – their consequences, – the available range of responses
  • 14. Roadmap – I/O Devices – Organization of the I/O Function – Operating System Design Issues – I/O Buffering – Disk Scheduling – Raid – Disk Cache – UNIX SVR4 I/O – LINUX I/O – Windows I/O
  • 15. Techniques for performing I/O • Programmed I/O • Interrupt-driven I/O • Direct memory access (DMA)
  • 16. • In this mode the data transfer is initiated by the instructions written in a computer program. • An input instruction is required to store the data from the device to the CPU and a store instruction is required to transfer the data from the CPU to the device. • Data transfer through this mode requires constant monitoring of the peripheral device by the CPU and also monitor the possibility of new transfer once the transfer has been initiated. • Thus CPU stays in a loop until the I/O device indicates that it is ready for data transfer. • Thus programmed I/O is a time consuming process that keeps the processor busy needlessly and leads to wastage of the CPU cycles. Programmed I/O
  • 17. • This mode uses an interrupt facility and special commands to inform the interface to issue the interrupt command when data becomes available and interface is ready for the data transfer. • In the meantime CPU keeps on executing other tasks and need not check for the flag. • When the flag is set, the interface is informed and an interrupt is initiated. • Its module is faster than programmed I/O module. • The CPU cycles are not wasted as CPU continues with other work during this time and hence this method is more efficient. Interrupt-driven I/O
  • 18. • DMA modules controls the exchange of data between main memory and I/O module. • The data transfer between a fast storage media such as magnetic disk and memory unit is limited by the speed of the CPU. • we can allow the peripherals directly communicate with each other using the memory buses, removing the intervention of the CPU. Direct Memory Access (DMA)
  • 19. • This type of data transfer technique is known as DMA or direct memory access. • During DMA the CPU is idle and it has no control over the memory buses. The DMA controller takes over the buses to manage the transfer directly between the I/O devices and the memory unit. Direct Memory Access (DMA)
  • 20. Evolution of the I/O Function 1. Processor directly controls a peripheral device 2. Controller or I/O module is added – Processor uses programmed I/O without interrupts – Processor does not need to handle details of external devices
  • 21. Evolution of the I/O Function cont… 3. Controller or I/O module with interrupts – Efficiency improves as processor does not spend time waiting for an I/O operation to be performed 4. Direct Memory Access – Blocks of data are moved into memory without involving the processor – Processor involved at beginning and end only
  • 22. Evolution of the I/O Function cont… 5. I/O module is a separate processor – CPU directs the I/O processor to execute an I/O program in main memory. 6. I/O processor – I/O module has its own local memory – Commonly used to control communications with interactive terminals
  • 23. Direct Memory Address • • • Processor delegates I/O operation to the DMA module • DMA module transfers data directly to or form memory When complete DMA module sends an interrupt signal to the processor. For DMA to be implemented, processor has to share its’ system bus with the DMA module. Therefore, the DMA module must use the bus only when the processor does not need it, or it must force the processor to suspend operation temporarily.
  • 24. DMA Configurations: Single Bus • DMA can be configured in several ways • Shown here, all modules share the same system bus
  • 25. DMA Configurations: Integrated DMA & I/O • This means that there is a path between the DMA module and one or more I/O modules that does not include the system bus. The DMA logic may actually be a part of an I/O module, or it may be a separate module that controls one or more I/O modules.
  • 26. DMA Configurations: I/O Bus • Reduces the number of I/O interfaces in the DMA module
  • 27. Roadmap – I/O Devices – Organization of the I/O Function – Operating System Design Issues – I/O Buffering – Disk Scheduling – Raid – Disk Cache – UNIX SVR4 I/O – LINUX I/O – Windows I/O
  • 28. Goals: Efficiency • Most I/O devices extremely slow compared to main memory • Use of multiprogramming allows for some processes to be waiting on I/O while another process executes • I/O cannot keep up with processor speed – Swapping used to bring in ready processes – But this is an I/O operation itself
  • 29. Generality • For simplicity and freedom from error it is desirable to handle all I/O devices in a uniform manner • Hide most of the details of device I/O in lower-level routines • Difficult to completely generalize, but can use a hierarchical modular design of I/O functions
  • 30. Hierarchical design • A hierarchical philosophy leads to organizing an OS into layers • Each layer relies on the next lower layer to perform more primitive functions • It provides services to the next higher layer. • Changes in one layer should not require changes in other layers
  • 31. Model of I/O organization • Local peripheral device • Communications port • Filesystems
  • 32. Local peripheral device • Logical I/O: – Deals with the device as a logical resource – Concerned with managing general I/O functions on behalf of user processes, allowing them to deal with the device in terms of a device identifier and simple commands such as open, close, read, write.
  • 33. Local peripheral device • Device I/O: – Converts requested operations into sequence of I/O instructions • Scheduling and Control – Performs actual queuing and control operations
  • 34. Communications Port • Similar to previous but the logical I/O module is replaced by a communications architecture, – This consist of a number of layers. – An example is TCP/IP,
  • 35. File System • Directory management – Concerned with user operations affecting files • File System – Logical structure and operations • Physical organisation] – Converts logical names to physical addresses
  • 36. Roadmap – I/O Devices – Organization of the I/O Function – Operating System Design Issues – I/O Buffering – Disk Scheduling – Raid – Disk Cache – UNIX SVR4 I/O – LINUX I/O – Windows I/O
  • 37. I/O Buffering • The buffer is an area in the main memory used to store or hold the data temporarily. In other words, buffer temporarily stores data transmitted from one place to another, either between two devices or an application. The act of storing data temporarily in the buffer is called buffering.
  • 38. Uses of I/O Buffering : 1.It helps in matching speed between two devices in which the data is transmitted. For example, a hard disk has to store the file received from the modem. As we know, the transmission speed of a modem is slow compared to the hard disk. So bytes coming from the modem is accumulated in the buffer space, and when all the bytes of a file has arrived at the buffer, the entire data is written to the hard disk in a single operation.
  • 39. Uses of I/O Buffering : 2. It helps the devices with different sizes of data transfer to get adapted to each other. It helps devices to manipulate data before sending or receiving it. In computer networking, the large message is fragmented into small fragments and sent over the network. The fragments are accumulated in the buffer at the receiving end and reassembled to form a complete large message.
  • 40. Types of I/O • Block-oriented device • Stream-oriented device
  • 41. Block-oriented Device • Information is stored in fixed sized blocks • Transfers are made a block at a time –Can reference data b block number • Used for disks and USB keys
  • 42. Stream-Oriented Device • Transfer information as a stream of bytes • Used for terminals, printers, communication ports, mouse and other pointing devices, and most other devices that are not secondary storage
  • 43. I/O buffering schemes • No buffering • Single buffering • Double buffering • Circular buffering
  • 44. No Buffer • Without a buffer, the OS directly access the device as and when it needs
  • 45. Single Buffer • Operating system assigns a buffer in main memory for an I/O request
  • 46. Block Oriented Single Buffer • System buffer takes the input. • After taking the input, the block gets transferred to the user space by the process and then the process requests for another block. • Two blocks works simultaneously, when one bloc of data is processed by the user process, the next block is being read in. • OS can swap the processes. • OS can record the data of system buffer to user processes.
  • 47. Stream Oriented Single Buffer • Line- at a time operation is used for scroll made terminals. User inputs one line at a time, with a carriage return signaling at the end of a line.
  • 48. Double Buffer • Use two system buffers instead of one • A process can transfer data to or from one buffer while the operating system empties or fills the other buffer
  • 49. Circular Buffer • More than two buffers are used • Each individual buffer is one unit in a circular buffer • Used when I/O operation must keep up with process
  • 50. Roadmap – I/O Devices – Organization of the I/O Function – Operating System Design Issues – I/O Buffering – Disk Scheduling – Raid – Disk Cache – UNIX SVR4 I/O – LINUX I/O – Windows I/O
  • 51. Disk Performance Parameters • The actual details of disk I/O operation depend on many things –A general timing diagram of disk I/O transfer is shown here.
  • 52. Positioning the Read/Write Heads • When the disk drive is operating, the disk is rotating at constant speed. • Track selection involves moving the head in a movable-head system or electronically selecting one head on a fixed-head system.
  • 53. Disk Performance Parameters  Seek Time:Seek time is the time taken to locate the disk arm to a specified track where the data is to be read or write. So the disk scheduling algorithm that gives minimum average seek time is better.  Rotational Latency: Rotational Latency is the time taken by the desired sector of disk to rotate into a position so that it can access the read/write heads. So the disk scheduling algorithm that gives minimum rotational latency is better.  Transfer Time: Transfer time is the time to transfer the data. It depends on the rotating speed of the disk and number of bytes to be transferred.  Disk Access Time: Disk Access Time is: Disk Access Time = Seek Time + Rotational Latency + Transfer Time
  • 54. Roadmap – I/O Devices – Organization of the I/O Function – Operating System Design Issues – I/O Buffering – Disk Scheduling – Raid – Disk Cache – UNIX SVR4 I/O – LINUX I/O – Windows I/O
  • 55. RAID • Redundant Array of Independent Disks • RAID or redundant array of independent disks is a data storage virtualization technology that combines multiple physical disk drive components into one or more logical units for data redundancy, performance improvement, or both.
  • 56. RAID Each of RAID levels has its own characteristics of: Fault-tolerance is the ability to survive one or several disk failures. Performance shows the change in the read and writes speed of the entire array compared to a single disk.
  • 57. RAID 0 – Stripped- RAID 0 is taking any number of disks and merging them into one large volume. It will increase speeds as you're reading and writing from multiple disks at a time. But all data on all disks is lost if any one disk fails.
  • 58. RAID 1 -Mirrored • It duplicates data across two disks in the array, providing full redundancy. Both disks are store exactly the same data, at the same time, and at all times. Data is not lost as long as one disk survives.
  • 59. RAID 2 (Using Hamming code) • In a parallel access array, all member disks participate in the execution of every I/O request. • Typically, the spindles of the individual drives are synchronized so that each disk head is in the same position on each disk at any given time. • Data stripping is used (extremely small) • Hamming code used to correct single bit errors and detect double-bit errors. • Not implemented in practice due to high costs and overheads.
  • 60. RAID 3 bit-interleaved parity • • • – Instead of an error-correcting code, a simple parity bit is computed for the set of individual bits in the same position on all of the data disks. – In case of disk failure,the parity drive is accessed and data is reconstructed from the remaining devices. RAID 3 is organized in a similar fashion to RAID 2. The difference is that RAID 3 requires only a single redundant disk, no matter how large the disk array. RAID 3 employs parallel access, with data distributed in small strips.
  • 61. RAID 4 Block-level parity • A bit-by-bit parity strip is calculated across corresponding strips on each data disk. • The parity bits are stored in the corresponding strip on the parity disk. • Read performance is very good because of the blocks. • Lowest overhead of check disks. • Bottleneck
  • 62. RAID 5 • • Block-level Distributed parity RAID 5 is organized in a similar fashion to RAID 4. RAID 5 distributes the parity strips across all disks. • A typical allocation is a round-robin scheme • For an n-disk array, the parity strip is on a different disk for the first n stripes, and the pattern then repeats. • The distribution of parity strips across all drives avoids the potential I/O bottleneck of the single parity disk found in RAID 4.
  • 63. RAID 6 Dual Redundancy • Two different parity calculations are carried out –stored in separate blocks on different disks. • Can recover from two disks failing