Chapter 4 - Threads, Context, Concurrency, and Processes Flashcards
Process
A program in execution in a context.
Race condition
Possible when two or more threads, sharing access to a common resource, are allowed to execute concurrently and at least one of those threads modifies the resource.
All of this is required for a race condition to occur, but a race condition won’t occur just because all of this is true.
Context
All the information needed to record the current status of a computation so that the OS can pause its execution and still have the computation proceed correctly when resumed later.
Example: NANO on prclab
Thread
Unit of computation, the active element of a process. Each process has at least one thread (first one created by the OS).
All threads within a process execute the same code, but each thread executes in its own context. Has its own hardware context (when not in used, stored in the TCB. When in use, used in hardware).
Stack (local variables within a function) belongs to the thread, not the process.
Sibling threads
Threads within a process - no parent/child relationship among threads. Easy to make them communicate.
TCB
Thread Control Block. Where threads are stored when not in use. Relevant to hardware context.