Thread (computing): Difference between revisions

Content deleted Content added
mNo edit summary
 
No edit summary
Line 2:
software development environments support what are called "threads",
or "lightweight" threads of execution.
They are similar to the idea of a "process", in that both represent
a single sequence of instructions executed monolithically, in parallel
with other processes, either by [[time slicing]] or [[multiprocessing]].
This allows a program to split itself into two or more simultaneously
running tasks.
Line 18 ⟶ 21:
The [[Java programming language]], for example, is designed to
facilitate multi-threaded programs.
 
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 algorithms 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.