OS: run programs, share memories & interact with devices
refer to the OS as a virtual machine
Tells OS what to do. Standard libs and APIs.
OS manages CPU, memory and disk, and share them among programs.
Turn some physical CPUs into seemingly infinite virtual CPUs, and thus allow programs to run at once.
Physical memory is an array of bytes (1 dimension).
Read mem - load; write mem - store
Memory of each running program seems to be allocated at the same address (00200000), but actually not.
The memory parts are separated and a program cannot access memory of other programs.
See Zhihu.
Concurrency is “pretending” running multi programs/threads at the same time.
Concurrency is not parallel, which is really running together.
Fig 2.5 a multithread program: two threads may load the counter from mem to reg at the same time, and store back together. As a result, the counter is only added once.
RAM loses data easily, but storing data persistently is needed.