1 of 28

Computer Organization and Architecture

Module IV:I/O Systems

Name: Prof.Reshma Kohad

2 of 28

I/O Organization

I/O devices

  • Input-Output Interface is used as a method which helps in transferring information between the internal storage devices, i.e., memory, and the external peripheral device.
  • A peripheral device provides input and output for the computer; it is also called an Input-Output device.
  • For Example, A keyboard and mouse, which provide input to the computer, are called input devices while a monitor and printer provide output to the computer, are called output devices.
  • Just like the external hard drives, there is also availability of some peripheral devices which are able to provide both input and output.

3 of 28

Functions of Input-Output Interface:�

  1. It is used to synchronize the operating speed of CPU with respect to input-output devices.
  2. It selects the input-output device which is appropriate for the interpretation of the input-output signal.
  3. It is capable of providing signals like control and timing signals.
  4. In this data buffering can be possible through data bus.
  5. There are various error detectors.
  6. It converts serial data into parallel data and vice-versa.
  7. It also convert digital data into analog signal and vice-versa.

4 of 28

I/O devices and controllers

  • In computer systems, I/O devices do not usually communicate with the operating system.
  • The operating system manages their task with the help of one intermediate electronic device called a device controller. 
  • Input devices are those devices that generate data to give input to the computer system. Examples- mouse, trackball, keyboard, CD-ROM.
  • Output devices accept data from the computer system. Examples- printer, graphics display screen, plotter.
  • Input/Output (I/O devicesdevices can give data as input and receive output as data from the computer system. Examples- disk, tape, writable CD.

5 of 28

  • The device controller knows how to communicate with the operating system as well as how to communicate with I/O devices.
  • So device controller is an interface between the computer system (operating system) and I/O devices.
  • The device controller communicates with the system using the system bus. So how the device controller, I/O devices, and the system bus is connected is shown below in the diagram

6 of 28

  • In the above diagram, some IO devices have DMA (Direct Memory access) via device controllers and some of them do not have DMA.
  • The devices which have a DMA path to communicate with the system to access memory are much faster than devices that have a non-DMA path to access the memory.
  • The devices have a non-DMA path via the device controller to access the memory, they have to go from the processor which means it will be scheduled by the scheduler and then when it gets loaded into RAM then it will get the CPU to execute its instruction to access memory so it is slow from devices which has a DMA.

7 of 28

  • A device controller generally can control more than one I/O device but it is most common to control only a single device.
  • Device controllers are stored in the chip and that chip is attached to the system bus there is a connection cable from the controller to each device which is controlled by it.
  • Generally, one controller controls one device.
  • The operating system communicates with device controllers and the device controller communicates with devices so indirectly operating system communicates with IO devices. 

8 of 28

I/O Buses

  • What is a Computer Bus?
  • A computer bus is a communication system used to transfer data between components within a computer or between different computers.
  • It plays an important role in minimizing the number of connections needed by centralizing communication over shared pathways.
  • It consists of physical connections like wires, circuits, or cables.
  • Components like the CPU, memory, and input/output (I/O) devices are connected through a bus.
  • It simplifies data transfer and improves efficiency.

9 of 28

�Types Of Buses�

  • There are three main types of buses in a computer system, which are discussed below:�

10 of 28

�1. Address Bus�

  • A collection of wires used to identify particular location in main memory is called Address Bus.
  • The information used to describe the memory locations travels along the address bus.
  • The address bus transports memory addresses which the processor wants to access in order to read or write data..
  • The address bus is unidirectional.
  • The size of address bus determines how many unique memory locations can be addressed.

  • Example:

  • A system with 4-bit address bus can address 24 = 16 Bytes of memory.
  • A system with 16-bit address bus can address 216 = 64 KB of memory
  • A system with 20-bit address bus can address 220 = 1 MB of memory.

11 of 28

2. Data Bus�

  • A collection of wires through which data is transmitted from one part of a computer to another is called Data Bus.
  • It can be thought of as a highway on which data travels within a computer.
  • The main objective of data bus is transfer of the data between microprocessor to input/ output devices or memory.
  • The data bus transfers instructions coming from or going to the processor.
  • The data bus is bidirectional because the data can flow in either direction from CPU to memory(or input/output device) or from memory to the CPU.
  • The size (width) of bus determines how much data can be transmitted at one time.
  • Example:
  • A 16-bit bus can transmit 16 bits of data at a time.
  • 32-bit bus can transmit 32 bits at a time.

12 of 28

�3. Control Bus�

  • The connections that carry control information between the CPU and other devices within the computer is called Control Bus.
  • The control bus transports orders and synchronization signal coming from the control unit and travelling to all other hardware components
  • The main objective of control bus is all signals controller carried from processor to other hardware device.
  • The Control bus is bidirectional because the data can flow in either direction from CPU to memory(or input/output device) or from memory to the CPU.
  • It also transmits response signals from the hardware.

13 of 28

Mode of Transfer�

  • The binary information that is received from an external device is usually stored in the memory unit. CPU merely processes the information but the source and target is always the memory unit. Data transfer between CPU and the I/O devices may be done in different modes:
  • Programmed I/O.
  • Interrupt- initiated I/O.
  • Direct memory access( DMA).

14 of 28

Programmed I/O�

  • In this each data item transfer is initiated by an instruction in the program.
  • Usually the transfer is from a CPU register and memory.
  • In this case it requires constant monitoring by the CPU of the peripheral devices.
  • In this case, the I/O device does not have direct access to the memory unit.
  • A transfer from I/O device to memory requires the execution of several instructions by the CPU
  • Including an input instruction to transfer the data from device to the CPU and store instruction to transfer the data from CPU to memory.

15 of 28

16 of 28

Interrupt-Initiated I/O�

  • Since in the above case we saw the CPU is kept busy unnecessarily. This situation can very well be avoided by using an interrupt driven method for data transfer.
  • By using interrupt facility and special commands to inform the interface to issue an interrupt request signal whenever data is available from any device.

Steps:

  • In the meantime the CPU can proceed for any other program execution.
  • The interface meanwhile keeps monitoring the device.
  • Whenever it is determined that the device is ready for data transfer it initiates an interrupt request signal to the computer.
  • Upon detection of an external interrupt signal the CPU stops momentarily the task that it was already performing, branches to the service program to process the I/O transfer and then return to the task it was originally performing.
  • The I/O transfer rate is limited by the speed with which the processor can test and service a device.
  • The processor is tied up in managing an I/O transfer; a number of instructions must be executed for each I/O transfer.

17 of 28

�Direct Memory Access�

  • The data transfer between a fast storage media such as magnetic disk and memory unit is limited by the speed of the CPU.
  • Thus we can allow the peripherals directly communicate with each other using the memory buses, removing the intervention of the CPU.
  • 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. Bus grant request time.
  • Transfer the entire block of data at transfer rate of device because the device is usually slow than the speed at which the data can be transferred to CPU.
  • Release the control of the bus back to CPU So,
  • Total time taken to transfer the N bytes = Bus grant request time + (N) * (memory transfer rate) + Bus release control time.
  • Buffer the byte into the buffer & Inform the CPU that the device has 1 byte to transfer (i.e. bus grant request)
  • Transfer the byte (at system bus speed) & Release the control of the bus back to CPU.

18 of 28

19 of 28

Memory-mapped I/O

  • In a memory-mapped I/O system, there are no special input or output instructions.
  • Instead, the CPU uses the same instructions it uses for memory (like LOAD and STORE) to access I/O devices.

  • Each I/O device is assigned a specific address in the regular memory address space.
  • Devices are connected through interface registers, which act like memory locations.
  • When the CPU wants to read from or write to an I/O device, it accesses the corresponding address, just like it would access a memory word.
  • These interface registers respond to normal read/write operations as if they were memory cells.

20 of 28

�Advantages of Memory-Mapped I/O�

  • Faster I/O Operations: Memory-mapped I/O allows the CPU to access I/O devices using the same mechanism and speed as regular memory access. This results in faster I/O operations compared to isolated I/O.
  • Simplified Programming: Since the same instructions are used for both memory and I/O operations, programming becomes easier. Developers do not need to learn or use special I/O instructions, reducing complexity.
  • Efficient Use of Address Space: Memory-mapped I/O enables I/O devices to share the same address space as memory. This can make the system more efficient, especially in systems with a unified memory model.

21 of 28

Disadvantages of Memory-Mapped I/O

  • Limited I/O Address Space: Because memory and I/O devices share the same address space, the number of available addresses for I/O devices is limited. This can be a problem in systems with many peripherals.
  • Potential Performance Issues: If an I/O device responds slowly, it may delay the CPU when accessing that memory-mapped region. This can affect overall system performance, especially in time-sensitive tasks.

22 of 28

��Disk Systems: Disk structure and operation.

  • Disk systems, particularly Hard Disk Drives (HDDs), use rotating magnetic platters, read/write heads, and a spindle to store data in concentric tracks, which are further divided into sectors.
  • Operations involve moving an actuator arm to the correct track (seek time) and waiting for the data to rotate under the head (rotational latency), managed by the operating system for efficiency. 
  •  

23 of 28

Disk Structure

  • Platters: Circular discs coated with magnetic material that store data, stacked on a central spindle.
  • Tracks: The surface of each platter is divided into concentric circles, known as tracks.
  • Sectors: Each track is subdivided into smaller sectors, which are the smallest physical storage unit, often 512 bytes or 4 KB.
  • Cylinders: A cylinder is a vertical stack of tracks at the same position across all platter surfaces.
  • Read/Write Heads: Attached to a disk arm, these read and write data to the surfaces of the platters.
  • Actuator Assembly: Moves the read/write heads to the desired track. 

24 of 28

Disk Structure

  • 1. Platters
  • Rigid circular disks coated with magnetic material
  • Mounted on a spindle and rotate at constant speed
  • 2. Tracks
  • Concentric circles on each platter surface
  • Each track stores data
  • 3. Sectors
  • Tracks are subdivided into sectors
  • Each sector contains a fixed number of bytes (typically 512 bytes or 4 KB)
  • Sector is the basic unit of data transfer

25 of 28

  • . Cylinder
  • Set of tracks aligned vertically across all platters
  • Important for optimizing disk access (no head movement required within a cylinder)
  • 5. Read/Write Heads
  • One head per platter surface
  • Positioned over tracks to read/write data
  • 6. Head Movement Mechanism
  • All heads move together via an actuator
  • Only one track per surface is accessed at a time

26 of 28

Disk Operation

  • Rotation: A motor spins the platters at high speeds (e.g., 60-250 rotations per second), measured in RPM (Rotations Per Minute).
  • Data Transfer: The head reads/writes data as it passes underneath.
  • Random Access Time: This is the sum of:
  • Access Time=Seek Time+Rotational Latency+Transfer Time
    • Seek Time: The time taken for the arm to move the head to the specific track.
    • Rotational Latency: The time needed for the target sector to rotate under the head.
  • Data Transfer Rate: The speed at which data is moved from the disk to the computer. 

27 of 28

OPERATION

  • 1. Seek Time (Ts)
  • Time required to move the head to the desired track
  • Dominant factor in disk performance
  • Depends on distance between tracks

  • 2. Rotational Delay (Tr)
  • Time for the desired sector to rotate under the head
  • Average rotational delay:
  • Tr=1/2r
  • ​ Where r = rotation speed (revolutions per second)

28 of 28

  • 3. Transfer Time (Tt)
  • Time to read/write data once the sector is positioned
  • Tt=b/rN​
  • Where:
  • b = number of bytes to transfer
  • r = rotation speed
  • N = number of bytes per track

  • 4.Total Access Time
  • Ta=Ts+Tr+Tt
  • This is the total time to service a disk I/O request.