Make your own free website on
Operating Systems 635-321

 McGill Conted


Advanced Search

animated computer crash by Denton

Corbis Images FALL 2000
Lecture Notes 7: Click here to download the course notes in zipped format.


Basic functions:

  • Tracking status of each device
  • Using preset policies to determine which process gets a device and for how long.
  • Allocating the devices
  • De-allocating temporarily when IO command has been executed
  • De-allocating permanently when job has run.

To do all its tasks, device manager has three conditions to fulfill:

  • Needs to know which components are busy and which are free
  • Must be able to accommodate the requests that come in during heavy IO traffic
  • Must accommodate the disparity of speeds between CPU and IO devices.

System's devices fall into three categories:

  • Dedicated

    • Assigned to only job at a time
    • Serve the job the entire time it's active
    • Device is not kept 100% active
    • Plotters, printer tape drive are examples

  • Shared

    • Can be assigned to several processes
    • A hard drive can be shared by several processes by means of interleaving
    • Interleaving must be controlled by the device manager using access policies

  • Virtual

    • Dedicated devices transformed to shared devices
    • E.g. printers converted to sharable via spooling - job only printed when printer is available and complete job saved on spool

Sequential access media

Magnetic tape was used routinely for secondary storage in early systems - as was paper.(punch cards)

Used still for back-ups on mainframe and some PC backup systems.

Typically 9 track eight bits and one parity. Various tape densities available e.g. 6250 bpi.

Tape needs time to start and stop - need IRG (inter-record gap) 1/2" long. Can take 51/2" inches to store 1" of data. Alternative is blocking. Then have an inter-block gap. Blocking requires special software used when creating the files, but improves tape efficiency.

Typical access times for 2400 foot tape with a speed of 200 inched per second:

21/2 minutes to read last record on tape.

11/2 minutes average access.

Direct Access Devices

Earliest direct access devices were drums. Resembled coffee can covered with magnetic film. Used on mainframes until 1970's. Had capacity of 1Mb and speed of 3000 rpm.

Modern hard drives:

  • Two or more platters that spin in unison
  • Read/write heads controlled by an actuator
  • Read/write heads move in unison as disks rotate

More efficient to fill up outside track of every surface and move inwards than to fill one platter and move to the next.

Concept of cylinder.

System needs to which surface, which cylinder and which allocation unit to read.

Each track has same # of allocation units so they get smaller as you move toward the centre. Accommodated by:

  • Write precompensation which speeds up writing of data to tracks near the centre.
  • Reduced write current uses a smaller current to place the magnetised spots on the disk because the spots are closer together.

Access time

Three components:

  • Seek time (arm movement)
  • Search time (rotational delay)
  • Transfer time (data transfer)

There are fixed head drives where each track has a read head, avoids seek time, faster but expensive.

Optical storage devices

High density, reliable storage. Surface is laid out as one continuous spiral of sectors of equal length that hold equal amounts of data. Data is stored as pits (recessed areas) and lands (raised areas) each representing 0 or 1 respectively. Surface is read by laser beam that distinguishes between pits and lands based on the scattering of the light when it hits the surface. Uses constant linear velocity (CLV) to alter the speed of the disk rotations so that it slows in the middle and speeds up in the centre.

Measures of performance are sustained data transfer rate (for sequential access like viewing a movie) and average access time (random access used for searching an encyclopedia). Look for the biggest value for data transfer rate and smallest number for average access time. Hardware cache size has an effect on perceived performance. Can be a read-ahead device as well as standard buffer.

I/O subsystem

IO channels (buses) are programmable unit placed between the slower control unit of the device and the faster CPU. They synchronize so that IO operations can overlap with processor operations so the CPU and IO can process concurrently. Channel sends one signal for each function. To begin an IO command, the CPU passes the following to the IO channel:

  • Specific IO command (e.g. read, write etc.)
  • Channel number
  • Location on IO device to be used
  • Starting address of memory to be used.

Many devices can use same channel as in SCSI (small computer system interface). Devices can communicate without going through CPU - e.g. backup device with hard drive.

Each unit in IO system can finish its operation independently of the other. E.g. after a device has begun writing a record and before it is finished, the connection between the device and its controller can be cut and another IO task can be initiated, and the CPU is free to process data while IO is being performed.

Success of all this depends on system's ability to know when a device has completed an operation. Done with hardware flag that is tested by CPU. Flag is 3 bits and is part of Channel Status Word which resides in main memory. Each bit represents one of the components of the IO subsystem, one for each channel, control unit and device. Each bit is changed from one to zero to indicate that the unit has changed from free to busy. Each component has to access the flag before proceeding to the next IO operation to ensure entire path is free. The flag is accessed two ways:


