From owner-freebsd-hackers Wed Jan 8 16:54:37 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id QAA14591 for hackers-outgoing; Wed, 8 Jan 1997 16:54:37 -0800 (PST) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.8.4/8.8.4) with SMTP id QAA14585 for ; Wed, 8 Jan 1997 16:54:32 -0800 (PST) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id RAA17405; Wed, 8 Jan 1997 17:42:48 -0700 From: Terry Lambert Message-Id: <199701090042.RAA17405@phaeton.artisoft.com> Subject: Re: mmap() updates...how often? To: wong@rogerswave.ca Date: Wed, 8 Jan 1997 17:42:47 -0700 (MST) Cc: proff@suburbia.net, hackers@freebsd.org In-Reply-To: from "Ken Wong" at Jan 8, 97 06:42:07 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > On Wed, 8 Jan 1997 proff@suburbia.net wrote: > > > > > Why not just put them all in the same process group, and send the process > > group a SIGUSR1 when new data is ready in the mmaped region? > > > Is Signal delivery quaranteed in FreeBSD? I mean if 2 or more signals > are sent to a process at the same time. does it quene up the signals? One signal: raise condition Two signals: rais condition for first, queue second behind mask (assume it doesn't come in during race window before masking) Three signals: You are SOL. Signals are persistent conditions, not events; to use EE jargon, they are level triggered, not edge triggered. In point of fact, no signal system compliant with currently ratified POSIX standards will queue signals for delivery in FIFO (or any other, for that matter) order. Search for "POSIX +reliable +signals" on the AltaVista search site for information on POSIX standards currently in committee for event style signal queueing. Most likely you are trying to notify a process of multiple events, and you are trying to use a non-event interface (signals) to do it. Don't. Solve the problem some other way (UNIX domain sockets, pipes, message queues, counting semaphores, etc. ...there are literally dozens of alternatives). The only thing signals are barely useful for is one shot conditions (like sending HUPCL to all processes in a process group for on-to-off DCD transition on a tty line, something that can happen only once in the lifetime of the session) and for one of many events (like sending SIGCHLD when a child process dies, after which you are expected to reap as many children as you can because the signal for subsequent processes could be lost). In the second case, the processing of the signal is not as important as its mere existance: you should set a volatile flag and do your processing in your main loop -- *NOT* in the signal handler -- to close any potential race window on delivery/unmask. See the init, xdm, and inetd code for sample implementations. of "one of many". Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.