Memory Hierarchy
Memory Hierarchy
Memory Hierarchy
(1) What is meant by the term “Memory Hierarchy”? What is the rationale for
having a memory hierarchy?
The largest block of ``memory'' in a modern computer system is usually one or more
large magnetic disks, on which data is stored in fixed size blocks of from 256 to 8192
bytes. This disk memory is usually connected directly to the main memory, and has a
variable access time depending on how far the disk head must move to reach the
appropriate track, and how much the disk must rotate to reach the appropriate sector
for the data. Some very large systems have multiple head disks which can read from
several tracks at once.
(2) Write short notes on the following terms related to memory and storage.
i. Latency
Latency is the period of time that one component in a system is spinning its wheels
waiting for another component. Latency, therefore, is wasted time. For example, in
accessing data on a disk, latency is defined as the time it takes to position the proper
sector under the read /write head.
The memory controller is a digital circuit which manages the flow of data going to
and from the main memory. It can be a separate as on the die of a microprocessor.
Memory controllers contain the logic necessary to read and write dynamic random
access memory (DRAM), and to "refresh" the DRAM by sending current through the
entire device. Without constant refreshes, DRAM will lose the data written to it as the
capacitors leak their charge within a fraction of a second
The memory bus is made up of two parts: the data bus and the address bus. When
people just make reference to "the memory bus" they are usually referring to the data
bus, which carries actual memory data within the PC. The address bus is used to
select the memory address that the data will come from or go to on a read or write.
Simply the memory bus is the set of wires that is used to carry memory addresses and
data to and from the system RAM
iv. Little-endian
Little-endian is a term that describes the order in which a sequence of bytes are stored
in computer memory. Little-endian is an order in which the "little end" (least
significant value in the sequence) is stored first.
v. Virtual Memory
Short for Random Access Memory, RAM, also known as main memory or system
memory, is a term commonly used to describe the memory within a computer. Today,
it takes the form of integrated circuits that allow stored data to be accessed in any
order.
A tape drive is a device that stores computer data on magnetic tape, especially for
backup and archiving purposes. Drives can be rewinding, where the device issues a
rewind command at the end of a session, or non-rewinding. Rewinding devices are
most commonly used when a tape is to be unmounted at the end of a session after
batch processing of large amounts of data.
iv. Registers
Registers are temporary memory units that store words. The registers are located in
the processor, instead of in RAM, so data can be accessed and stored faster. Processor
registers are at the top of the memory hierarchy, and provide the fastest way for a
CPU to access data. There are several types of CPU registers such as Program
Counter (PC), Instruction Register (IR), Accumulator (A), Flag Register (F), General
Purpose Register (GPR).
(4) What is Von Neumann Architecture?
The Von Neumann architecture is a computer design model that uses a processing
unit and a single separate storage structure to hold both instructions and data. Very
few computers have a pure von Neumann architecture. Most computers add another
step to check for interrupts, electronic events that could occur at any time.
An interrupt resembles the ring of a telephone, calling a person away from some
lengthy task. Interrupts let a computer do other things while it waits for events. Von
Neumann computers spend a lot of time moving data to and from the memory, and
this slows the computer. So, engineers often separate the bus into two or more busses,
usually one for instructions, and the other for data.
Simply we can say that The Von Neumann architecture is a design model for a stored-
program digital computer that uses a processing unit and a single separate storage
structure to hold both instructions and data. It is named after mathematician and early
computer scientist John von Neumann. Such a computer implements a universal
Turing machine, and the common "referential model" of specifying sequential
architectures, in contrast with parallel architectures. A stored-program digital
computer is one that keeps its program instructions as well as its data in read-write,
random access memory. Stored-program computers were advancement over the
program-controlled computers of the 1940s.
(6) Describe the structure of a CPU, providing details on the five major
components.
Control unit controls the operation of the CPU and rest of the machine. The control
unit is a finite state machine that takes as its inputs the IR, the status register and the
current major state of the cycle. Its rules are encoded either in random logic, a
Programmable Logic Array (PLA), or Read-Only Memory (ROM), and its outputs are
sent across the processor to each point requiring coordination or direction for the
control unit.
(iii)Flag Register
The flag register is the status register that contains the current state of the processor.
This register is 16-bits wide. Its successors, the EFLAGS and RFLAGS registers are
32-bits and 64-bits wide, respectively. The wider registers retain compatibility with
their smaller predecessors.
(iv) Accumulator
Program counter holds the address of either the first byte of the next instruction to be
fetched for execution or the address of the next byte of a multi byte instruction, which
has not been completely fetched. In both the cases it gets incremented automatically
one by one as the instruction bytes get fetched. Also Program register keeps the
address of the next instruction.
(7) Discuss the roles of MAR and MBR in the memory access process.
MAR
MAR stand for the Memory Address Register. This holds the address of the memory
word being referenced. All execution steps begin with PC - MAR.
MBR
MBR stand for the Memory Buffer Register, also called MDR (Memory Data
Register).
This holds the data being read from memory or written to memory
Fetch-Execute Cycle is the sequence of actions that a central processing unit performs
to execute each machine code instruction in a program.
At the beginning of each cycle the CPU presents the value of the program counter on
the address bus. The CPU then fetches the instruction from main memory.
From the instruction register, the data forming the instruction is decoded and passed
to the control unit which sends a sequence of control signals to the relevant function
units of the CPU to perform the actions required by the instruction such as reading
values from registers, passing them to the ALU to add them together and writing the
result back to a register. The program counter is then incremented to address the next
instruction and the cycle is repeated.
The Control Unit decodes the instruction and understands it as a Load operation. Then
after the first instruction cycle. Then the CPU can fully execute the first Assembly
language instrution. Then second assembly instruction which is stored in memory
address pointed by PC is loaded into the CPU. At the end of the second fetch cycle the
PC is automatically incremented and starts pointing to the next memory address. Then
IR will hold the second Assembly instruction. During the second instruction cycle the
control unit identify this as another Load instruction.