kuniga.me > Docs > Operating Systems Cheat Sheet

Operating Systems Cheat Sheet

Common definitions and terminology in operating systems.

For Linux specifics, see the Linux Cheat Sheet.

Index

  1. Components
    1. Kernel
      1. Interrupts
      2. System Call
    2. Process
    3. Thread
  2. Memory
    1. Paging
    2. Swapping
  3. Concurrency
    1. Lock
    2. Mutex
    3. Semaphore
    4. Spin Lock

Components

Kernel

Interrupts

Signals that tell the CPU to pause and execute some function, the interrupt handler. Examples: key press, network packet arrival, system calls and exceptions.

Interrupts are asynchronous: the execution of the handlers are queued by the kernel.

System Call

System call is a special type of interrupt that a process can call to run kernel space functions, e.g. read(), socket(), mmap().

Process

Thread

Memory

Paging

When the system runs out of physical memory and it has to spill chunks of memory (page) to disk.

Swapping

In Linux this is the same as paging.

Concurrency

Lock

Mutex

It’s a type of lock. Stands for mutually exclusive lock.

When a thread tries to acquire a already locked Mutex, the kernel puts that thread to sleep and it will be awakened once the lock is unlocked.

Semaphore

A semaphore is a more generalized version of a lock because it supports up to N threads to “enter” on a exclusive region.

If N = 1, it behaves like a lock, albeit an expensive one.

Spin Lock

It’s a type of lock that keeps trying to acquire a lock in a loop. It doesn’t require the thread to be context-switched, but consumes CPU cycles.