UNIX-WIZARDS Digest V12#132

Lionel Hummel lhummel at urbana.mcd.mot.com
Tue Jun 18 02:03:00 AEST 1991


> 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! 

> Is it possible to get better timing on this? I guess what I'd
> like to do is to force a context switch when I send the signal
> and get much better "turn" around.

The sigpause() call, which is documented on the sigset(2) man page,
will do what you want.

Using your example but including a sigpause(SIGUSR1), I find that a
pair of processes bouncing a SIGUSR1 back and forth 100 times executes
in less than a second.
                                      < Lionel
-----------
Lionel D. Hummel, Software Engineer                         [H] (217) 344-8713
Motorola Computer Group, Urbana Design Center               [W] (217) 384-8511
lhummel at urbana.mcd.mot.com      uiucuxc!udc!lhummel       uiucdcs!large!lionel



More information about the Comp.unix.wizards mailing list