COA Chapter 5-7
COA Chapter 5-7
COA Chapter 5-7
CHAPTER - 5
MEMORY ORGANIZATION
5.1 Memory Hierarchy
Memory hierarchy in a computer system is shown in the figure below. Memory Hierarchy is to
obtain the highest possible access speed while minimizing the total cost of the memory system.
Figure: Memory
hierarchy in a computer
system
Memory
hierarchy in a
computer
system:
Main
Memory
:
memory
unit that
communicates directly with the CPU (RAM)
Auxiliary Memory: device that provide backup storage (Disk Drives)
Cache Memory: special very-high-speed memory to increase the processing
speed (Cache RAM)
Multiprogramming: enables the CPU to process a number of independent programs
concurrently.
Memory Management System: supervises the flow of information between auxiliary
memory and main memory.
5.2 Main Memory
It is the memory unit that communicates directly with the CPU.
It is the central storage unit in a computer system
It is relatively large and fast memory used to store programs and data during the
computer operation.
a) RAM Chips
RAM is used for storing the bulk of the programs and data that are subject to change.
Available in two possible operating modes:
1. Static RAM- consists essentially of internal flip-flops that store binary information.
2. Dynamic RAM – stores the binary information in the form of electric charges that are
applied to capacitors.
1|Page
BHU Department of Computer Science
5.3 Auxiliary Memory(External memories-magnetic disks, magnetic tape and optical disks)
Auxiliary memory is devices that provide backup storage.
The most common auxiliary memory devices used in computer systems are:
Magnetic Disk: a memory device consisting of a flat disk covered with a magnetic
coating on which information is stored ex: HDD(Hard Disk Drive)- computer hardware
that holds and spins a magnetic or optical disk and reads and writes information on it
Magnetic Tape: Memory device consisting of a long thin plastic strip coated with iron
oxide; used to record audio or video signals or to store computer information
Optical Disk: a disk coated with plastic that can store digital data as tiny pits etched in
the surface; is read with a laser that scans the surface, CDR- compact disk on which you
can write only once and thereafter read only memory, ODD, DVD
5.4 Cache Memory
Cache memory is a small fast memory and is sometimes used to increase the
speed of processing by making current programs and data available to the CPU
at a rapid rate.
Keeping the most frequently accessed instructions and data in the fast cache memory
Locality of Reference: the references to memory tend to be confined within a few
localized areas in memory.
The basic operation of the cache is as follows.
When the CPU needs to access memory, the cache is examined. If the word is found in
the cache, it is read from the fast memory.
If the word addressed by the CPU is not found in the cache, the main memory is
accessed to read the word.
A block of words containing the one just accessed is then transferred from main memory
to cache memory.
Hit ratio: is the quantity used to measure the performance of cache memory.
The ratio of the number of hits divided by the total CPU references (hits plus misses) to
memory.
Hit: the CPU finds the word in the cache (0.9)
Miss: the word is not found in cache (CPU must read main memory)
Example: A computer with cache memory access time = 100 ns, main memory access time =
1000 ns, hit ratio = 0.9
1 ns miss: 1 x 1000ns
9 ns hit: 9 x 100ns
1900ns/10 = 190ns - average access
Mapping is the transformation of data from main memory to the cache memory.
There are three types mapping process:
1. Associative mapping
2. Direct mapping
3. Set-associative mapping
4. Example of cache memory
4|Page
BHU Department of Computer Science
Operation
The CPU generates a memory request with the index field which is used for the address
to access the cache.
The tag field of the CPU address is compared with the tag in the word read from the
cache.
If the two tags match, there is a hit and the desired data word is in cache.
If there is no match, there is miss and the required word is read from main memory.
It is then stored in the cache together with the new tag replacing the previous value.
Example: Consider the numerical example of Direct Mapping shown in figure below
The direct-mapping example just described uses a block size of one word. The same
organization but using a block size of 8 words is shown in figure below.
6|Page
BHU Department of Computer Science
7|Page
BHU Department of Computer Science
CHAPTER- 6
INPUT/OUTPUT ORGANIZATION
6.1 Peripheral Devices
Peripheral devices are the I/O devices that are externally connected to the machine to read or
write information.
Input Devices
Keyboard
Optical input devices
Magnetic Input Devices- Magnetic Stripe Reader
Screen Input Devices
- Touch Screen- Light Pen- Mouse
Analog Input Devices
Output Devices
Card Puncher, Paper Tape Puncher
CRT
Printer (Impact, Ink Jet, Laser, Dot Matrix)
Plotter
Analog
6.2 Input-Output Interface
1. Use two separate buses, one for memory and the other for I/O.
2. Use one common bus for both memory and I/O but have separate control lines
for each.
3. Use one common bus for memory and I/O with common control lines.
I/O Mapping
Two types of I/O mapping:
1. Isolated I/O
2. Memory-Mapped I/O
Isolated I/O
Separate I/O read/write control lines in addition to memory read/write control lines
Separate (isolated) memory and I/O address spaces
Distinct input and output instructions
Memory-Mapped I/O
A single set of read/write control lines (no distinction between memory and I/O transfer)
Memory and I/O addresses share the common address space ( reduces memory
address range available
No specific input or output instruction (the same memory reference instructions can be
used for I/O transfers
Considerable flexibility in handling I/O operations
1. Synchronous -All devices derive the timing information from common clock line
2. Asynchronous -No common clock
Asynchronous data transfer
Asynchronous data transfer between two independent units requires that control signals
be transmitted between the communicating units to indicate the time at which data is
being transmitted
10 | P a g e
BHU Department of Computer Science
Source-Initiated: the source unit that initiates the transfer has no way of knowing
whether the destination unit has actually received data.
Destination-Initiated: The destination unit that initiates the transfer no way of knowing
whether the source has actually placed the data on the bus.
There four different data transfer modes between the central computer (CPU & Memory) and peripherals:
1) Programmed-Controlled I/O
2) Interrupt-Initiated I/O
3) Direct Memory Access (DMA)
4) I/O Processor (IOP)
Programmed-Controlled I/O (I/O devices to CPU)
Transfer of data under programmed I/O is between CPU and peripherals
Programmed I/O operations are the result of I/O instructions written in the computer
program.
An example of data transfer from an I/O device through an interface into the CPU is
shown in the following figure:
11 | P a g e
BHU Department of Computer Science
12 | P a g e
BHU Department of Computer Science
Command:
Instruction that are read form memory by an IOP
Distinguish from instructions that are read by the CPU
Commands are prepared by experienced programmers and are stored in
memory
Command word = IOP program
CPU - IOP Communication
Memory units acts as a message center: Information
Each processor leaves information for the other
13 | P a g e
BHU Department of Computer Science
I/O Channel
Start I/O, Start I/O fast release (less CPU time), Test I/O, Clear I/O, Halt I/O, Halt
device, Test channel, Store channel ID
Channel Status Word:
Always stored in Address 64 in memory
Key: Protection used to prevent unauthorized access
Address: Last channel command word address used by channel
Count: 0 (if successful transfer)
14 | P a g e
BHU Department of Computer Science
Identify the source of the interrupt when several sources will request service
simultaneously
Determine which condition is to be serviced first when two or more requests arrive
simultaneously
Priority interrupt can be done by:
1) Software: Polling
2) Hardware: Daisy chain, Parallel priority
Polling
Identify the highest-priority source by software means
One common branch address is used for all interrupts
Program polls the interrupt sources in sequence
The highest-priority source is tested first
Polling priority interrupt occurs:
If there are many interrupt sources, the time required to poll them can exceed the
time available to service the I/O device
Hardware priority interrupt
Daisy-Chaining
Either a serial or a parallel connection of interrupt lines can establish the hardware
priority function.
The serial connection is known as the daisy- chaining method.
15 | P a g e
BHU Department of Computer Science
The following figure shows one stage of the daisy-chain priority arrangement:
Serial communication is used for all long-distance communication and most computer
networks
Slow data transfer
Parallel communication: is the process of transferring the whole data bits over
communication channel or computer bus simultaneously.
16 | P a g e
BHU Department of Computer Science
CHAPTER - 7
PIPELINE AND VECTOR PROCESSING
7.1 Parallel processing
Parallel processing is a term used to denote a large class of technique that are used to
provide simultaneous data processing tasks for the purpose of increasing computational
speed of a computer system.
A parallel processing system is able to perform concurrent data processing to achieve
faster execution time.
Example: While an instruction is being executed in the ALU, the next instruction can be
read from memory.
System may have two or more ALU to execute two or more executions at the same
time.
The purpose of parallel processing is to speed up the computer processing capability
and increase its throughput which is the amount of processing that can be interval of
time.
17 | P a g e
BHU Department of Computer Science
Parallel processing is established by distributing the data among the multiple functional
units.
Figure below shows one possible way of separating the execution unit into eight
functional units operating in parallel.
18 | P a g e
BHU Department of Computer Science
19 | P a g e
BHU Department of Computer Science
20 | P a g e
BHU Department of Computer Science
21 | P a g e
BHU Department of Computer Science
3. Branch difficulties arise from branch and other instructions that change the value
of PC.
7.2.3 RISC Pipeline
The reduced instruction set computer (RISC) is its ability to use an efficient instruction
pipeline.
RISC is a machine with a very fast clock cycle that executes at the rate of one
instruction per cycle.
Simple Instruction Set
Fixed Length Instruction Format
Register-to-Register Operations
A: ALU operation
E: Execute instruction
The product matrix C is a 3 x 3 matrix whose elements are related to the elements of A
and B by the inner product:
23 | P a g e
BHU Department of Computer Science
For example, the number in the first row and first column of matrix C is calculated by
letting i=1, j=1, to obtain
b) Memory Interleaving
Memory interleaving is the technique of using memory from two or more sources. An
instruction pipeline may require the fetching of instruction and an operand at the same
time from two different segments .Similarly, an arithmetic pipeline usually requires two
or more operands to enter the pipeline at the same time instead of using two memory
buses simultaneous access the memory can be partitioned into a number of modules
connected to a common memory address and data buses.
25 | P a g e
BHU Department of Computer Science
26 | P a g e