[comp.unix.wizards] lost of SIGIO in SunOS4.1/4.0.3

TAYBENGH%NUSDISCS.BITNET@cunyvm.cuny.edu (THE AGEIS) (05/30/91)

Hi netlander,
        I am writing some network applications using socket & shared memory.
I used SIGIO to notify the receiver when there is data available in the
shared memory. SIGIO is needed here coz the receiver is polling the socket
using select(2). So I need SIGIO to purposely interrupt the select(2) call.
        This SIGIO signal is sent by the sender using kill(2). However, I
found out SOME (not ALL - the last few sent) SIGIO signals are lost.
I thought SunOS4.1 provides reliable signal as described by Steven in his
Unix network Programming book. Is it true? At last, I suspected the signals
are lost probably because the sender was sending too many signals
too fast. As a result, I purposely slowed down the receiver using sleep(2).
The result turned out to be NO signal was lost. Could somebody please shed
some light on me whether SunOS4.1/4.0.3 DOES deliver the signal reliably?
Or did I missed sth? Anybody has the similar experience?
        Thanks a lot.

- Beng Hang (email: taybengh@nusdiscs.bitnet)
  Dept. Of Info. Syst. and Comp. Sc.
  National University of Singapore

lm@slovax.Eng.Sun.COM (Larry McVoy) (05/31/91)

TAYBENGH%NUSDISCS.BITNET@cunyvm.cuny.edu (THE AGEIS) writes:
> found out SOME (not ALL - the last few sent) SIGIO signals are lost.
> I thought SunOS4.1 provides reliable signal as described by Steven in his

It is the intent that SunOS provided "normal" unix signals.  To wire
your brain properly, think of Unix as a processor, system calls as
instructions, and signals as interrupts.  That said, you may remember
that multiple unhandled interrupts get coalesced into one, in other
words, when you handle the interrupt the handler can't tell if it has
received 1 or 20 since the last time it handled the interrupt.  An
interrupt (and a Unix signal) just sets a bit in a mask.  The bit is
just one bit, you can set it 20 times but it still "1".

The problem is that the sending app is counting on the receiving app to 
handle each signal one at a time.  The sender's and reciever's idea of
the number of signals sent will get out of wack when the system gets busy.
---
Larry McVoy, Sun Microsystems     (415) 336-7627       ...!sun!lm or lm@sun.com