1 processes

Instance of a program that is being executed.

1.1 concepts

A process can be described as either:

1.1.1 structure

Stack and heap is growable/shrinkable.

1.1.2 states

1.1.3 process control block (PCB)

Stores information about running processes. pid, process state, CPU registers, CPU scheduling info (priorities, queue), memory limits, stats etc.

1.1.4 context switch

Switching from one process to another. Requires saving current PCB and loading the one that is needed. Context switches are expensive to perform.

1.2 scheduling

Maximize/optimize CPU use. Decides which process is executed next.

Processes move around these queues:

1.2.1 types

1.3 operations

Processes are a tree: parents can create its own processes called children.

1.3.1 fork

Creates a new child process with a copy of the current process’ memory, registers, etc.

1.3.2 exec family

Executing other programs with arguments.

1.3.3 process termination

exit() exits current process with a given status code.

kill(pid, SIGNAL) kills a process.

All resources are deallocated by the operating system.

1.3.3.1 wait

Waits for child to exit. Returns the exit code and pid of the child process.

1.3.4 inter-process communication (IPC)

Either by shared memory or message passing.