inquiry

Julian Elischer julian at elischer.org
Fri Nov 14 10:41:46 PST 2008


Ivan Voras wrote:
> Sam Xia wrote:
>> Dear all,
>>
>> I am a new comer to FreeBSD kernel. I am reading code of FeeBSD  kernel.
>> who can help me explain the purpose/usage/aciton of routine
>> "thread_single()" in kern_thread.c of FreeBSD7.0?
> 
> Have you read the comment describing the function (it's there
> immediately before the function)?
> 


I wrote that a long time ago, and things have changed a lot
since then, but.. There are times, in a threaded process,
when a thread making some change to teh state of the process
must ensure that no other threads are running.

There are several variants of this:
An example of this is:

Your thread is calling exit (or exec) and all the other threads
must stop. now, they can't just bekilled (at least those in the
kernel can't) as they may hold resources in the kernel that need to
be released, so they are asked to suicide after releasing their
resources. Your thread is allowed to proceed when there ar eno other 
threads alive. (in your process)

Your thread is going to do some other action that requires no memory
changes in the user space, or resources be stable..
I this case it will allow you to continue when all other threads
have suspended at the user boundary.(where they are guaranteed
to not hold resources).




More information about the freebsd-smp mailing list