Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IOFIES Filter wakeup (was: why no IOSimpleLockSleep()?)



Godfrey van der Linden writes:
 > Continuations are an optimisation in thread context switching.  When  
 > you block a thread using thread_block(NULL) the kernel knows that you  
 > are coming back to this thread and stack at some time in the future  
 > and saves all sorts of information on the stack and makes sure the  
 > stack doesn't get used for any other purpose.
 > 
 > When you usel continuations you are telling the dispatcher that you  
 > wont need the stack anymore and it can go back to the pool of  
 > available stacks.  The contract is that your thread can re-establish  
 > its state from the continuation argument.  Hence when your thread  
 > starts running again it will have a brand new stack and a couple of  
 > arguments with which to re-establish state.  This is way cool.
 > 
 > In the interrupt path (i.e. the IOInterruptEventSource/IOWorkLoop) we  
 > don't return the stack to a pool, all work loops have dedicated  
 > threads with stacks, however the dispatcher can be slightly optimised  
 > as it has no need to save any CPU state into the thread's save area.   
 > As I said it isn't much of an optimisation but every bit counts.


Yes, its pretty cool once you understand what's going on.  Your
explanation was great.  

>From some googling, it looks like this is a "mach thing", as I've
found Mach papers from the early 90s that talk about continuations at
stack handoff... 

Anyway, nice work on all the speedups!

Drew
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-drivers mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-drivers/email@hidden

This email sent to email@hidden

References: 
 >why no IOSimpleLockSleep()? (From: Andrew Gallatin <email@hidden>)
 >IOFIES Filter wakeup (was: why no IOSimpleLockSleep()?) (From: Godfrey van der Linden <email@hidden>)
 >Re: IOFIES Filter wakeup (was: why no IOSimpleLockSleep()?) (From: Andrew Gallatin <email@hidden>)
 >Re: IOFIES Filter wakeup (was: why no IOSimpleLockSleep()?) (From: Godfrey van der Linden <email@hidden>)
 >Re: IOFIES Filter wakeup (was: why no IOSimpleLockSleep()?) (From: Andrew Gallatin <email@hidden>)
 >Re: IOFIES Filter wakeup (was: why no IOSimpleLockSleep()?) (From: Andrew Gallatin <email@hidden>)
 >Re: IOFIES Filter wakeup (was: why no IOSimpleLockSleep()?) (From: Chris Sarcone <email@hidden>)
 >Re: IOFIES Filter wakeup (was: why no IOSimpleLockSleep()?) (From: Andrew Gallatin <email@hidden>)
 >Re: IOFIES Filter wakeup (was: why no IOSimpleLockSleep()?) (From: Godfrey van der Linden <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.