Date: Mon, 27 Nov 2000 14:27:22 -0800 From: Alfred Perlstein <bright@wintelcom.net> To: David Petrou <dpetrou@cs.cmu.edu> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: thread model questions Message-ID: <20001127142722.Q8051@fw.wintelcom.net> In-Reply-To: <20001127171031.D417@auchroisk.pdl.cs.cmu.edu>; from dpetrou@cs.cmu.edu on Mon, Nov 27, 2000 at 05:10:31PM -0500 References: <20001127171031.D417@auchroisk.pdl.cs.cmu.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
* David Petrou <dpetrou@cs.cmu.edu> [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 - [bright@wintelcom.net|alfred@freebsd.org] "I have the heart of a child; I keep it in a jar on my desk." To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001127142722.Q8051>