From owner-freebsd-arch@FreeBSD.ORG Wed Mar 26 01:33:59 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9542F37B404 for ; Wed, 26 Mar 2003 01:33:59 -0800 (PST) Received: from park.rambler.ru (park.rambler.ru [81.19.64.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2663843F85 for ; Wed, 26 Mar 2003 01:33:58 -0800 (PST) (envelope-from is@rambler-co.ru) Received: from is.park.rambler.ru (is.park.rambler.ru [81.19.64.102]) by park.rambler.ru (8.12.6/8.12.6) with ESMTP id h2Q9XqmF056582; Wed, 26 Mar 2003 12:33:52 +0300 (MSK) Date: Wed, 26 Mar 2003 12:33:52 +0300 (MSK) From: Igor Sysoev X-Sender: is@is To: Jeff Roberson In-Reply-To: <20030325214028.K64602-100000@mail.chesapeake.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Status: No, hits=-25.3 required=5.0 tests=EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REPLY_WITH_QUOTES,USER_AGENT_PINE autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) cc: arch@FreeBSD.ORG Subject: Re: 1:1 Threading implementation. X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Mar 2003 09:34:00 -0000 On Tue, 25 Mar 2003, Jeff Roberson wrote: > I realize that many people have strong feelings on this topic. I'm asking > everyone up front to try not to devolve this thread into a bikeshed. > > Thanks to the foundation provided by Julian, David Xu, Mini, Dan Eischen, > and everyone else who has participated with KSE and libpthread development > Mini and I have developed a 1:1 threading implementation. This code works > in parallel with KSE and does not break it in any way. It actually helps > bring M:N threading closer by testing out shared bits. I'm very glad to see two kind of the kernel supported threads in FreeBSD. > The condition variables and other blocking situations are handled with > sig*wait*() and a new signal, SIGTHR. There are many reasons that we went > with a signal here. If anyone cares to know them, you may ask. I ask :) > There are only 4 system calls for threading. thr_create, thr_self, > thr_exit, and thr_kill. The rest of the functionality is implemented in a > library that has been heavily hacked up from the original libc_r. I think thr_create() should have a optional capability to create a thread's stack. This allow to save one syscall because otherwise you need to call mmap() or malloc()/sbrk() before the_create(). I think that thr_self() should be implemented in the user land. It's used in pthread_getspecific(), pthread_setspecific(), and gcc3's __thread attribute and can be used very often and should be very cheap. Solaris uses gs register on x86 and %g7 register on Sparc. Linux also uses gs register on x86, other platforms implementation details can be found here - http://people.redhat.com/drepper/tls.pdf Win32 and OS/2 use fs register. As far as I know FreeBSD 4.x uses gs to proc in a kernel and 5.x uses fs for some per-CPU data in a kernel. I think we should use one of these register to point to the thread specific data in the user land. > I'd like to get the signal code commited asap. It's the majority of the > patch and I often have to resolve conflicts. There have been no > regressions in KSE or non threaded applications with this signal code. Did this signal code supports siginfo ? FreeBSD 4.x fills zeros in the most siginfo's fileds. Igor Sysoev http://sysoev.ru/en/