Subject: Re: lwp_emuldata
To: Bill Studenmund <wrstuden@netbsd.org>
From: Emmanuel Dreyfus <manu@netbsd.org>
List: tech-kern
Date: 12/11/2003 21:14:42
Bill Studenmund <wrstuden@netbsd.org> wrote:

> > Within a task, each thread also has a kernel port, which is used to perform
> > thread specific operations. You can use that to read and write a thread's
> > register, or to stop and unstop it remotely. gdb makes intesnive use of
> > that, but a program can also use it internally, for instance to suspend and
> > resume a given thread.
> 
> Is Mach using the same kind of SA thread structure we are? If not, how are
> you coordinating mapping their threading model (and pthreads library) on
> to our kernel?

It seems they do. Some header files talk about "activations".

Mach has tasks and threads. Task are equivalent to our processes, I
can't think of any difference right now.

On MacOS X, at the library level, you use pthread_create(). This is
turned into sending a Mach message on the tasks's kernel port using the
mach_msg() system call. The message contains the new thread machine
state (all registers can be set here).

The kernel creates the thread and sends a reply message with the new
thread's kernel port. 

-- 
Emmanuel Dreyfus
Il y a 10 sortes de personnes dans le monde: ceux qui comprennent 
le binaire et ceux qui ne le comprennent pas.
manu@netbsd.org