On Sun, Oct 09, 2005 at 22:57:13 +0000, Talib Alim wrote: > How does process get suspended You mean it suspends itself, or is suspended by someone else? > 1. When running in user mode > 2. When running in kernel mode > > 1. it is done by libc ? > > 2. any pointers will be appreciated Well, on the kernel side of things, process is suspended if it invokes schedule and has current->state indicating it's not runnable (TASK_INTERRUPTIBLE, TASK_UNINTERRUPTIBLE), or it used up it's quantum. Process can call schedule() either explicitly from kernel space (usually by using some synchronization primitive), or during kernel entry or exit (I don't recall which one). Kernel entry/exit happens for syscalls and for interrupts, one of which is time interrupt (HZ times per second). The process can get to non-runnable state by using some kernel synchronization function, or when it receives the SIGSTOP signal. From userland it can get suspended by calling a syscall that sleeps. -- Jan 'Bulb' Hudec <bulb@xxxxxx>
Attachment:
signature.asc
Description: Digital signature