signals to running processes

C Hudson Hendren III hudson at vsedev.VSE.COM
Fri Dec 2 06:34:25 AEST 1988


In article <1265 at vsedev.VSE.COM> logan at vsedev.VSE.COM (James Logan III) writes:
>If it is possible that more than one person at a time will be
>requesting a report, you should use semaphores to lock the shared
>memory resource.  The System V semaphores make the implementation
>of the Dekker P/V algorithm very easy.  (I have a generalized
>locking mechanism already written if you want it.)
>
>Testing one integer in a loop in the program will be MUCH faster
>than pushing 5 arguments on the stack and calling msgrcv() in
>order to periodically poll a message queue like Hudson suggested.  

My original suggestion did not require periodically polling a message
queue.  I had suggested sending a message through the message queue then
sending SIGUSR1 to the running process.

It would only need to call msgrcv() in the signal handler for SIGUSR1.
Checking an integer field on every loop iteration is much more overhead than
just setting a trap handler to call msgrcv().  Of course, if there is going
to be a heavy demand on this feature with constant requests for status
dumps, then the trap handler may become less efficient.  I did not get the
impression that the status dump would be requested with great frequency.
That would be like shaking the jello to see if it had set.

Another advantage of this method is that there is no need to use semaphore
locking.
-- 
==> ..!uunet!vsedev!hudson  [hudson at vsedev.vse.com]  (C Hudson Hendren III) <==
==> These are my opinions and are not necessarily those of VSE Corporation. <==
==>	   MS-DOS was created to keep idiots away from UNIX computers	    <==



More information about the Comp.unix.questions mailing list