First page Back Continue Last page Overview Graphics

Threads

Every process has at least one thread, i.e. the process itself. A process can start multiple threads. The operating system executes these threads as parallel "processes", usually achieved by thread scheduling and time slicing.

Advantage of Threading:

Multi-threaded programs can run faster on computer systems with multiple CPUs, because theses threads can be executed truly concurrent.

A program can remain responsive to input. This is true both on single and on multiple CPU

Threads of a process can share the memory of global variables. If a global variable is changed in one thread, this change is valid for all threads. A thread can have local variables.

The handling of threads is simpler than the handling of processes for an operating system. That's why they are sometimes called light-weight process (LWP)