Podcast
Questions and Answers
What impact does the rate at which threads are reaped have on the speed of thread creation?
What impact does the rate at which threads are reaped have on the speed of thread creation?
How does the reaper running at high priority affect when it should be run?
How does the reaper running at high priority affect when it should be run?
What happens to a blocking unbound thread when a synchronization primitive is called?
What happens to a blocking unbound thread when a synchronization primitive is called?
How are synchronization primitives handled in relation to asynchronous signals?
How are synchronization primitives handled in relation to asynchronous signals?
Signup and view all the answers
What action does the scheduler take when an unbound thread is put to sleep on a synchronization variable's sleep queue?
What action does the scheduler take when an unbound thread is put to sleep on a synchronization variable's sleep queue?
Signup and view all the answers
What is the purpose of putting the freed stacks on a cache of available thread stacks by the reaper?
What is the purpose of putting the freed stacks on a cache of available thread stacks by the reaper?
Signup and view all the answers
What is the main focus of the described threads library implementation?
What is the main focus of the described threads library implementation?
Signup and view all the answers
How are lightweight threads described in the text?
How are lightweight threads described in the text?
Signup and view all the answers
What allows the process to make progress without using excessive kernel resources?
What allows the process to make progress without using excessive kernel resources?
Signup and view all the answers
What does the library manage to ensure progress of the process?
What does the library manage to ensure progress of the process?
Signup and view all the answers
How are user threads described in relation to kernel-supported threads?
How are user threads described in relation to kernel-supported threads?
Signup and view all the answers
What is a key feature of the described threads library in terms of thread synchronization?
What is a key feature of the described threads library in terms of thread synchronization?
Signup and view all the answers
What happens if one thread in a process calls exit()?
What happens if one thread in a process calls exit()?
Signup and view all the answers
How are synchronously generated signals handled in threads?
How are synchronously generated signals handled in threads?
Signup and view all the answers
What happens if all threads within a process mask a signal?
What happens if all threads within a process mask a signal?
Signup and view all the answers
In a process with multiple threads, what happens if a signal handler is set to SIG_IGN?
In a process with multiple threads, what happens if a signal handler is set to SIG_IGN?
Signup and view all the answers
How does forking differ between cloning the entire process and reproducing only the calling thread?
How does forking differ between cloning the entire process and reproducing only the calling thread?
Signup and view all the answers
What is a key characteristic of the signal handling in multithreaded processes?
What is a key characteristic of the signal handling in multithreaded processes?
Signup and view all the answers
Study Notes
Thread Management
- When one thread calls
exit()
, all threads are destroyed. - Each thread has its own signal mask, allowing it to block asynchronously generated signals while accessing shared state.
Signal Handling
- Synchronously generated signals (e.g., SIGSEGV) are sent to the thread that caused them.
- Externally generated signals are sent to one of the threads within a process that has it unmasked.
- If all threads mask a signal, it is set pending on the process until a thread unmasks it.
- Signals can be sent to particular threads within the same process.
Signal Handlers
- All threads within a process share the same set of signal handlers.
- If the handler is set to SIG_IGN, any received signals are discarded.
- If the handler is set to SIG_DFL, the default action (e.g., stop, continue, exit) applies to the process as a whole.
Process Forking
- A process can fork in one of two ways: cloning the entire process and all its threads, or reproducing only the calling thread in the new process.
- The second way is useful when the process is simply going to call
exec()
.
Threads Library Architecture
- The threads library provides extremely lightweight threads within a single UNIX process.
- Threads are multiplexed on a pool of kernel-supported threads of control, managed by the library.
- The library ensures that the process will make progress while not using an excessive amount of kernel resources.
Thread Synchronization
- The threads library implements two basic types of synchronization variables: process-local (the default) and process-shared.
- The library ensures that synchronization primitives are safe with respect to asynchronous signals and can be called from signal handlers.
Process-Local Synchronization Variables
- The default blocking behavior is to put the thread to sleep.
- Each synchronization variable has a sleep queue associated with it.
- Synchronization primitives put blocking threads on the sleep queue and surrender the executing thread to the scheduler.
- If a thread is unbound, the scheduler dispatches another thread to the thread's underlying LWP.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
Learn about the implementation of a lightweight threads library within a single UNIX process, allowing fully concurrent access to system resources. Explore how lightweight threads can be quickly created, with thousands present, and synchronization achieved rapidly.