From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 21 15:05:15 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9DC1116A4CF for ; Mon, 21 Mar 2005 15:05:15 +0000 (GMT) Received: from mail.mundomateo.com (static-24-56-193-117.chrlmi.cablespeed.com [24.56.193.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5051643D55 for ; Mon, 21 Mar 2005 15:05:15 +0000 (GMT) (envelope-from matthew@digitalstratum.com) Received: from [10.0.81.14] (ws14.mundomateo.com [10.0.81.14]) by mail.mundomateo.com (Postfix) with ESMTP id 4859D60A8; Mon, 21 Mar 2005 10:05:14 -0500 (EST) Message-ID: <423EE2A3.1090509@digitalstratum.com> Date: Mon, 21 Mar 2005 10:05:07 -0500 From: Matthew Hagerty Organization: Digital Stratum User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Steve Watt References: <200503210655.j2L6tNoH063116@wattres.watt.com> In-Reply-To: <200503210655.j2L6tNoH063116@wattres.watt.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cc: hackers@freebsd.org Subject: Re: Causing a process switch to test a theory. X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: matthew@digitalstratum.com List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Mar 2005 15:05:15 -0000 Steve Watt wrote: >In <423DE326.9000203@digitalstratum.com>, > matthew@digitalstratum.com wrote: > > >>Knowing if Apache could possibly write interleaved logs when writing to >>a pipe is critical to a program I'm developing which receives log >>entries from Apache via a pipe. >> >> > >That's another layer of indirection, though. If all of the children >have separate pipes to the parent, and then the parent logs to your >program, all should be fine. > >But at the kernel level, yes, writes longer than PIPE_BUF might get >interleaved. The longer the write, the higher the probability, so >for your test, if you can generate, say, 10K writes over and over, >you can probably trip it. > > > That's an interesting idea about each child having a pipe open back to the parent, but I don't think that's what is happening. I'm pretty sure each child has the logging pipe open directly. Here is an fstat: There is a grouping like this for each Apache child process that's runing: genie httpd 61320 root / 2 drwxr-xr-x 512 r genie httpd 61320 wd / 2 drwxr-xr-x 512 r genie httpd 61320 text /usr 5110792 -rwxr-xr-x 9766440 r genie httpd 61320 0 /dev 8 crw-rw-rw- null r genie httpd 61320 1 /dev 8 crw-rw-rw- null w genie httpd 61320 2 /usr 5110968 -rw-r--r-- 494192 w genie httpd 61320 15 /usr 5110968 -rw-r--r-- 494192 w genie httpd 61320 16 /usr 5110969 -rw-r--r-- 451616 w genie httpd 61320 17 /usr 5110981 -rw-r--r-- 1056219 w genie httpd 61320 18 /usr 5111084 -rw-r--r-- 3886425 w genie httpd 61320 19* internet stream tcp c5d1e2d0 genie httpd 61320 20 /usr 5111178 prw-rw-rw- 0 w genie httpd 61320 21 /usr 5111178 prw-rw-rw- 0 w genie httpd 61320 22 /usr 5111178 prw-rw-rw- 0 w genie httpd 61320 23 /usr 5111178 prw-rw-rw- 0 w genie httpd 61320 24 /usr 5110835 -rw-r--r-- 573236 w My pipe listener (fd 0), which each child has open 4 times on fd 20 - 23: root pglogd 519 root / 2 drwxr-xr-x 512 r root pglogd 519 wd / 2 drwxr-xr-x 512 r root pglogd 519 text /usr 8528219 -rwxr-xr-x 22793 r root pglogd 519 0 /usr 5111178 prw-rw-rw- 0 rw root pglogd 519 1 /usr 5111198 -rw-r--r-- 0 r root pglogd 519 2 /usr 5111198 -rw-r--r-- 0 w root pglogd 519 3* local stream c5dcb7a8 <-> c5dcb71c Matthew