From owner-freebsd-smp Thu Apr 8 15:46: 7 1999 Delivered-To: freebsd-smp@freebsd.org Received: from implode.root.com (root.com [209.102.106.178]) by hub.freebsd.org (Postfix) with ESMTP id A528114F03 for ; Thu, 8 Apr 1999 15:45:59 -0700 (PDT) (envelope-from root@implode.root.com) Received: from implode.root.com (localhost [127.0.0.1]) by implode.root.com (8.8.8/8.8.5) with ESMTP id PAA21435; Thu, 8 Apr 1999 15:41:51 -0700 (PDT) Message-Id: <199904082241.PAA21435@implode.root.com> To: Tony Finch Cc: Marc Slemko , smp@FreeBSD.ORG Subject: Re: concurrent select()s on listen socket broken under SMP In-reply-to: Your message of "Thu, 08 Apr 1999 21:48:38 BST." <14093.5670.813002.917842@chiark.greenend.org.uk> From: David Greenman Reply-To: dg@root.com Date: Thu, 08 Apr 1999 15:41:51 -0700 Sender: owner-freebsd-smp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Marc Slemko writes: >> >> There is a race condition in the idea that having multiple processes doing >> a select() then an accept() on the same descriptor should always result in >> an accept() for each success from accept(). It is not an OS problem, >> although various OSes may behave in different ways. >> >> This is one of the reasons why Apache uses an "accept mutex". It >> essentially does the same thing if you have multiple listening sockets. > >Ah, I have heard of this before then, although I didn't think it would >have this kind of effect. I had a quick dig around the kernel code to >see if there were any likely changes that I could make. What breaks if >I change the wakeup((caddr_t)&sb->sb_cc); in sowakeup() (line 319 of >uipc_socket2.c) to a wakeup_one()? In addition to the other comments that have already been made, I would like to also point out that wakeup_one() wakes "at least one process", not "at most one process". It can and will wakeup more than one process depending on process states. -DG David Greenman Co-founder/Principal Architect, The FreeBSD Project - http://www.freebsd.org Creator of high-performance Internet servers - http://www.terasolutions.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message