Signals and context switches

Boyd Roberts boyd at prl.dec.com
Mon Jun 17 18:55:58 AEST 1991


In article <1991Jun16.010626.28257 at bnlux1.bnl.gov>, drs at bnlux1.bnl.gov (David R. Stampf) writes:
> 	program 1 sends a SIGUSR1 signal to program 2, then waits to
> 	receive a SIGUSR1 signal from program 2. It repeats this 100
> 	times.
> 
> 	program 2 just catches SIGUSR1 signals from program 1 and sends
> 	a SIGUSR1 signal back.
> 
> 	What surprises me is that it takes 70 seconds to send the 100
> 	signals back and forth! 

Well, it'll depend on the load on your machine and how long the
running processes run for, on average.  Worst case is that you have
N compute bound processes doing no I/O, which translates into 1 second
time quantums.  Your signal catching programs only receive the signal
when they run, and they have to wait till it's their turn.  This could be
a long time, but it could be quick.  It's just not predictable.

Maybe you could do something gross to speed it up, but already I think
it's time for a walk into the hall of mirrors and have a good hard geek
at what you're trying to achieve.  Signals were not designed for inter-process
communication.  They were there to kill processes.


Boyd Roberts			boyd at prl.dec.com

``When the going gets wierd, the weird turn pro...''



More information about the Comp.unix.wizards mailing list