> I didn't update the io bitmap offset at all task switches.  I only covered
> stack_handoff and not switch_context.  I don't really understand what each
> is used for, but it's quite obvious that it is needed in both and testing
> verified the following change:

stack_handoff is for a context switch using a "continuation", which means
that the blocking thread doesn't need a kernel stack and instead just
stores a little state somewhere in the thread_t data structures and
supplies a function to resume the thread's operation, that is called on a
fresh kernel stack.  This is used in IPC, and anywhere you see thread_block
called with a nonzero argument (its argument is the continuation function).
Any place it can, a thread drops its kernel stack in this way so that the
(unpageable) kernel memory for the stack is not consumed by blocked
threads, which effectively increases the number of threads you can have by
a great deal (most of the long blocks, like IPC and page faults and such,
will not need a kernel stack).

switch_context is for a normal thread switch where the blocking thread's
kernel stack is kept and returned to when the thread resumes.


_______________________________________________
Bug-hurd mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-hurd

Reply via email to