OS
Operating systems.
Learn
- #todo Operating Systems: Three Easy Pieces
- #todo Modern Operating Systems by Andrew Tanenbaum
Memory
Virtual memory is an abstraction over physical memory managed by the OS. It provides process isolation and allows using more memory than is physically available by utilizing swapping.
The OS separates virtual memory into user space and kernel space in order to provide memory protection from malware. User space processes can only access their own virtual memory space (unless explicitly allowed to share memory with others).
- User space: C standard library, system components (e.g.
systemd
), user applications (e.g. web browser) - Kernel space: process scheduling, memory management, inter-process communication (IPC)
Processes and threads
A process is an instance of a running program.
A thread is an execution unit of a process to which the OS allocates CPU time. Thus, every process has at least one thread. Processes are isolated, while threads (of the same process) share memory and other resources.
A green thread is a thread managed by a language runtime (e.g. corounites) or by a virtual machine (e.g. JVM), not by the OS. Unlike OS threads, they exist in user space, so they can be used in environments without native thread support.
#todo Threading models:
- Kernel-level (1:1)
- User-level (M:1)
- Hybrid (M:N)