Skip to search.
freebsd-hackers · Technical Discussions about FreeBSD

Group Information

  • Members: 100
  • Category: Open Source
  • Founded: Aug 7, 1998
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Messages

  Messages Help
Advanced
Re: libkse and SMP (was Re: USB bulk read & pthreads)   Message List  
Reply Message #62664 of 95472 < Prev |
Re: libkse and SMP (was Re: USB bulk read & pthreads)

On Fri, 23 May 2003, Terry Lambert wrote:

> Daniel Eischen wrote:
> > This is just because rtld-elf is not thread safe (or written
> > so that locks are not needed as you claim).
>
> No. There is plenty of code that falls into this category; as
> soon as you finish fixing rtld, you will reveal other problems.
> Mark my words; you cannot make user space thread safe for all
> eventualities, with the user process never having to know
> anything about mutexes that the pthreads model expects the user
> program to hold in order to ensure against race conditions.

We can easily correct for dlfoo() being called by
different threads concurrently, so I don't include
that in being "thread-safe".

As it stands now, rtld-elf is not thread-safe even
without calls to dlfoo().

> > > The second of these is that the libkse model is M:N, with N being
> > > defaulted to 1. If you want more kernel threads, you have to ask
> >
> > N is defaulted to the number of CPUs that you have. Libkse
> > will create as many KSEs as there are CPUs (or whatever
> > kern.threads.virtual_cpu is set to); these will be KSEs
> > that run scope process threads. Scope system threads
> > get their own KSE/KSEG pair without regard to number of
> > CPUs or kern.threads.virtual_cpu.
> >
> > Trying to exceed the number of CPUs with kern.threads.virtual_cpu
> > will not work unless you also set kern.threads.debug=1. You
> > really shouldn't need to do this, but we use it for testing
> > and debugging.
>
> This is handy to know; so basically, my expectation from
> reading the code around PTHREAD_SCOPE_SYSTEM was correct:
> a single CPU system with PTHREAD_SCOPE_PROCESS (the default)
> can still get itself blocked in the kernel by a single
> blocking call (as in the USB bulk read device issue).

If I am reading you correctly, then no. Scope process
threads will block in the kernel, but upcalls will be
made to the originating KSE and new threads will be
scheduled.

--
Dan Eischen

_______________________________________________
freebsd-hackers@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..."



Fri May 23, 2003 8:22 pm

eischen@...
Send Email Send Email

Message #62664 of 95472 < Prev |
Expand Messages Author Sort by Date

... We can easily correct for dlfoo() being called by different threads concurrently, so I don't include that in being "thread-safe". As it stands now,...
Daniel Eischen
eischen@... Send Email
May 23, 2003
8:25 pm

... I'm not sure if what you meant here, but here's a (hopefully) clearer explanation. All threads that are created with PTHREAD_SCOPE_PROCESS (the default)...
Daniel Eischen
eischen@... Send Email
May 23, 2003
8:33 pm

Fri, May 23, 2003 at 16:33:07, eischen (Daniel Eischen) wrote about "Re: libkse and SMP (was Re: USB bulk read & pthreads)": DE> I'm not sure if what you meant...
Valentin Nechayev
netch@... Send Email
May 24, 2003
6:18 am

... no, PROCESS scope threads can block and control will return to the userland thread scheduler to allow it to schedule another thread. In other words, the...
Julian Elischer
julian@... Send Email
May 24, 2003
6:39 am

... Multiple scope process threads can be blocked in the kernel at the same time. This does not prevent other scope process threads from being run. -- Dan...
Daniel Eischen
eischen@... Send Email
May 24, 2003
6:42 am

... That's what I said. 8-). -- Terry _______________________________________________ freebsd-hackers@... mailing list ...
Terry Lambert
tlambert2@... Send Email
May 24, 2003
5:21 am

... I'm rereading it, but I don't see that interpretation. I guess if both you and Julian both called me on it, I must have misexpressed myself, but I...
Terry Lambert
tlambert2@... Send Email
May 24, 2003
5:24 am

... I think it was the part about "a single CPU system with PTHREAD_SCOPE_PROCESS (the default) can still get itself blocked in the kernel by a single blocking...
Daniel Eischen
eischen@... Send Email
May 24, 2003
6:36 am

... OK... this I don't get. If the scope is process, and you are implementing M:N, and N == 1, my understanding of the code is that it will block exactly the...
Terry Lambert
tlambert2@... Send Email
May 24, 2003
9:57 am

... It will not behave the same as libc_r. When a thread blocks in the kernel, the kernel issues an upcall to the library (on the same KSE) and the library...
Daniel Eischen
eischen@... Send Email
May 24, 2003
3:43 pm
Advanced

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help