An operating system (OS) is the program that controls the hardware and gives every other program a cleaner, safer machine to run on. It plays two roles at once. As a resource manager it shares the CPU, memory, disks and devices among competing programs and keeps them from damaging each other.
10 min readQuick revision
A program is a passive file of instructions on disk. A process is a program in execution: the code together with a program counter, register values, a stack, a heap, open files and everything else the OS must remember to stop it and later continue it exactly where it left off.
8 min readFormulasQuick revision
In UNIX-like systems a new process is made in two separate steps. fork() creates a near-exact copy of the calling process; exec() then replaces the copy's program with a new one. A shell runs a command by forking, letting the child exec the command, and waiting for the child to finish.
9 min readFormulasQuick revision
A thread is a single stream of execution inside a process. A traditional process has one thread; a multithreaded process has several, all running the same program in the same address space.
8 min readFormulasQuick revision