From owner-cvs-all@FreeBSD.ORG Tue Mar 4 01:57:21 2008 Return-Path: Delivered-To: cvs-all@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3EF371065674; Tue, 4 Mar 2008 01:57:21 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 3AAD38FC25; Tue, 4 Mar 2008 01:57:21 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from apple.my.domain (root@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m241vHUh099845; Tue, 4 Mar 2008 01:57:18 GMT (envelope-from davidxu@freebsd.org) Message-ID: <47CCACCB.7010900@freebsd.org> Date: Tue, 04 Mar 2008 09:58:35 +0800 From: David Xu User-Agent: Thunderbird 2.0.0.9 (X11/20071211) MIME-Version: 1.0 To: Jeff Roberson References: <200803020739.m227dNLe039427@repoman.freebsd.org> <47CBBE21.4060104@freebsd.org> <20080303022505.P920@desktop> In-Reply-To: <20080303022505.P920@desktop> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: cvs-src@FreeBSD.org, Jeff Roberson , src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/conf files src/sys/kern init_main.c kern_cpuset.c kern_thread.c syscalls.master src/sys/sys _types.h cpuset.h proc.h types.h src/lib/libc/sys Symbol.map X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Mar 2008 01:57:21 -0000 Jeff Roberson wrote: > Does the tid allocator quickly recycle numbers? Yes, I saw this behavior. > This would be different > from the pid allocator if it does. Basically every syscall that takes a > numeric id would be subject to this problem. > > I expect application programers will more often specify binding from > within the running thread using -1. > Don't know, but I feel it is more often the calling will be made for threads within same process, so searching it globally is not efficient in this case, and garbage id may hit an irrelevant thread in another process. > However, there is a seperate problem that is endemic with our current > threading support. thread_find() requires the proc lock and returns a > pointer to the found thread. However, the proc lock is not sufficient > to ensure that the thread is not exiting and recycled after > thread_find() returns. I believe virtually every user of this interface > may be subject to races. > threads are linked into or removed from process with proc lock held, why will a linked-in thread be recycled ? > And while were on the subject. Why is it lwpid_t anyway? We don't have > lwps, we have threads. > lwpid_t is used for thread id, I thought marcel introduced this type, by the way, gdb also understands lwpid_t, I have not found any problem with it, it is just an integer.