Chapter 3: Threads | 🗒️ Ben's Notes
A thread is a single unique context, or unit of concurrency, for execution that fully describes the program state. A thread consists of a program counter (PC), registers, execution flags, and a stack. Each thread has a private state stored in the Thread Control Block (TCB). Additionally, each thread has a dedicated portion of the stack that is isolated from other threads: Operating systems have a thread scheduler that manages multiple threads, and can switch between ready and running threads. Threads can have one of several states: Running: current being executed Ready: can run, but not currently running Blocked: cannot run. This typically occurs when thread is waiting for I/O to finish. When the I/O is complete, it becomes ready. As a result, I/O latency can be masked by multithreading (since other threads can run in the meantime). The thread lifecycle, from initialization to completion. By default, C programs are single-threaded (and when you create a new process, it only has one thr
A thread is a single unique context, or unit of concurrency, for execution that fully describes the program state. A thread consists of a program counter (PC), registers, execution flags, and a stack. Each thread has a private state stored in the Thread Control Block (TCB). Additionally, each thread has a dedicated portion of the stack that is isolated from other threads: Operating systems have a thread scheduler that manages multiple threads, and can switch between ready and running threads. Threads can have one of several states: Running: current being executed Ready: can run, but not curren
Explore this link on the map →