kernel threads as threads.

Julian Elischer julian at
Sun Jan 22 17:19:44 PST 2006

David Xu wrote:

> Julian Elischer wrote:
>> I have made a first set of changes to allow threads to be 'forked' 
>> within the kernel.
>> I have run on the resulting kernel for some of today with no problems 
>> other than
>> some statistics oddness in top which I plan on looking at next week.
>> The current patch doen't remove the ability to make kernel processes, 
>> however it does
>> add the ability to make threads under process 0 and alters nearly all 
>> the users of
>> kernel threads to actually do this.. The exception is the aio 
>> threads, as they seem to require
>> separate address spaces to work with and that requires separate proc 
>> structures.
>> I was thinking that they could act as extra threads on the calling 
>> processes but that
>> is more of a rewrite than I plan right now.
>> Anyhow the diffs so far are at:
>> more later.
>> julian
> in vfs_aio.c, we have to borrow user process's vmspace,  creating all 
> kthread in
> proc0 breaks this.

yes you should find that the newest patches revert this change.
(if they do not then I have not uploaded the newest patches..)

I just looked.... The newest patches are at

They retain the ability to make a kernel process as well as a kernel 
thread, and they use
the process ability to make the process for aio.

I found this on friday ;-)

However the abiolity to make a thread shoudl ebused in the following 

an aio request shouild spawn a separate KSEGRP on teh calling process 
and make a
separate thread that is actually owned by the requesting process. The 
calling process
doesn't know about the new thread. It makes AIO extensible to as many 
processes as you want
and if ther ei more work you can even make multiple working threads in 
the ksegrp
(maybe one per filesystem )

just an idea.

It's gotta be better than grafting a thread onto processes VMs on the fly.

> David Xu
> _______________________________________________
> freebsd-current at mailing list
> To unsubscribe, send any mail to 
> "freebsd-current-unsubscribe at"

More information about the freebsd-current mailing list