From owner-freebsd-net Mon Jun 24 14:50:44 2002 Delivered-To: freebsd-net@freebsd.org Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by hub.freebsd.org (Postfix) with ESMTP id 1D0DC37B401 for ; Mon, 24 Jun 2002 14:50:42 -0700 (PDT) Received: by elvis.mu.org (Postfix, from userid 1192) id E8D0FAE163; Mon, 24 Jun 2002 14:50:41 -0700 (PDT) Date: Mon, 24 Jun 2002 14:50:41 -0700 From: Alfred Perlstein To: Julian Elischer Cc: net@freebsd.org Subject: Re: apache and option USE_FLOCK_SERIALIZED_ACCEPT Message-ID: <20020624215041.GA53232@elvis.mu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.27i Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org * Julian Elischer [020624 14:20] wrote: > > for FreeBSD we seem to get this option set.. > > this seems bogus.. > > it assumes that multiple processes can't listen on the accept > at one time... > > does anyone know if FreeBSD is safe for having multiple processes do > accept() on the same listenning socket? > > My perusal of the code suggests it should be but > I'm unsure why the option is set by default for FreeBSD. > > WHat it does is allow only one process to do an accept at one time, > by using a file flock() as a semaphore... > > seems to be it should be un-needed. > > am I dreaming? what am I missing? Having multiple processes blocked in accept(2) is ok, however having multiple processes blocking in select(2) on the same objects can cause select collisions which cause superfolous wakeup()s and much pain. The flock when listening on multiple sockets mitigates this _somewhat_, but still causes all processes to be woken up each time an accept succeeds because the flock is dropped. I think by using some sort of signalling between a single process doing select and the rest which get a signal telling them to call accept, or perhaps using fd passing might work better, but I'm unsure as I haven't had the time to actually do these modifications. Basically using some token passing mechanism instead of a broadcast system, however doing so introduces complexity of course. :) -- -Alfred Perlstein [alfred@freebsd.org] 'Instead of asking why a piece of software is using "1970s technology," start asking why software is ignoring 30 years of accumulated wisdom.' Tax deductible donations for FreeBSD: http://www.freebsdfoundation.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message