From owner-freebsd-threads@FreeBSD.ORG Wed Apr 30 19:28:58 2003 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C240C37B401 for ; Wed, 30 Apr 2003 19:28:58 -0700 (PDT) Received: from stork.mail.pas.earthlink.net (stork.mail.pas.earthlink.net [207.217.120.188]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2582F43F3F for ; Wed, 30 Apr 2003 19:28:58 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from pool0055.cvx22-bradley.dialup.earthlink.net ([209.179.198.55] helo=mindspring.com) by stork.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 19B3oc-0000zp-00; Wed, 30 Apr 2003 19:28:55 -0700 Message-ID: <3EB0845A.FA34BA04@mindspring.com> Date: Wed, 30 Apr 2003 19:20:10 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Peter Wemm References: <20030501011103.6E20D2A7EA@canning.wemm.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a4597a39441ee09a0dc8aa378bbcc7e9f0350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c cc: threads@freebsd.org cc: Daniel Eischen Subject: Re: Question about rtld-elf. Anyone?.. Anyone? X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 May 2003 02:28:59 -0000 Peter Wemm wrote: > As John said, the problem is twofold. One is the symbol resolution itself, > eg: when you access a function for the first time, a lazy binding call > happens. He had ideas about how to make that fully reentrant. It doesn't need to be; the pointer update is atomic, so it's safe for two threads in the same process at the same time (or there would have been much more spectacular fireworks, before now), and if it happens over a fork(), then the child process gets a stale copy, and does the lazy binding call itself, triggering a COW in the page where the lazy-bound verion should have been. Either way, it still works (you just get an extra page in the child that you wouldn't have had, had you waited). > The second problem was preventing dlopen() and friends being > called in parallel. It sounds like you've dealt with only the > second problem... I don't think the first problem needs to be dealt with at all; I don't think dealing with the second problem is something you want anyway (see other post, and see chapter 12 of the corrigenda). I think the real prolem is that the threaded code in question is broken, and thinks that the thread that was involuntarily preempted should be restarted, instead of the highest priority thread available, when it gets its next quantum. In other words, the code was written to expect a specific type of pthreads implementation, and is failing to comply with POSIX. -- Terry