Docsity

Computer Architecture Review, Exercises of Computer Architecture and Organization

Partial preview of the text

Download Computer Architecture Review and more Exercises Computer Architecture and Organization in PDF only on Docsity!

ICS332 - Spring 2016

Operating Systems

Computer Architecture Review

ENIAC (1946)

 E lectronic N umerical

I ntegrator and C alculator

 (^) Stored-Program Computer (instead of Fixed-Program)  (^) Vacuum tubes, punch cards  (^) 100 kHz / 5 kIPS (now ~2-3GHz/5,000 MIPS)  (^) 8x3x100 ft; 27 tons  (^) 150 kW  (^) Programming with wires

Von-Neumann Model  (^) Amazingly, it’s still possible to think of the computer this way at a conceptual level (model from ~70 years ago!!!)  (^) But a computer today doesn’t look quite like this CPU Memory I/O System

Von-Neumann Model  (^) Amazingly, it’s still possible to think of the computer this way at a conceptual level (model from ~70 years ago!!!)  (^) But a computer today doesn’t look quite like this CPU Memory I/O System Memory Bus

Conceptual View of Memory address content 0000 0000 0000 0000 0110 1110 0000 0000 0000 0001 1111 0100 0000 0000 0000 0010 0000 0000 0000 0000 0000 0011 0000 0000 0000 0000 0000 0100 0101 1110 0000 0000 0000 0101 1010 1101 0000 0000 0000 0110 0000 0001 0000 0000 0000 0111 0100 0000 0000 0000 0000 1000 1111 0101 ... ...

Conceptual View of Memory address content 0000 0000 0000 0000 0110 1110 0000 0000 0000 0001 1111 0100 0000 0000 0000 0010 0000 0000 0000 0000 0000 0011 0000 0000 0000 0000 0000 0100 0101 1110 0000 0000 0000 0101 1010 1101 0000 0000 0000 0110 0000 0001 0000 0000 0000 0111 0100 0000 0000 0000 0000 1000 1111 0101 ... ...

At address 0000 0000 0000 0010

the content is 0000 0000

Both Code and Data in Memory Memory 0000 1110 0010 0001 1000 0000 1111 0000 .. . .. . Address Value 0000 1100 0110 1011 0000 1101 1111 0010 1111 0010 0101 1111 .. . .. . Code Data  (^) Once a program is loaded in memory, its address space contains both code and data  (^) To the CPU those are not really different, but the programmer knows which bytes are data and which are code  (^) Always conveniently hidden from you if you’ve never written assembly  (^) But we’ll have to keep code/data straight in these lecture notes Example Address Space

We need a CPU  (^) So now we have a memory in which we can store/retrieve bytes at precise location  (^) These bytes presumably have some useful meaning to us  (^) e.g., integers, ASCII codes of characters, floating points numbers, RGB values  (^) e.g., instructions that specify what to do with the data; when you buy a processor, the vendor defines the instruction set (e.g., instruction “0010 1101” means “increment some useful counter”)  (^) The CPU (Central Processing Unit) is the piece of hardware that modifies the content of memory  (^) In fact, one can really think of the CPU as a device that takes use from on memory state (i.e, all the stored content) to another memory state (some new, desired stored content)  (^) ISA (Instructions Set Architecture): instructions + native data types + registers + memory architecture + interrupts handling + exceptions handling

What’s in the CPU? Memory I/O System Control Unit ALU Program counter register register register current instruction

What’s in the CPU? Control Unit ALU Program counter register register register Registers: the “variables” that hardware instructions work with Data can be loaded from memory into a register Data can be stored from a register back into memory Operands and results of computations are in registers Accessing a register is really fast There is a limited number of registers (x86-64: 16 64-bit registers + 16 FP (128 or 256-bit)) current instruction

What’s in the CPU? Control Unit ALU Program counter register register register Program Counter: Points to the next instruction Special register that contains the address in memory of the next instruction that should be executed (gets incremented after each instruction, or can be set to whatever value whenever there is a change of control flow) current instruction

What’s in the CPU? Control Unit ALU Program counter register register register Current Instruction: Holds the instruction that’s currently being executed current instruction

The CPU in its “Glory”

Fetch-Decode-Execute Cycle  (^) The Fetch-Decode-Execute cycle  (^) The control unit fetches the next program instruction from memory  (^) Using the program counter to figure out where that instruction is located in the memory  (^) The instruction is decoded and signals are send to hardware components  (^) Send a signal to the memory controller?  (^) Send a signal to the ALU?  (^) Operands are fetched from memory and put in registers, if needed  (^) The ALU executes computation, if any, and store results in the registers  (^) Register values are stored back to memory, if needed  (^) Repeat  (^) Computers today implement MANY variations on this model  (^) But one can still program with the above model in mind  (^) but certainly without (fully) understanding performance issues