Re: Understanding NSPR threads
Nelson Bolyard <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.nspr |
|---|---|
| Message-ID | <[email protected]> |
Wan-Teh Chang wrote, On 2008-07-22 16:55: > On Tue, Jul 22, 2008 at 7:58 AM, Joachim Ziegler <[email protected]> wrote: >> What is a "global bound kernel thread"? > > I suggest that you just use PR_GLOBAL_THREAD. > > NSPR's terminology here is unfortunately incorrect. > > PR_LOCAL_THREAD is a user-level thread scheduled by NSPR > itself. Here "local" means such threads contend for CPU time > within the same process (locally), as opposed to globally with > the threads in other processes. > > PR_GLOBAL_THREAD is the one that is unfortunately misnamed. > PR_GLOBAL_THREAD does not mean a "global thread". It means > a native thread, which may be a local or global thread. > > Because of this misnaming, we had to add PR_GLOBAL_BOUND_THREAD > to let our users request specifically a global thread. The name "BOUND" > came from the old Solaris thread API, which calls global threads > "bound threads". > > Note that the two-level thread scheduling is going out of fashion. > These days all the native thread libraries offer global threads only. > Global threads are scheduled by the kernel and contend for CPU > time globally with the threads in the other processes. > > In summary, you should just use PR_GLOBAL_THREAD. It > means "give me a native thread, I don't care whether it is a > local thread or global thread". Wan-Teh, this post contained information that I have never seen before, despite having worked with NSPR for over 10 years. Please put this in a wiki page, or somewhere where it will be captured for posterity.