Processes and Threading - robbiehume/CS-Notes GitHub Wiki
- Comparison with visuals (Jupyter nb)
- Linus Torvaldes' view on processes vs threads
- Linux processes overview (with good diagrams)
-
Process: a program executing on your computer
- A process is just a construct/abstraction an OS uses
- A program is a passive entity, a process is an active entity
-
Thread: a task associated with a process
- A process usually has multiple threads
-
A single-core CPU can run one process at a time
- Each core inside a multi-core CPU can run one process/thread at a time
- With hyperthreading, you can achieve 2 per core by making it appear to the OS that a single core is actually 2
-
Synchronous
-
Asynchronous
-
Concurrency (single core): running and managing two or more tasks (process, program, thread) in overlapping time periods
- Achieved through context switching on a single CPU
-
Parallelism (multi-core): running multiple tasks simultaneously
- Achieved with multiple CPUs or multiple cores on a single CPU
-
Locks
-
Multiprocessing / multithreading
-
Coroutines / Subroutines