Sie sind auf Seite 1von 4

Assignment no.

2
Computer Organization and Assembly
Language
Submitted by:
Muhammad Awais

SP15-BCS-118

Zaid Waseem

SP15-BCS-106

Sarmad Javed

SP15-BCS-101

Submitted to:
Dr. Ashfaq Ahmed Farooqi

Q#1: What are the major functions of an I/O module?


Major functions of an I/O module are:
12345

Processor (CPU) communication.


Device communication.
Control and timing.
Error detection.
Data buffering.

CPU communication:

The I/O modules communicate with the processor. It accepts the commands which are sent by the
CPU. Data is also exchanged between the CPU and I/O modules. It provides the status of the I/O
module that the device is ready or busy etc. And it recognizes the unique address of each device it
controls.
Device communication:
The I/O module has to communicate with the device. That is command, status information and data.
Control and timing:
The I/O module must be able to handle the flow of data between internal (such as processor, memory)
and external devices.
Error detection:
The I/O module detects the error and reports them to the processor. The errors can be mechanical
(such as paper jam in a printer).
Data buffering:
As there is speed mismatch between the speed of data transfer between processor, memory and
external devices. So the data is buffered in I/O module and then sent to the peripheral devices at its
speed rate.
Q#2: List and briefly define three techniques for performing I/O.
There are three techniques for performing I/O.
1- Programmed
2- Interrupt driven
3- Direct Memory Access (DMA)
Programmed:
In this technique CPU has direct control over I/O.

The processor sends a command to the I/O module and the CPU waits for I/O module to complete
operation before proceeding further. It wastes CPU time.
Interrupt driven:
This technique overcomes the CPU waiting unlike the previous technique.
The CPU sends a command to I/O module. The module gets the data from peripheral device while CPU
does other work. And then I/O module interrupts the CPU when it is ready.
Direct Memory Access (DMA):
In previous techniques both require active CPU interference due to which transfer rate is slow but this
technique (DMA) allows devices to communicate directly with memory without passing data through
CPU.
Reference:
1- Notes by Mukesh Tekwani.
2- aturing.umcs.maine.edu/~meadow/courses/cos335/COA07.pdf
Q # 3. What is the difference between memory-mapped I/O and isolated I/O?
The devices of Isolated I/O are treated in a totally separate domain compared to the memory, on the
other hand Mapped I/O are treated as the part of the memory only.
Memory applications are allowed a total of 1 MB of address space in Isolated I/O, on the other hand
Mapped I/O do not allow memory applications to use whole 1 MB of memory.
Isolated I/O allows data transfer to only occur between the I/O Port and the AL, AX registers, on the
other hand Mapped I/O has a data transfer constraint in case of memory mapped instructions.
To take full advantage of the I/O operations, Isolated I/O sends separate instructions to perform
operations, on the other hand no separate external instructions are required for Mapped I/O.

Q # 4. When a device interrupt occurs, how does the processor determine which device issued the
interrupt?
The modern x86 processors use Advanced Programmable Interrupt Controller (APIC), that are integrated
in the CPU. The APIC asserts multiple interrupts individually and when a device generates an interrupt,
it is detected by the IO-APIC the device is connected to. The system operating system knows which IOAPIC is connected to which device, so it makes it easy for the processor to determine the device that
generated the interrupt.
Q # 5. When a DMA module takes control of a bus, and while it retains control of the bus, what does
the processor do?

While data transferring, sometimes DMA modules takes over the processor and takes the full control
over the system. There are two ways in which DMA performs the data transfer from the memory to the
bus.
1) Sometimes when the processor needs to perform the read/write function, it gives command to
the DMA using read/write control line. In this case DMA steals the cycles from the processor in
order to perform the data transfer. Meanwhile processor stops working until the process gets
completed and then continue working. The DMA effectively transfers one byte at time, after the
complete transfer of the data DMA sends an interrupt to the processor. The processor is only use
before and after transfer. This is known as cycle stealing.
2) Sometimes DMA used the bus when processor is not using it. The DMA monitors the execution
of the instruction, when DMA found any empty cycle during the execution it grabs the bus and
completes the transfer. In this process the processer keeps working smoothly. However, DMA
needs to complete the transfer before the processor moves to next cycle.

Das könnte Ihnen auch gefallen