Signals and context switches
Blair P. Houghton
bhoughto at pima.intel.com
Mon Jun 17 06:49:10 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.
> 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!
Makes sense. Going into a signal-wait sends the process to sleep,
and the kernel goes and gives every other process of equal or
higher priority on the machine a chance to run before it gets
around to telling your process it has a signal waiting (provided
a signal was sent to it).
This is not a lot of overhead if you're planning on using this
signalling framework to control a larger piece of code that
will do considerable computing before it goes to sleep again,
and especially if there's any i/o involved.
BTW, you're sending 200 signals, not 100.
Then again, you could just have a really bletcherous kernel.
What sort of system is it?
And how do you manage to tell both processes the PID of each
other? Some sort of prompt? Or pass it in a file?
--Blair
"Travel from point A to point B
making only right turns..."
More information about the Comp.unix.wizards
mailing list