dynamic thread creation is expensive
Dynamic decision
– if handler doesn’t lock => execute on interrupted threads stack
– if handler can block => turn into real thread
Optimization
– precreate z prenitialize thread structures for interrupt routines
Threads and Signal Handling
– disable => clear signal
– signal occurs – what to do with the signal?
SIGNAL-N, handler-N-start-addr
user, kernel mask
Optimize Common Case
– signals less frequent than signal mask updates
– system calls avoided cheaper to update UL mask
Task struct in Linux
– main execution abstraction => task
Struct task_struct { // ... pid_t pid; pid_t tgid; int prio; volatile long state; struct mm_struct **mm; struct files_struct *files; struct list_head tasks; int on_cpu; cpumask_t cpus_allowed; // ... }