Unit 4
Unit 4
Architecture
SUBJECT CODE: 203105253
UNIT 4
Prepared By
Trilok Suthar
1
PERIPHERAL DEVICES AND THEIR CHARACTERISTICS::
Input-output subsystems, I/O device interface, I/O transfers-program
controlled, interrupt driven and DMA, privileged and non-privileged
instructions, software interrupts and exceptions. Programs
and processes-role of interrupts in process state transitions, I/O
device interfaces -SCSI, USB
2
Input-output subsystems
3
Peripheral Devices
5
• The I/O Bus consists of data lines, address lines and control lines.
The I/O bus from the processor is attached to all peripherals
interface.
• To communicate with a particular device, the processor places a
device address on address lines. Each Interface decodes the
address and control received from the I/O bus, interprets them for
peripherals and provides signals for the peripheral controller.
• It is also synchronizes the data flow and supervises the transfer
between peripheral and processor. Each peripheral has its own
controller.
6
• For example, the printer controller controls the paper motion, the print
timing. The control lines are referred as I/O command. The commands
are as following:
Control command- A control command is issued to activate the
peripheral and to inform it what to do.
Status command- A status command is used to test various status
conditions in the interface and the peripheral.
Data Output command- A data output command causes the
interface to respond by transferring data from the bus into one of its
registers.
Data Input command- The data input command is the opposite of the
data output.
• In this case the interface receives on item of data from the peripheral
and places it in its buffer register. I/O Versus Memory Bus
7
• There are 3 ways that computer buses can be used to communicate
with memory and I/O:
1. Use two Separate buses, one for memory and other for I/O.
2. Use one common bus for both memory and I/O but separate control
lines for each.
3. Use one common bus for memory and I/O with common control
lines
8
Modes of I/O Data Transfer
9
Programmed I/O
10
Drawback of the Programmed I/O:
The main drawback of the Program Initiated I/O was that the
CPU has to monitor the units all the times when the program
is executing.
Thus the CPU stays in a program loop until the I/O unit
indicates that it is ready for data transfer.
This is a time consuming process and the CPU time is
wasted a lot in keeping an eye to the executing of program.
11
Interrupt Driven I/O
• In the programmed I/O method the CPU stays in the program loop
until the I/O unit indicates that it is ready for data transfer. This is time
consuming process because it keeps the processor busy needlessly.
12
Direct Memory Access
• Removing the CPU from the path and letting the peripheral device
manage the memory buses directly would improve the speed of
transfer. This technique is known as DMA.
• In this, the interface transfer data to and from the memory through
memory bus. A DMA controller manages to transfer data between
peripherals and memory unit.
• Many hardware systems use DMA such as disk drive controllers,
graphic cards, network cards and sound cards etc. It is also used for
intra chip data transfer in multicore processors. In DMA, CPU would
initiate the transfer, do other operations while the transfer is in
progress and receive an interrupt from the DMA controller when the
transfer has been completed.
13
• DMA Controller
• Interface which allows I/O transfer directly between memory and
Device, freeing CPU for Other tasks
• CPU initializes DMA Controller by sending memory address and the
block size (number of words)
14
15
• Bus Request : It is used by the DMA controller to request the CPU to
hand over the control of the buses.
• Bus Grant : It is activated by the CPU to Inform the external DMA
controller that the buses are in high impedance state and the
requesting DMA can take control of the buses. Once the DMA has
taken the control of the buses it transfers the data. This transfer can
take place in many ways.
• Types of DMA transfer using DMA controller:
• Burst Transfer :
DMA returns the bus after complete data transfer. A register is used as
a byte count, being decremented for each byte transfer, and upon the
byte count reaching zero, the DMAC will release the bus. When the
DMAC operates in burst mode, the CPU is halted for the duration of the
data transfer.
16
Block Diagram of DMA
17
privileged and non-privileged instructions
18
Privileged Instructions
• The Instructions that can run only in Kernel Mode are called
Privileged Instructions
• Privileged Instructions possess the following characteristics :
• (i) If any attempt is made to execute a Privileged Instruction in User
Mode, then it will not be executed and treated as an illegal
instruction. The Hardware traps it to the Operating System.
• (ii) Before transferring the control to any User Program, it is the
responsibility of the Operating System to ensure that the Timer is set
to interrupt. Thus, if the timer interrupts then the Operating System
regains the control.
Thus, any instruction which can modify the contents of the Timer is a
Privileged Instruction.
• (iii) Privileged Instructions are used by the Operating System in order
to achieve correct operation.
19
(iv) Various examples of Privileged Instructions include:
• I/O instructions and Halt instructions
• Turn off all Interrupts
• Set the Timer
• Context Switching
• Clear the Memory or Remove a process from the Memory
• Modify entries in Device-status table
20
Non-Privileged Instructions
• The Instructions that can run only in User Mode are called Non-
Privileged Instructions .
• Various examples of Non-Privileged Instructions include:
• Reading the status of Processor
• Reading the System Time
• Generate any Trap Instruction
• Sending the final printout of Printer
21
software interrupts and exceptions
22
Software Interrupt
23
Programs and processes-Role of Interrupts in process state
transitions
24
Role of Interrupts in process state transitions
25
26
I/O device interfaces-
SCSI, USB
27
I/O device interfaces-SCSI
28
• A controller connected to a SCSI bus is one of two types – an initiator or
a target. An initiator has the ability to select a particular target and to
send commands specifying the operations to be performed.
Clearly, the controller on the processor side, such as the SCSI
controller, must be able to operate as an initiator. The disk controller
operates as a target.
• It carries out the commands it receives from the
initiator. The initiator establishes a logical connection with the intended
target. Once this connection has been established, it can be suspended
and restored as needed to transfer commands and bursts of data.
While a particular connection is suspended, other device can use the
bus to transfer information.
• This ability to overlap data transfer requests is one of the key features
of the SCSI bus that leads to its high performance.
29
• Data transfers on the SCSI bus are always controlled by the target
controller. To send a command to a target, an initiator requests control
of the bus and, after winning arbitration, selects the controller it wants
to communicate with and hands control of the bus over to it.
30
• The processor sends a command to the SCSI controller, which causes
the following sequence of event to take place:
• 6. The target transfers the contents of the data buffer to the initiator
and then suspends the connection again. Data are transferred either
8 or 16 bits in parallel, depending on the width of the bus.
32
• 7. The target controller sends a command to the disk drive to perform
another seek operation. Then, it transfers the contents of the second
disk sector to the initiator as before. At the end of these transfers, the
logical connection between the two controllers is terminated.
•
8. As the initiator controller receives the data, it stores them into the
main memory using the DMA approach.
•
9. The SCSI controller sends as interrupt to the processor to inform it
that the requested operation has
been completed.
33
USB
34
USB Structure
• A serial transmission format has been chosen for the USB because a
serial bus satisfies the low-cost and flexibility requirements.
35
• The tree structure enables many devices to be connected while
using only simple point-to-point serial links.
36
37
USB Protocols:
The information transferred on the USB can be divided into two broad
categories: control and data.
Control packets perform such tasks as addressing a device to initiate
data transfer, acknowledging that data have been received correctly, or
indicating an error.
Data packets carry information that is delivered to a device. For example,
input and output data are transferred inside data packets
38
39
40
41
42