1/68
Looks like no tags are added yet.
Main components of a computer system.
CPU
Main memory
von Neumann architecture.
Main components: arithmetics unit, memory unit, control unit and input/output unit.
Same memory for data and instructions
Calculations are run sequentially.
Simple and economic.
Instruction execution cycle (machine cycle).
1. Fetch instruction
2. Decode instruction
3. Fetch data
4. Execute instruction
Fetch instruction.
Fetches the instruction located in the address, given by program counter, from memory.
Loads instruction into instruction register.
Decode instruction.
The instruction is decoded in the instruction register.
Fetch data.
Data required for completing the instruction is fetched from memory or registers and put in to data registers.
Execute instruction.
Data is passed to ALU for calculations and logical operations. Result is the loaded into registers or main memory.
Main components of a CPU.
Control unit.
Arithmetic logic unit (ALU).
Registers.
Control unit.
Manages the operation of the entire computer by fetching instructions from memory, interpreting them and commanding appropriate hardware to act on those instructions.
Arithmetic logic unit (ALU).
The part of the CPU that preforms the actual logical and mathematical computations such as addition, subtraction, multiplication, division and comparisons.
Registers.
Very small but fast memories that can hold only the information a processor needs on hand at a given time.
By using registers the CPU can get provided with data far faster than if the processor would retrieve data only from external memory sources.
Instruction registers (IR).
Holds the instruction that is currently being executed or decoded.
Program counter (PC) or instruction address register.
Holds the adress in the memory where the next instruction is located.
Accumulator register (AR).
Stores intermediate arithmetic and logic results. Without it the results of a computation would have to be written back to main memory immediately upon completion, perhaps only to be read right back again for use in the next operation.
General purpose registers.
Stores both data and addresses for very small periods of time.
MIPS
Millions of instructions per second.
FLOPS
Floating-point operations per second.
Moore's law
A prediction of how many transistors a chip can hold.
An exponential increase: The number of transistors double every 24 months.
Main memory.
Directly accessible by the CPU.
Data and programs, or parts of programs, are read into the main memory (RAM) from external memory devices.
Memory - computer speed relation
A memory access is a slow process in comparison to other operations.
The larger the memory, the slower memory access.
Memory bandwidth.
The rate at which data can be read from or stored into a memory by a processor.
Memory bandwidth = amount of data per access / memory cycle time
Increasing bandwidth.
Increase amount of data per access (expensive and limits memory size).
Divide memory into separate banks, each with its own control unit. Thus reducing memory cycle time (due to smaller memories).
Interleaving placement of program and data.
Spreading data and instructions evenly across all memory banks.
Semiconductor main memory
Mostly random access memories (RAM).
Information is lost without power (volatile).
Relatively cheap and has low power consumption.
Sequencial access
For accessing a certain address, all addresses prior to that on must be went through.
Direct access
Same as random access.
Accesses any address instantly.
Random access
Same as direct access.
Accesses any address instantly.
Associative memory
RAM memory where data is fetched based on its content rather than its address.
Compares a given bits with all memory slots simultaneously.
ROM
Read only memory.
Usually very fast.
Can be used as primary memory for certain instructions. For example on startup where the same procedures always are made.
Seek time
The time for the disk to reach necessary rotation speed and to position the read/write head to proper location.
Read/write time
1 / data transfer rate
Rotational delay
The time required for the read/write head to position at the beginning of the sectors where data are stored
Average access time for combined cache memory.
The average time for fetching data or an instruction from memory.
P(hit) cache access time + (1 - P(hit)) memory access time + cache access time * block size + cache check time
Cache memory
Small, fast memory for accessing recently accessed data or instructions.
Cache block size (line size).
Number of words in a block.
Cache miss
When CPU wants to access an item not in the cache memory.
Retrieves data from main memory and stores a copy in the cache memory.
Harvard architecture
Separate memory for data and instructions.
Makes it possible to fetch instructions and to read/write data at the same time.
Generally faster than von Neumann architecture.
Locality of reference
If a data is accessed the same data or related data is likely to be accessed in a near future.
Temporal locality.
Spatial locality
Temporal locality
If a particular memory location is referenced, then it is likely that the same location will be referenced again in the near future.
Spatial locality
If a particular storage location is referenced at a particular time, then it is likely that nearby memory locations will be referenced in the near future.
Unified cache
Data and instructions are stored in the same cache. (von Neumann architecture)
Cache mapping functions.
Direct mapping (one-way set associative map)
Two-way set associative map
n-way set associative map
Fully associative map
Direct mapping (one-way set associative map)
Each location in main memory can go into only one entry in the cache.
Two-way set associative map
Each location in main memory can go into two entries in the cache.
n-way set associative map
Each location in main memory can go into n entries in the cache.
Fully associative map
Each location in main memory can go into every entries in the cache.
Best miss rate but only practical for small numbers of entries.
Offset
The least significant bits in an address that refers to a specific place in a block of a cache memory.
Set/index
The bits in an address that refers to a specific set in cache memory.
Tag
The most significant bits in an address that refers to a block in a set of a cache memory.
Cache replacement algorithms
Decides which block should removed when cache is full.
LRU (Least recently used)
FIFO (First in first out)
LFU (Least frequently used)
Random
Cache write policies
Write-through
Write-back
Write-through
Write is done synchronously both to the cache and to the backing store.
Write-back
Initially, writing is done only to the cache. The write to the backing store is postponed until the modified content is about to be replaced by another cache block.
Virtual memory
By using virtual memory a program running can use its own addresses (virtual addresses) which are mapped into physical addresses in RAM.
Virtual to physical address
The addresses of a program are split up into pages (generally 4kB each). These are mapped into equally large pages in the physical memory. A given virtual address is split up into two pieces:
Page offset
Virtual page address
Page offset
The least significant bits of the virtual address that tells where in a page a given address is.
(12 bits, given a page size of 4kB)
Virtual page address
The bits of the virtual address telling which page a virtual address is located in.
Is mapped into a physical page address.
Page fault
When a page requested is not to be found in the RAM. The OS fetches the page from hard drive and is then loaded into the RAM and mapped for usage by the requesting program.
Instruction set
Describes which assets are available for programming of a processor.
Common instruction set design issues
Which operations to provide?
What datatypes?
Instruction format: Number of addresses and size of fields etc.
Number of CPU registers and their use.
Direct addressing
The operand address is directly given at the address field of the instruction.
Immediate addressing
The operand is given in the instruction.
Indirect addressing
The memory location pointed by the address in the instruction contains the address of the operand, instead of the operand itself.
Indexed addressing
The operand address is given by adding the address given in the instruction and an index stored in a register.
Relative addressing
The address is relative to a base address stored in a register.
Pipeline hazards
Situations that prevent the next instruction in the instruction stream from executing during its designated clock cycle.
Structural hazards
Data hazards
Control hazards
Structural hazards
Caused by memory conflicts.
Results in a 1 cycle penalty (performance lost is multiplied by the number of stages).
Data hazards
Caused by read/write conflicts.
Emerges when a data which is not yet calculated is needed.
Control hazards
Caused by branch instructions, which change the instruction execution order.