Threaded code: Difference between revisions

Content deleted Content added
mNo edit summary
 
Merging with existing article.
Line 1:
#REDIRECT [[Thread (computer programming)]]
In a computer [[program]], a sequence of instructions that execute monoithically is known as a thread. In particular, if an [[operating system]] can execute multiple threads using [[time slicing]], then it is possible to write a single program that has multiple threads. For all intents and purposes, these threads operate as if they were independent. An advantage of a multi-threaded program is that it can operate faster on machines that have multiple CPUs, or across a cluster of machines. This is because the threaded nature of the algorithm allow true simultaneous, and independent processing. In such a case, the programmer needs to be careful to avoid [[deadlock]]. 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 an [[atomic]] operation known as a [[semaphore]] in order to prevent data from being simultaneously modified, or read while in the process of being modified.