Chapter 4 Silberschatz Threads ( Thread Libraries (Pthread (Refers to…
Most software applications that run on moderns computers are multithreaded.
Is a basic unit of CPU utilization; it comprises a thread ID, a program counter, a register set, and a stack.
The trend towards multicore systems continues to place pressure on system designers and application programmers to make better use of the multiple computing cores.
Testing and debugging
Types or Parallelism
Focuses on distributing subsets of the same data across multiple computing cores and performing the same operation on each cor
Distributes tasks across multiple computing cores. Each thread is performing a unique operation.
One to One Model
Maps each user thread to a kernel thread.
Many to Many Model
Multiplexes many user-level threads to smaller or equal number of kernel threads
Many to One Model
Maps many user-level threads to one kernel thread
Provides the programmer with and API for creating and managing threads
Refers to the POSIX standard defining an API for thread creation and synchronization.
One way to address the difficulties and better support the design of multithreaded applications is to transfer the creation and management of threading from application developers to compilers and run-time libraries.
The fork() and exec() System calls
Some UNIX systems have two versions, one that duplicates all threads and another that duplicates the thread that invoked the fork()
If a thread invokes the exec(), the program specified in the parameter to exec() will replace the entire process.
All signals follow the same pattern
A signal is generated by the occurrence of a particular event
The signal is delivered to a process
Deliver the signal to the thread to which the signal applies.
Deliver the signal to every thread in the process
Delier the signal to certain threads in the process
Assign a specific thread to receive all signals for the process
The signal must be handled
A default signal handler
A user-defined signal handler
The target thread periodically checks whether it should terminate, allowing it an opportunity to terminate itself in an orderly fashion.
One thread immediately terminates the target thread
In some circumstances, each thread might need its own copy of certain data.
We can use a lightweight process (LWP) that appears to be a virtual processor on which the application can schedule a user thread to run. Each LWP is attached to a kernel thread.
Daniela Porras Quiros