From owner-freebsd-hackers Fri Jan 31 07:34:23 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id HAA27409 for hackers-outgoing; Fri, 31 Jan 1997 07:34:23 -0800 (PST) Received: from eldorado.net-tel.co.uk ([193.122.171.253]) by freefall.freebsd.org (8.8.5/8.8.5) with SMTP id HAA27330 for ; Fri, 31 Jan 1997 07:34:03 -0800 (PST) From: Andrew.Gordon@net-tel.co.uk Received: (from root@localhost) by eldorado.net-tel.co.uk (8.6.12/8.6.10) id PAA20686; Fri, 31 Jan 1997 15:31:11 GMT Received: from "/PRMD=NET-TEL/ADMD=GOLD 400/C=GB/" by net-tel.co.uk (Route400-RFCGate); Fri, 31 Jan 97 15:27:15 +0000 X400-Received: by mta "eldorado" in "/PRMD=net-tel/ADMD=gold 400/C=gb/"; Relayed; Fri, 31 Jan 97 15:27:15 +0000 X400-Received: by mta "net-tel cambridge" in "/PRMD=net-tel/ADMD=gold 400/C=gb/"; Relayed; Fri, 31 Jan 97 15:27:13 +0000 X400-Received: by "/PRMD=NET-TEL/ADMD=Gold 400/C=GB/"; Relayed; Fri, 31 Jan 97 15:27:13 +0000 X400-MTS-Identifier: ["/PRMD=NET-TEL/ADMD=Gold 400/C=GB/";hst:8655-970131152713-4AEF] X400-Content-Type: P2-1984 (2) X400-Originator: Andrew.Gordon@net-tel.co.uk Original-Encoded-Information-Types: IA5-Text X400-Recipients: non-disclosure:; Date: Fri, 31 Jan 97 15:27:13 +0000 X400-Content-Identifier: Re(2): Re(2): Us Message-Id: <"5fb2-970131152702-FFD1*/G=Andrew/S=Gordon/O=NET-TEL Computer Systems Ltd/PRMD=NET-TEL/ADMD=Gold 400/C=GB/"@MHS> To: "Ron G. Minnich" Cc: freebsd-hackers@freebsd.org In-Reply-To: Subject: Re(2): Re(2): Using rfork() / threads Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > well, i have another thing that was (ah well) offered to freebsd called > fastlock(). Fastlock was two things: > 1) test and set, which ran at memory bandwidth > 2) a system call to be called only if the lock failed, > which ran at system call speeds. Sounds just the ticket for what I need. I am quite often writing servers for one network protocol or another, where the the server holds per-user state for a large number of users, but the users typically spend much of their time asleep at the keyboard and hence a process-per-user design is wasteful, but in the absence of async I/O, a one-process design has insufficient parallelism. The ideal compromise is a small number of processes picking work off a queue - but this needs the per-user state to be shared between the processes and a means of sharing out the requests. You can do some of this with SysV SHM and semaphores, but it gets inefficient when one of the pieces of per-user state you would like to share is an open fd. rfork() and fastlock() seems a much more efficient combination, though there is a potential problem with running out of fds in a large system.