[lug] socket programming/kernel question

Zan Lynx zlynx at acm.org
Wed Mar 5 15:33:59 MST 2003


On Wed, 2003-03-05 at 15:13, Bear Giles wrote:
> Michael J. Hammel wrote:
> > On Wed, 2003-03-05 at 12:17, Bear Giles wrote:
> >>  Information needs to go down the rabbit hole.  Stream protocols 
> >>would tell me this, but require me to keep the stream open for the 
> >>lifetime of the process even if days pass without use.
> > 
> > Depends on your runtime environment, but why would keeping these open
> > for such a long time be a problem?
> 
> If the streams are kept open, the server can't cycle without 
> taking out all of the clients.  I'm not expecting to need to cycle 
> the server, but if we're talking about something that may be up 
> for months it's a real concern.

Actually it can cycle.  Now, this is sort of crazy and whacked, but bear
with me :-)

The server gets a shutdown request or a signal (You _can_ catch SIGBUS,
SIGILL, and SIGSEGV for this) and execs a process that will hold state
for it.  This includes the still open sockets.  Then, when this tiny
state-holder process gets a signal, like SIGUSR1, it execs the original
again, with flags to tell it to resume state.  It can use a connection
log file or a bit of shared memory to figure out what file descriptors
point where.

Neat, huh?  I saw this used in some MUD code.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20030305/fddf1045/attachment.pgp>


More information about the LUG mailing list