Tải bản đầy đủ (.pdf) (15 trang)

Advanced Operating Systems: Lecture 35 - Mr. Farhan Zaidi

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (620.4 KB, 15 trang )

CS703 ­ Advanced 
Operating Systems
By Mr. Farhan Zaidi


Lecture No. 
35


Overview of today’s lecture







Goals of I/O software
Layers of I/O software
Direct Vs memory mapped I/O
Interrupt driven I/O
Polled I/O
Direct Memory Access (DMA)


Principles of I/O Software



Goals of I/O Software
Device independence




Uniform naming






handle as close to the hardware as possible

Synchronous vs. asynchronous transfers




name of a file or device a string or an integer not depending
on which machine
Error handling





programs can access any I/O device without specifying
device in advance (floppy, hard drive, or CD-ROM)

blocked transfers vs. interrupt-driven

Buffering



data coming off a device cannot be stored in final destination
immediately


Device Controllers


I/O devices have components:





The electronic component is the device controller




mechanical component
electronic component

may be able to handle multiple devices

Controller's tasks





convert serial bit stream to block of bytes
perform error correction as necessary
make available to main memory


Layers of the I/O system and the main 
functions of each layer


Memory mapped I/O Vs Direct I/O


Memory mapped I/O




Device controller’s registers and internal memory
are directly mapped into the processor’s address
space

Direct I/O


Device controller’s registers and internal memory
is accessible via special instructions in the
assembly language instruction set. The
arguments to these instructions are usually called
ports.



Programmed I/O 

Writing a string to the printer using programmed I/O


Interrupt­Driven I/O



Writing a string to the printer using interrupt-driven I/O

a. Code executed when print system call is made
b. Interrupt service procedure


A Typical Hardware System
CPU chip
register file
ALU
system bus

memory bus

main
memory

I/O
bridge


bus interface

I/O bus
USB
controller
mouse keyboard

graphics
adapter

disk
controller

monitor
disk

Expansion slots for
other devices such
as network adapters.


Reading a Disk Sector: Step 1
CPU chip
register file
ALU

CPU initiates a disk read by writing a

command, logical block number, and
destination memory address to a port

(address) associated with disk controller.

main
memory

bus interface

I/O bus

USB
controller
mouse keyboard

graphics
adapter

disk
controller

monitor
disk


Reading a Disk Sector: Step 2
CPU chip
register file
ALU

Disk controller reads the sector and
performs a direct memory access (DMA)

transfer into main memory.

main
memory

bus interface

I/O bus

USB
controller
mouse keyboard

graphics
adapter

disk
controller

monitor
disk


Reading a Disk Sector: Step 3
CPU chip
register file
ALU

When the DMA transfer completes, the
disk controller notifies the CPU with an

interrupt (i.e., asserts a special “interrupt”
pin on the CPU)

main
memory

bus interface

I/O bus

USB
controller
mouse keyboard

graphics
adapter

disk
controller

monitor
disk


Direct Memory Access (DMA)

Operation of a DMA transfer


I/O Using DMA




Printing a string using DMA

a. code executed when the print system call is made
b. interrupt service procedure



×