Content deleted Content added
No edit summary |
No edit summary |
||
Line 10:
An advantage of a multi-threaded program is that it can operate faster on [[computer system]]s that have multiple [[CPU]]s, or across a [[computer cluster|cluster]] of machines. This is because the threads of the program naturally lend themselves for truly [[concurrent programming|concurrent]] [[execution (computers)|execution]]. In such a case, the [[programmer]] needs to be careful to avoid [[race condition]]s, and other non-intuitive behaviors. In order for data to be correctly manipulated, threads will often need to [[rendezvous]] in time in order to process the data in the correct order. Threads may also require [[Atomic_(computer_science)|atomic]] operations (often implemented using [[semaphore (programming)|semaphores]]) in order to prevent common data from being simultaneously modified, or read while in the process of being modified. Careless use of such [[primitive]]s can lead to [[deadlock]]s.
Use of threads in [[programming]] often causes a [[state inconsistency]]. A common [[anti-pattern]] is to set a [[global variable]], then invoke [[subprogram]]s that depend on its value. This is known as
fire]]
Operating systems generally implement threads in either of two ways: [[preemptive multithreading]], or [[cooperative multithreading]].
The [[Java programming language]] is an example of a [[computer language]] which supports multi-threaded [[computer program|program]]s.
Line 35:
== External links ==
* [http://arstechnica.com/paedia/h/hyperthreading/hyperthreading-1.
* [http://www.ece.utexas.edu/~valvano/EE345M/view04.pdf Page 1] & [http://www.ece.utexas.edu/~valvano/EE345M/view05.pdf Page 2], a preemptive multithreaded implementation described
* news:comp.programming.threads
|