V.I.P. Dasanayake - Computer System
V.I.P. Dasanayake - Computer System
ASSIGNMENT 02
1
(1) Memory Hierarchy
This is mainly base on performances and cost of various kinds of memories such as
flash memory register, RAM, hard disks...etc. Memory hierarchy means put those
sections such as RAM, registers, hard drives …etc in a Oder based on performances and
prices, Other than that physical size, fast.
Data transfer speed in hard drive and registers are very different so they can’t
exchange data. So there should be some memories which speed is close to both speeds.
For that purpose there are some memories which supports to that. And the other thing is
when it is want to show some huge data (which have high memory capacity) it can’t be
shown due to the huge memory. Computer may take long time to load that data, so to
minimize that time there are several memories. These memories should have to put in
order. Memory hierarchy concept helps for that. So data transfer is happening b the
combination of all these memories. Here are some memories which are in the order of
the concept of Memory Hierarchy.
Register
Cache
..Small size
RAM
..Volatile
..Costly
Flash
..Price
..Fast
Hard drive
Tape backup
2
(2)
i. Latency
Latency is the time that elapses between the start of an operation and the completion
(the delay between the time a bit is sent and the time the bit is received). This is usually
measured by nanoseconds (ns). This is a measure of the time required to perform a
transfer.
Latency doesn’t sufficient as a measure of memory performance. Latency is a
simplistic measure that doesn’t provide complete information.
There is a speed difference between the memory and the processor/CPU. So memory
controller supports to communication happens between processor and memory. While the
data transfers to processor from memory controller gets data from memory. So the data
which receives from the controller is not fresh because data transfers to the processor
from controller are happening gradually.
Processor Physical
Controller
memory
This is a parallel interface which decides memory transfer size. Memory controller
provides the connection between a physical memory and a processer that uses the
memory. To achieve high performances, memory systems use parallelism. The processor
and the controller connected parallel with several wires and those wires can transfer one
data bit at any time. Those wires are called Memory bus.
Control circuits in the memory use the address to select the bits at the specified
location in RAM and send a copy of the data back to the CPU over the memory bus.
(Technical name for the hardware connection between a processor and memory is
memory bus)
This can be shown as below.
Physical
Processor Controller memory
3
iv. Little-endian
When sending a byte of data over a network, both sending and receiving data should
be equaled as they will be transferred most significant bit or least significant bit first.
When a system that numbers bytes of an integer from least significant to most significant,
we call it as little endian system.
Example:-
v. Virtual Memory
Virtual memory means a mechanism that hides the details of the underlying physical
memory to provide a more suitable memory environment. We can simplify this as when
controller wants new data which aren’t include in the RAM, RAM replace some old data
and give the data to controller.
Address
Memory 1
Processor sees
a single
999 contiguous
memory
1000 Memory 2
Illustration of a virtual memory system that an address space two physical memories
1999
4
(3)
The term RAM is generally understood to refer to volatile memory, which can be
written as well as read. Mainly there are two types of RAM as Static RAM (SRAM) and
Dynamic RAM (DRAM).Those are alternatives to each other.
SRAM:-
This is the Easiest type for programmer because it is a straight forward extension of
digital logic. SRAM consists of transistors. Though this has a high speed, power
consumption and heat generating of this is relatively very high. Because when multiple
transistors operate continuously each transistor consumes power and generates heat in
small amount.
Write
enable
Circuit for
Input one bit Output
DRAM:-
DRAM consumes less power because it consists of capacitors. When a value is
written to DRAM the hardware charges or discharges the capacitor to reflect the digital
value. Computer that uses DRAM contains an extra hardware circuit called a refresh
circuit which can perform fast writing and reading a bit. External refresh circuit
periodically read data and writes it back again or charge will dissipate and the value will
be lost.
When consider all the things most computer memories are composed of DRAM rather
than SRAM
Write
enable
Circuit for
Input one bit Output
Refresh
A bit in a DRAM
5
ii. Magnetic disks
Floppy and hard disk drives store information on magnetic disks. The disk is a thin,
flexible piece of plastic with little magnetic particles inlayed in its surface. The read-write
head creates a small magnetic field that aligns the magnetic poles of the particles on the
surface of the disk directly beneath the head to write data to the disk. While particles
aligned in one direction represent a “0”, particles aligned in the opposite direction
represent a “1”.The drive head scans the surface of the disk to read data from a disk. The
magnetic fields of the particles in the disk induce an alternating electric current in the
read-write head, which is then translated into the series of “1”s and “0”s that.
The main components of a disk drive are
a) The motor, which rotates the disk,
b) The read-write mechanism,
c) The logic board, (which receives commands from the operating, system to place or
retrieve information on the disk)
Floppy and hard drives use a small magnetic head to magnetize portions of the disk
surface, to read or write information to a magnetic disk
iv. Registers
Information is stored in a CPU memory location called a register. Registers can be
thought as the CPU’s tiny pad, temporarily storing instructions or data. Register capacity
is the total number of bits or bytes that a register in a microprocessor can store. Register is
a volatile memory. There are two types of registers called program counter and
instruction register.
Program counter:-
When a program is running, register called the program counter keeps track of which
program instruction comes next by maintaining the memory location of the next program
instruction to be executed. The CPU’s control unit coordinates and times the CPU’s
functions, and it uses the program counter to locate and retrieve the next instruction from
memory. In other words we can say that it stores the address of instructions which are
coming through address bus.
Instruction register:-
The instruction travels along the memory bus from the computer’s memory to the
CPU, is stores in instruction register
6
(4)
Von Neumann Architecture
When a computer follows Von Neumann Architecture it uses the stored program
approach in which program resides in memory. The hardware that follows Von Neumann
Architecture consists of three principle components that interact,
1. Processor,
2. Memory,
3. Input Output facilities (I/O facilities)
Von Neumann Architecture concept can be shown as below.
Computer
Processor Memory
(5)
I.
Fixed logic processors selectable logic processors
7
II.
Fixed logic processors Parameterized logic processors.
(6)
Structure of the CPU:-
Information from an input device or from the computer’s memory is communicated
via the bus to the central processing unit (CPU), which is the part of the computer that
translates commands and runs programs. The CPU is a microprocessor chip that is, a single
piece of silicon containing millions of tiny, wired electrical components.
1. Controller
2. Computational Engine (ALU)
3. Local Data Storage
4. Internal Interconnections
5. External Interface
1. Controller
Controller is known as the heart of the computer because it Coordinates
operations. As it is mentioned earlier memory controller supports to communication
happens between processor and memory. Though there are four other structures of
CPU, this is the most important thing.
2. Computational Engine (ALU)
An ALU consists of a single, complex hardware unit that can perform various
kinds of operations. (It provides operation on integer arithmetic, operation on bits
such as left or right shift. And hardware that performs logical operation such as
Boolean and, or, exclusive or and not) when ALU perform some operation such as
addition, subtraction, and bit shifting, remain functional units which supports to the
operation provide mechanisms that interface to the ALU to the rest of the system. The
computational engine doesn’t perform multiple or initiate activities. The engine only
operates at the request of the controller.
8
3. Local Data Storage
Mainly it is about hardware registers. As it is mentioned before information is stored
in a CPU memory location called a register. Register is a volatile memory. In here it is
dealing with memory size bites. This is a most important part of memory in the computer.
There are several register as instruction register, program counter. This registers get and
supply data to perform some operation and show.
4. Internal Interconnections
This is called data path also. The instruction code that tells the computer which
operation to perform also specifies which memory address or addresses to access. An address
is sent through wires called an address bus from the CPU to the main memory (RAM).
Control circuits in the memory use the address to select the bits at the specified location in
RAM and wires called a data bus, send a copy of the data back to the CPU. These address bus
and data bus are internal interconnections.
Internal interconnection is used to move data values from local storage to the
computational engine or move results from the computational engine to local storage. Internal
interconnections are in the CPU.
5. External Interface
This unit handles all communication between processor and the rest of the computer
system. Especially it is happening between the process and the external memory. While
there are several connections between external interface and ALU, controller, local storage,
there is also an external connection.
9
(7)
Memory Accessing
Here it can be use to write to the memory or read from the memory.
MBR:-
Memory Buffer Register (MBR) is also called as Memory Data Register (MDR). All
the data in the MBR are situated according to an order. There are addresses in MAR in
HIGH, LOW manner. As Left number in MDR represents the HIGH part of MAR, right
number in MDR represents the LOW part.
0, 0 0, 1 0, 2 0, 3
1, 0 1, 1 1, 2 1, 3 MDR
2, 0 2, 1 2, 2 2, 3
3, 0 3, 1 3, 2 3, 3
MAR:-
MAR means Memory Address Register. To access a certain memory address for
MAR the controller give the address to MAR then is divided to low and high. As an example
when left bites of the address becomes the HIGH part of MAR, right part becomes LOW part
of MAR
Example:-address=1101
HIGH LOW
The address = 10 | 01
00 01 10 11
00 The address
01
10
10
11
(8)
Fetch –Execute cycle
Though the details among programmable processors are varying, all those processors
are following this fetch execution cycle.
The main idea of this is
When there is a stored point in a program, after accessing the next step of
The program from that point, it will be executed to perform steps of the program. This
whole thing will repeat forever
There are two main parts of this as Fetch cycle and Execute cycle. In fetch cycle there
are 3 steps and in Execute cycle there are two steps.
• In Fetch cycle
1) Fetch instruction
2) Decode opcode
3) Fetch operands
• In Execute cycle
4) Perform operation
5) Store result
In the Von Neumann Architecture the loop which is described earlier will continue
among processor, memory, Input Output facilities. The loop can briefly describe by following
picture.
11
(9)
There are two types of registers
IR – Instruction Register
PC – Program Counter (IP – Instruction Pointer)
While the Program counter stores the address of the instructions, Instruction Register
stores the instruction. Execution Flow Control happens using the value on the PC.
Program counter:-
When a program is running program counter keeps the track of which program
instruction comes next by maintaining the memory location of the next program
instruction to be executed. Address bus give these instruction addresses to the program
counter
Instruction register:-
While this program counting happening instruction coming along memory bus stored
in the instruction register.
Controller is the logical thing CPU (ALU is just doing some calculation only)
in CPU. When busses travel addresses and instruction to PC and IR, they store it. While
this happening memory controller supports to communication happens between processor
and memory. So when we consider execution of a program
Store the
instructions
Store the
address of
the ALU
instruction
12