Operating Systems 2020W Lecture 4

From Soma-notes

Video

Video from the lecture given on January 17, 2020 is now available.

Notes

Lecture 4
---------

What is a assembly-language view of a computer?

* hardware registers
  - general purpose registers
  - special purpose registers
  - status/flag registers
  - access and manipulate by specifying register directly or
    registers change behavior indirectly

* memory (RAM)
  - each memory location has a unique address
  - get value or change value by specifying address
  
* (maybe) I/O ports
  - access to devices


This assembly-language view is implemented in UNIX processes

registers
 - "variables" that can be manipulated by instructions
 - size varies, but 64-bit computers generally have 64-bit registers

modern computers mostly follow a load-store architecture
 - load value(s) into registers from RAM
 - manipulate values in registers
 - save registers to RAM

(cache (L1, L2, L3)
 - faster memory to make register<->memory operations faster
 - cache not visible to programs)

To add two numbers together in two variables x and y and store in z
 - load x into a register
 - load y into another register
 - add registers together, store result in one of them
 - save result register to z


Modern CPUs have very few registers
 - at most 64 registers

Hennessey & Patterson, Computer Architecture, a Quantitative Approach
 - read this to learn more about computer architecture and the performance
   tradeoffs