Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Jul 2004 15:19:06 -0700
From:      Marcel Moolenaar <marcel@xcllnt.net>
To:        "Georg-W. Koltermann" <gwk@rahn-koltermann.de>
Cc:        freebsd-emulation@freebsd.org
Subject:   Re: how to implement linux_gettid
Message-ID:  <20040720221906.GA28599@ns1.xcllnt.net>
In-Reply-To: <1090360772.1047.5.camel@localhost.muc.eu.mscsoftware.com>
References:  <1090273635.1511.15.camel@localhost.muc.eu.mscsoftware.com> <20040719215845.GA12055@dhcp50.pn.xcllnt.net> <1090360772.1047.5.camel@localhost.muc.eu.mscsoftware.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Tue, Jul 20, 2004 at 11:59:33PM +0200, Georg-W. Koltermann wrote:
> Am Mo, den 19.07.2004 schrieb Marcel Moolenaar um 23:58:
> > On Mon, Jul 19, 2004 at 11:47:15PM +0200, Georg-W. Koltermann wrote:
> > > 
> > > Could someone explain how our threading works when accessed from Linux,
> > > and maybe give me a hint how gettid() should be implemented correctly?
> > 
> > It depends. If user threading under linux compatibility is still
> > implemented using fork(2), then you'll have a process per user thread.
> > In that case it doesn't matter how threading is natively implemented.
> 
> I am not quite sure.  I see that i386/linux/syscalls.master has fork,
> vfork, and clone.  clone is implemented by calling fork1().  Does this
> make sure that Linux threading is implemented using fork()?

You want to look at what the threading library calls when it needs
to create a new thread. I think this will be clone(2) and if it is,
then threading is basicly implemented using fork(1) and the thread
IDs is the process ID.

> Or could it depend on the application or library layer, e.g. libpthread
> in linux_base?

Yes. See above.

-- 
 Marcel Moolenaar	  USPA: A-39004		 marcel@xcllnt.net



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040720221906.GA28599>