* David Petrou <[EMAIL PROTECTED]> [001127 14:10] wrote:
> hi.  i've searched the handbook, tutorial, FAQ, and parts of the
> mailing list archives but haven't found direct answers to the
> following questions.  i hope you don't mind answering them for me; it
> will save me a lot of time looking through the code, and / or writing
> test cases:
> 
> let's say i'm running 4.x-stable.
> 
> 1. if i use the pthreads interface, is each thread a process that
>    happens to share the same addr space (like linux), or are all the
>    threads part of the same single process (same PID)?

The latter.

> 2. is the threading preemptive?  or do i have to explicitly yield?

Former.

> 3. if preemptive, does that occur at user-level, or by the kernel?
>    (and how costly is it?)

It's a mix, and very cheap.

> 4. if one thread makes a system call that could block for some time,
>    will another thread be automatically chosen?  or will the whole
>    collection of threads sleep until the call returns?

Latter.  However our threads model wraps most syscalls so that you
shouldn't block, you can still block on disk IO, however I have 
a proposal that I (or someone else) might implement in the near
future to fix this.

> 5. if i signal a particular thread, is the signal delivered to one
>    thread or to all the threads in the process?

We should follow the pthreads standard for this, check the standard.

> 6. if a thread or process (terminology sucks) enters the kernel, can
>    the scheduler preempt it and select another thread / process to
>    run?  (q.v., what many people call having kernel threads.)  or will
>    that process / thread dominate the system until it voluntarily
>    relinquishes the processor?

Latter.

> 7. are there other threads interfaces besides pthreads that i should
>    be aware of?  what are the differences?  e.g., assuming freebsd
>    supports a clone()-like interface, do some threads packages use it
>    while others do as much as they can without kernel support?

the native threads are what conforms to the answers I have you above,
there's a port called "linux-threads" in the ports collection to
do what Linux does (clone()-like pid-per-thread)

> i'm probably forgetting some questions, but these are the bulk.  i'm
> just wondering what the current thread model is as i contemplate
> moving my development to FreeBSD.

Well you have a choice between our threads model and the Linux model
on FreeBSD.  I've been contemplating some changes that would 
speed up our threads with regards to disk/IO, but that's a way
off.

-- 
-Alfred Perlstein - [[EMAIL PROTECTED]|[EMAIL PROTECTED]]
"I have the heart of a child; I keep it in a jar on my desk."


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to