IO

Protocol Variants

Mist devices have a status register (if it's doing a transfer.

Usually interrupts will be more efficient

PIO vs. DMA

Programmed IO - PIO

For every word or byte of data that gets transferred the operating system has to put in an instruction for each. Keyboards will usually used PIO since not much data is necessary to transfer.

DMA

Large sizes of data being transferred. For large magnetic disk drives DMA is always used. A block is typically 512 bytes. An interrupt will be raised to let the operating system know that the operation was completed.

Special Instructions vs Memory Mapped IO

Special Instructions

There are instructions in the instruction set architecture (ISA). There are some ISA that have special set of instructions for IO.

Memory Mapped IO

All devices on the system are mapped to memory in the proccesor's address space. Thus special IO instructions are not needed. Thus X86 instructions for moving can be used to move data from a register to a devices register.

It doesn't really matter which is done in a given architecture. They both can work equally well.

Device Driver

Suffices to create an abstraction for the variety of devices and allow data to be sent and received by the device without the operation system adding extra code. 70% of an OS is device drivers.

Basic Interface

Magnetic drives have moving parts. One or more platter inside the drive, that are covered with magnetic films. A spindle is in the middle and the platter rotates around the spindle. Each surface is divided into rings called tracks. The tracks are divided into numbered sectors numbered from the inner most track to the outer most track.

Positioning

The platters are not perfectly align or perfectly concentric. It is difficult to put the head over the track.

Time To Read

Seek Time

Time it takes to position the head over the track. It has to be accelerated nad allowed to settle. Takes typically 4-10 ms.

Rotation Delay

Transfer Time

Skew

Zones

Cache

I/O Schedulers

FCFS (First Come First Serve)

SPTF (Shortest Positioning Time First)

SSTF (Shortest Seek Time First)

SCAN (Elevator Algorithm)

Circular Scan

LOOK

Types of Schedulers

Work Conserving

Non-Work Conserving