Page 69 - DCAP403_Operating System
P. 69
Operating System
Notes switching at kernel level. The second comes from the scheduler that can be chosen by the user in
order to manage a better thread execution. Nevertheless, if a thread of a process is jammed, all
other threads of the same process are jammed too. Another disadvantage is the impossibility to
execute two threads of the same process on two processors. So, user level thread is not interesting
in multi-processor architectures.
Figure 4.10: Detail Diagram of a User Thread
t_nosig
User t_sig
thread t_hold
t_pslg Signal
t_sslg bit maps
User t_bslg
address t_olmask
space t_sl siginfo struct
Kernel p_slg
address
space p_ignore k_sigset_t data types
p_sininfo
Linked list of queued signals
p_sigqueue
p_sigqhdr
proc p_sigqhdr
lwp_signalstask Free pool of sigqueue
lwp_curinfo
LWP lwp_siginfo structs for pending signals
lwp_sigoldmask
t_sigqueue
t_sig Free pool of sigqueue
kthread
t_hold Linked list of structs for signotify
_t_slg_check siginfo structs
p_aslwptp
u_entrymask
u_exitmask aslwp kthread for
u_signodefer signal interception
u_signostack for multithreaded
uarea u_sigresethand processes
u_sigrestart
u_sigmask
u_signal
Array of function pointers
to signal disposition
Why should an operating system support one version or the other? User-level threads do not
involve the kernel, and therefore are faster to switch among than kernel-supported threads.
However, any calls to the operating system can cause the entire process to wait, because the kernel
schedules only processes (having no knowledge of threads), and a process which is waiting gets
no CPU time. Scheduling can also be unfair. Consider two processes, one with 1 thread (process
a) and the other with 100 threads (process b). Each process generally receives the same number of
time slices, so the thread in process a runs 100 times as fast as a thread in process b. On systems
with kernel-supported threads, switching among the threads is more time-consuming because
the kernel (via an interrupt) must do the switch. Each thread may be scheduled independently,
however, so process b could receive 100 times the CPU time that process it receives. Additionally,
process b could have 100 system calls in operation concurrently, accomplishing far more than the
same process would on a system with only user-level thread support.
62 LOVELY PROFESSIONAL UNIVERSITY