parallel
Concurrency - doing more than one thing at a time Multihreading - a form of concurrency that uses multiple threads of execution parallel processing - does lot of work by dividing it up among multiple threads hat run concurrently
- two threads have accesto same address space, and if we don't enforce atomicity by a thread by synchronization context
A critical section is a piece of code that accesses a shared resource, usually a variable or data structure.
β’ A race condition (or data race [NM92]) arises if multiple threads of execution enter the critical section at roughly the same time; both attempt to update the shared data structure, leading to a surprising (and perhaps undesirable) outcome.
β’ An indeterminate program consists of one or more race conditions; the output of the program varies from run to run, depending on which threads ran when. The outcome is thus not deterministic, something we usually expect from computer systems.
β’ To avoid these problems, threads should use some kind of mutual exclusion primitives; doing so guarantees that only a single thread ever enters a critical section, thus avoiding races, and resulting in deterministic program outputs.