From owner-freebsd-hackers@FreeBSD.ORG Sat Jun 4 12:27:04 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F088B1065674; Sat, 4 Jun 2011 12:27:04 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) by mx1.freebsd.org (Postfix) with ESMTP id 9109A8FC1A; Sat, 4 Jun 2011 12:27:04 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id 853E71DD789; Sat, 4 Jun 2011 14:27:03 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id 796E6173E4; Sat, 4 Jun 2011 14:27:03 +0200 (CEST) Date: Sat, 4 Jun 2011 14:27:03 +0200 From: Jilles Tjoelker To: Julien Laffaye Message-ID: <20110604122703.GB33796@stack.nl> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-hackers@freebsd.org, Buganini , FreeBSD Current Subject: Re: [RFC] rcexecr: rcorder in parallel X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 12:27:05 -0000 On Sat, Jun 04, 2011 at 12:45:37PM +0100, Julien Laffaye wrote: > On Sat, Jun 4, 2011 at 10:10 AM, Buganini wrote: > > https://github.com/buganini/rcexecr > > Currently it is able to determine the exec/wait order > > There are something I haven't digged in deeply in the "self > > modification" part. > > patches/ideas are welcome. > Thanks for doing that! Yes. > You should use kqueue(2) instead of waitpid(2) so that you can > efficiently monitor a pool of processes. > See pwait(1) for an example. Hmm, I don't think kqueue() should be used here. Its main advantage is that it works regardless of parent-child relationships, but that advantage is not relevant here. On the other hand, waitpid() is still necessary to get rid of the zombies. Furthermore, waitpid() is standard while kqueue() is not, and I think non-standard interfaces should only be used if they provide a real benefit above standard interfaces. The current approach with waitpid() for specific processes should be good enough for a proof of concept. It will keep zombies longer than necessary, particularly for things that are not explicitly depended on. To avoid this, use waitpid(-1, ...) and maintain more tracking for processes that have already terminated. -- Jilles Tjoelker