Assignment 3
Assignment 3
Assignment 3
Chapter 4:
4.1 What are the differences among sequential access, direct access,
and random access?
Sequential access is accessing data in a specific linear sequence (example: tapes).
With random access, any location can be selected at random, and the addressable
locations in memory have a unique, physically wired-in addressing mechanism.
4.2 What is the general relationship among access time, memory cost,
and capacity?
As access time becomes faster, the cost per bit increases. As memory size increases,
the cost per bit is smaller. Also, with greater capacity, the access time becomes
slower.
a)
Address length: 16 bits
Word: 3 rightmost bits (as the block size if 8 bytes)
Line: 5 middle bits (as there are 32 lines)
Tag: 8 leftmost bits (as 16 – 3 – 5=8)
b)
0001 0001 0001 1011 ? line 3
1100 0011 0011 0100 ? line 6
1101 0000 0001 1101 ? line 3
1010 1010 1010 1010 ? line 21
c)
bytes with addresses 0001 1010 0001 1000
0001 1010 0001 1001
0001 1010 0001 1010
…
0001 1010 0001 1111
are stored in the cache.
d)
32 lines ? 8 bytes = 256 bytes
7.3 List and briefly define three techniques for performing I/O.
Programmed I/O: The processor issues an I/O command, on behalf of a process to
an I/O module; that process then busy-waits for the operation to be completed
before proceeding.
Interrupt-driven I/O: The processor issues an I/O command on behalf of a process,
continues to execute subsequent instructions, and is interrupted by the I/O module
when latter has completed its work.
Direct memory access: controls exchange of data between main memory and I/O
module.
7.4 What is the difference between memory mapped I/O and isolated
I/O?
with memory-mapped I/O, there is a single address space for memory locations and
I.O devices.
with isolated I/O, a command specifies whether the address refers to a memory
location or an I/O device.
7.5 When a device interrupt occurs, how does the processor determine
which device issued the interrupt?
multiple interrupt lines, software poll, daisy chain, bus arbitration.
7.6 When a DMA module takes control of a bus, and while it retains
control of the bus, what does the processor do?
the processor pauses for each cycle stolen by the DMA module.
7.7 For programmed I/O, Figure 7.5 indicates that the processor is stuck
in a wait loop doing status checking of an I/O device. To increase
efficiency, the I/O software could be written so that the processor
periodically checks the status of the device. If the device is not ready,
the processor can jump to other tasks. After some timed interval, the
processor comes back to check status again.
a)
b)
7.8 In virtually all systems that include DMA modules, DMA to main
memory is given higher priority than CPU access to main memory. Why?
The processor can wait a bit and not lose data. However, if the system does not
handle data coming from an I/O device, such as the network, the data may be lost.
Additionally, the DMA may be handling data that the CPU needs for a particular
process to continue execution.