Uses special machine instructions to test flag. For example, CPU periodically tests channel status bit in CSW. If channel is still busy, continues some other processing task; if free channel performs the IO operation. Must decide how often polling will take place - if too much CPU wastes time, if too little, channel could sit idle.


More efficient way to test the flag. Instead of having CPU test, hardware does the test as part of every machine instruction executed by CPU. If the channel is busy, the flag is set so the execution of current sequence is interrupted and control is passed to the interrupt handler. Interrupt handler's job is to determine the best course of action. Finds out which unit sent the signal, start IO operation and return control to interrupted process.

Direct memory access(DMA) is an IO technique that lets control unit access main memory. A device can request a DMA channel. A chip on the systemboard houses the DMS logic. The chip provides channels that a device can use for fact access to memory- done by bypassing CPU. Only certain devices can use DMA (mostly hard drives)


  • Used to deal with speed differences between devices and CPU.
  • Temporary storage areas residing throughout the system.
  • Typically used to store data read from an input device before it is needed by CPU and store data that will be written to an output device. Even double buffering is used to avoid any possible waiting by resources.

MS-DOS device management

MS-DOS - created for simple systems that include keyboard, monitor, printer, one or two serial ports.

  • One of each type of IO device per port.
  • Each device has dedicated control unit and uses a specific port.
  • Devices do not need special management from the operating system. All the device manager need are device drivers. A device driver is a piece of software that controls an IO device and handles its interrupts.
  • Basic device driver program is loaded during booting and extended driver then load into memory from disk.
  • Programs with standard DOS and BIOS interface for system-dependent functions can be used on any DOS machine regardless of manufacturer.


Group of programs permanently stored on a ROM chip - manages the most fundamental communications between software and hardware. Two functions are:

  • Gather configuration information and initialize the computer when it is first turned on. BIOS runs a set of programs called power-on self test (POST)This involves:
    • Testing the CPU
    • Testing RAM
    • Inventorying hardware and comparing results to configuration information
    • Configuring disk drives, hard drives, keyboard, monitor and ports.
    • Running CMOS set up if requested.
    • Loading into memory and turning control to OS.
  • Provide software to communicate directly with various hardware components when the OS is functioning.
    • System BIOS is the term used for this software.
    • E.g. keyboard is controlled by BIOS program stored in ROM that is copied into memory by ROM BIOS Start-Up program and is then used to service the keyboard.
    • Other System BIOS services are provided by chips on supporting circuit board - called on-board BIOS. E.g. software on a video card.
    • Some devices do not have dedicated BIOS programs. E.g. mouse; its driver is stored on hard drive as mouse.sys - copied into memory during booting and mouse controlled from this program in memory. Major difference between device drivers and dedicated BIOS programs is the locations in which they stored when the computer is turned off.
    • Drivers are loaded into memory via CONFIG.SYS. CONFIG.SYS is loaded into memory by MSDOS.SYS which is a hidden file that is run when a disk is booted. CONFIG.SYS is the first thing encountered by a DOS machine that you, the user, can change.

Typical command in CONFIG.SYS might be:


Tells DOS to look in a particular directory named SCANGAL on drive C find the file, copy it into memory. The memory location assigned is written onto the IO table so that requests can be handled and the correct memory location accessed.

The program will handle requests to use the scanner.


When a hardware device needs the CPU to do something, the device passes a number - interrupt request number (IRQ). A device requires an IRQ if it can initiate a request or provide input.

CPU finds what to do using IO address table (interrupt vector table) . This gives the CPU the location of the device driver. The device driver is used by the CPU to interpret the instructions it has received.


UNIX is completely device independent.

  • Each IO device as a special type of file (other OS's control devices with hard coded program built into each device)
  • Every device installed in a UNIX system assigned a name like that given to any file, but it is also given "descriptors"
  • Descriptors identify devices and contain information about them

UNIX OS contains device drivers for most common peripherals. Config program will automatically create a conf.c file for any given hardware configuration. This file contains parameters that control resources.

IO system divided into two

  • Block IO
  • Character IO

Each physical device is identified by :

  • Class (block or character)
  • Major device number (major device types)
  • Minor device number (individual devices)

Block IO is for printers and communication lines

Character IO is for drives.



All content © 2000-2001 Ann Logan - Web Site © 2000-2001 Carol Busato
Please address your comments and inquiries to

Last updated April 7, 2001