Return-Path: Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 99298 invoked by uid 500); 26 Apr 2002 15:46:37 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 99280 invoked from network); 26 Apr 2002 15:46:36 -0000 Message-ID: <00b201c1ed39$ed7ee640$50381b09@sashimi> From: "Bill Stoddard" To: References: <20020426051229.48294.qmail@icarus.apache.org> <00a201c1ed36$b7732c80$50381b09@sashimi> Subject: Re: cvs commit: httpd-2.0 STATUS Date: Fri, 26 Apr 2002 11:49:13 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N > > + * The worker MPM should not accept more connections than it > > + currently has available workers. Instead, the listener thread > > + should block on a condition of the fdqueue such that it waits > > + until there are at least one idle worker before continuing > > + into the accept-loop. > > Here is an alternate idea... keep track of the number of available workers with a counter. > If the accept loop detects that the number of available workers has dropped to 0, the > accept thread simply yields it's quanta. Very simple and no overhead associated with a > condition variable. Something like this: > > if (!avail_workers) { > yield(); /* or what ever the Unix call is. I know there must be one */ > continue; > } > else { > accept(); > } > > Bill Forgot to mention what is probably obvious... this is not a perfect solution because of race conditions between the threads incrementing/decrementing avail_workers and the listener thread doing the checking. It narrows the exposure but does not eliminate it entirely. Bill