This document covers the following chapters of Operating Systems: Internals and Design by William Stallings:
Chapter 11: I/O Management and Disk Scheduling
Chapter 12: File Management
Chapter 11: Part 1
I/O management and Disk Scheduling(Ch11.1 – Ch11.3: I/O Design & Ch11.4: I/O Buffering)
I/O Design
Categories of I/O Devices
External devices that engage in I/O with computer systems can be grouped into 3
categories:
o Human Readable
Suitable for communicating with the computer user
Printers, terminals, video display, keyboard, mouse
o Machine Readable
Suitable for communicating with electronic equipment
Disk drivers, USB keys, sensors, controllers
o Communication
Suitable for communicating with remote devices
Modems, digital line drivers
Differences in I/O Devices
Data Rate Differences of magnitude between the data transfer
states
Application Use to which a device is put has an influence on the
software
Complexity of Control Effects on the operating system is filtered 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 in larger blocks
Data Representation Different encoding schemes are sued by different
devices
Error Conditions Nature of errors, the way in which they are reported,
their consequences, and the available range of
responses differ from one device to another
Figure 11.1: Typical I/O Device Data Rates
,Organisation of the I/O Function
3 techniques for performing I/O are
Processor issues an I/O command on behalf of a
process to an I/O module
Programmed I/O
Process then busy waits for the operation to be
completed before proceeding
Processor issues an I/O command on behalf of a
process
o If non-blocking: processor continues to execute
instructions from the process that issues that I/O
Interrupt-driven I/O command
o If blocking: next instruction the processor executes
is from the OS, which will put the current process in
a blocked state and schedule another process
DMA module controls the exchange of data between
Direct Memory
main memory and an I/P module
Access (DMA)
Table 11.1: I/O techniques
Evolution of the I/O Function
1. Processor directly controls a peripheral device
2. A controller of I/O module is added
3. Same configuration as step 2, but now interrupts are employed
4. I.O module is given direct control of memory via DMA
5. I/O module is enhanced to become a separate processor, with a specialized instruction
set tailored for I/O
6. I/O module has a local memory of its own and is, in fact a computer in its own right
, CPU sends a command with the following info
o Read/write using read or write control line
o Address of I/O device using data lines
o Starting location of memory to read/write using data lines
o Number of words to read/write via data lines
Figure 11.2: Typical DMA Block
Diagram
Figure 11.3: Alternative DMA Configuration
Design Objectives
Efficiency
o Major effort in I/O design
o Important because I/O devices are extremely slow compared to main
memory and the processor
o Area that has received the most attention is disk I/O
Generality
o Desirable to handle all devices in a uniform manner
o Applies to the way the OS manages I/O devices and operation
o Diversity of devices makes it difficult to achieve true generality
o Use of hierarchical, modular approach to the design of the I/O function
Hierarchical Design
Functions of the OS should be separated according to
their complexity, their characteristic time scale, and
their level of abstraction
Leads to an organization of the OS into a series of
layers
Layers should be defined so that changes in one layer
do not require changes in other layers
Figure 11.4: A Module of I/O
Organisation
, I/O Buffering
No Buffer Without a buffer, the OS
directly accesses the device
when it needs
2 problems
o User process hung up
waiting for relatively
slow I/O requests to
complete
o Interferes with swapping
decision made by OS
Perform input transfers in advance of requests being made and perform output transfers some
time after the request is made
Block-oriented device Stream-oriented device
Stores info in blocks that are usually of fixed Transfers data in and out as a stream of bytes
size No block structure
Transfers are made one block at a time Examples:
Possible to reference data by its block number Communication ports
Examples: Most other devices that are not
Disks secondary storage
USB keys
Single Buffer OS assigns a buffer in main
memory for an I/O request
Block-oriented Single Buffer Stream-oriented Single Buffer
Input transfers are made to the system Line-at-a-time Byte-at-a-time
buffer operation operation
Reading ahead/anticipated input Appropriate for Used on form-
Is done in the expectation that the scroll-mode mode terminals
terminals (dumb When each
block will eventually be needed
terminals) keystroke is
When the transfer is complete, the User input is one significant
process moves the block into user line at a time with Other peripherals
space and immediately requests a carriage return such as sensors
another block signalling the end and controllers
Generally provides a speedup compared to of a line
the lack of system buffering Output to the
terminal is similarly
Disadvantages:
one line at a time
Complicates the logic in the OS
Swapping logic is also affected
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller mpumi__tshabalala. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $5.70. You're not tied to anything after your purchase.