Virtualize CPU via time sharing(分时). Performance loss expected.

A process(进程) is a running program. The difference is where they are: when it’s in ram, it’s called a process; when it’s in the disk, it’s a progam. A process contains mem space and regs.

Process APIs

Create, destroy, wait, miscellaneous control(其他控制), and status. See Chapter 5 for more information.

Create

Load progam code into mem (lazyload), allocate runtime stack (for variables, etc), and create heap (for dynamically allocated data, for example, via malloc()).

Arguments are also in the stack.

Then the OS gives stdin, stdout and stderr to the program, and finally starts the program at the entry point.

Process states

Running, ready (not currently running), blocked (due to IO)

Data structures

Sys maintain data structures to track information.

Process list, register context(上下文) and Process Control Block (contains each process information)