libkse and SMP (was Re: USB bulk read & pthreads)

Daniel Eischen eischen at pcnet1.pcnet.com
Fri May 23 23:42:10 PDT 2003


On Sat, 24 May 2003, Valentin Nechayev wrote:
> DE> I'm not sure if what you meant here, but here's a (hopefully)
> DE> clearer explanation.
> 
> DE> All threads that are created with PTHREAD_SCOPE_PROCESS
> DE> (the default) will run in the same (initial) KSEG.  The
> DE> initial KSEG will have as many KSEs as CPUs by default.
> DE> When a scope process thread blocks in the kernel, upcalls
> DE> are made to the originating KSE and a new thread is scheduled.
> DE> When scope process threads unblock in the kernel, upcalls
                         ^^^^^^^ plural

> DE> are made to one or more of the same KSEs within the initial
> DE> KSEG to notify the library that the threads can be resumed.
> 
> DE> Each scope system thread gets its own KSE/KSEG pair in which
> DE> to run.
> 
> Sorry, I again lost understanding of this ;((
> Consider system with single CPU and 2 threads (with process scope) which
> both calls blocking disk read. Can the second thread block in read()
> before first thread returns from blocking read()? Or system scope
> is required for this?

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 Eischen



More information about the freebsd-hackers mailing list