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