Threads are multiple programs running at the same time while sharing variables. Shared variables are either the core strength of threads or the root of their evil, depending on a user's perspective. They allow threads to communicate easily and quickly, while making it possible for threads to get in each other's way. Experts are confused about the rules for using such shared variables despite these being at the core of most programs. It is observed that almost all processor architectures allow stores to memory to be saved in a buffer visible only to that processor core before writing them memory visible to other processor cores. The simplest view of threads is that a multi-ithreaded program is executed by interleaving steps from each thread. The most common way to avoid data races resulting from shared variables is to use mutexes to ensure mutual exclusion between code sections accessing the same variable.
|Original language||English (US)|
|Number of pages||7|
|Journal||Communications of the ACM|
|State||Published - Feb 2012|
ASJC Scopus subject areas
- Computer Science(all)