signals

Roger Collins rogerc at ncrcae.Columbia.NCR.COM
Fri Mar 3 23:52:52 AEST 1989


In article <225 at skye.ed.ac.uk> richard at aiai.UUCP (Richard Tobin) writes:
> Does Unix make any guarantees about when a signal will be delivered?

Speaking only for System V...

Once the kill system call has started it will not be pre-empted (as
with any system call that does not sleep).  The signal will be
delivered as soon after that as hardware will allow (forget about
interrupts).  When it actually gets processed depends on the scheduler.

> In particular, if a process sends itself a signal, will it be handled
> before the kill system call returns?

Yes, and no.  The kernel's kill() function will have already completed.
But just before the kernel jumps back to user mode after a sys call,
it asks "Are there any signals to process?"  If there are, the kernel
handles them.  That's why I say yes and no.  From the application's
point of view, it gets sent and processed all in the same command (kill).

> Looking at the man page actually confused me further.  My manuals for
> 4.1BSD, 4.2BSD and SunOS4.0 claim that kill(0, sig) sends sig to all
> *other* processes in the process group (SunOS4.0 is particularly
> explicit about this).  4.3BSD and SunOS 3.2 just say all processes in
> the process group.  Presumably the latter description is the correct
> one for all these systems?

A cursory glance at System V source reveals the former is true.
Kill(0, sig) sends sig to ALL processes in the process group including the
calling process.

--
Roger Collins
NCR - E&M Columbia
rogerc at ncrcae.Columbia.NCR.COM



More information about the Comp.unix.questions mailing list