Context switching when a thread invokes a system call
问题 I have a process with multiple threads. If one of my threads invokes a system call like gettimeofday() , does the kernel only switch that thread out of context to service the system call, or does it switch the entire process (and all other threads) out of context? 回答1: Most system calls may involve a context switch (if other tasks are runnable) and switch the processor's state to kernel mode. But gettimeofday (and e.g. getpid() ) are unusual. with recent kernels they use VDSO to avoid it (and