SMP thread scheduling

In the SMP environment, the availability of thread support makes it easier and less expensive to implement SMP-exploiting applications.

Thread support divides program-execution control into two elements:

  • A process is a collection of physical resources required to run the program, such as memory and access to files.
  • A thread is the execution state of an instance of the program, such as the current contents of the instruction-address register and the general-purpose registers. Each thread runs within the context of a given process and uses that process's resources. Multiple threads can run within a single process, sharing its resources.

Forking multiple processes to create multiple flows of control is cumbersome and expensive, because each process has its own set of memory resources and requires considerable system processing to set up. Creating multiple threads within a single process requires less processing and uses less memory.

Thread support exists at two levels:

  • libpthreads.a support in the application program environment
  • Kernel thread support

Although threads are normally a convenient and efficient mechanism to exploit multiprocessing, there are scalability limits associated with threads. Because threads share process resources and state, locking and serialization of these resources can sometimes limit scalability.