SLIDE 5 5
Silberschatz, Galvin and Gagne 2002 5.17 Operating System Concepts
Thread Cancellation
Canceling a target thread
Asynchronous cancellation (immediate termination) Deferred cancellation Target thread periodically checks if it should terminate
Issues:
reclaiming resources of cancelled target thread Shared resources with other threads
Cancellation points
Silberschatz, Galvin and Gagne 2002 5.18 Operating System Concepts
Signal Handling
Signal => Notify the process of the occurrence of a
certain event
Types of signals
Synchronous Delivered to the same process that generated the signal Illegal memory access, division by zero, overflow Asynchronous Generally, delivered to a different process than the one
generating the signal
<control><C>, timer expiry
Signals handled using
Default signal handler (run by the kernel) User-defined signal handler
Silberschatz, Galvin and Gagne 2002 5.19 Operating System Concepts
Signal Handling (Cont.)
Options for delivering signals (depending on signal)
Only to the thread that generated the signal To all threads of a process To all threads not blocking the signal To a specific/dedicated thread
Threads many choose to block certain signals
Silberschatz, Galvin and Gagne 2002 5.20 Operating System Concepts
Thread Pools and Thread-specific Data
Thread pools
Creating a large number of threads in a system can exhaust
system resources
Allocate a pool of thread’s Allocate available threads from the thread pool to a new
“thread”
Reduces thread creation time when a request arrives
Thread-specific data
Need for supporting private storage for threads that need to
manage their own private data