kernel thread as real threads..

Julian Elischer julian at
Mon Jan 23 16:20:43 PST 2006

Robert Watson wrote:

> On Mon, 23 Jan 2006, Julian Elischer wrote:
>> it would be no different from when a threaded process exits now..
>> With the current setup you have a whole set of worries about what to 
>> do about the thread responds when the process has already died.  
>> These worries are aqctually simplified if the thread is part of the 
>> process. (at least I believe this to be the case).
> It would be good to know what the aio specs say (and what real 
> applications expect) to happen on the current set of "single 
> threading" events:
> - exec

the outstanding operation must be aborted.. the address space it is 
aimed at is being wiped..

> - fork (although davidxu is changing that)

well, the operation woudll continue for the parent only I woudl assume.

> (although davidxu is changing that) 

I'm not convinced that that multiple threads should be allowed to 
proceed during a fork
but I can see that not allowing it is more a "foot shooting avoidance" 
than a requirement.
it could be allowed that if you do a fork and allow multipel threads to 
runat the same time
and end up with an inconsistant address space in the child, then you get 
what you deserve.

> - exit

I think that's it.. It's certainly the 3 places we try single-thread.
For exit, you allow the operation to complete as far as the buffer cache
but you don't allow the thread to write it back to the address space.
Writing back to the buffer cache (or whatever we call it now) should 
proceeed even if the
thread has died.

> And any others I don't remember.  We may find we need to perform an 
> aio drain wait there if we switch to doing AIO in the process context.

I don't think so..
IO is really 2 stage:

for read, data is read into the cache by standard async kernel code.
then the thread wakes up and writes it to the user space.
if the thread has died the async request is still allowed to complete. I 
believe this is
the current state of affairs if a process gets a signal after requesting 
data from the filesystem,
but before the filesystem has delivered it from teh device.

The IO operation os not aborted, but the data is not used after it has 
been deleivered to the buffer cache.

> Robert N M Watson
> _______________________________________________
> freebsd-current at mailing list
> To unsubscribe, send any mail to 
> "freebsd-current-unsubscribe at"

More information about the freebsd-current mailing list