MIT6.S081(13)-Coordination (sleep&wakeup)
MIT6.S081(13)-Coordination (sleep&wakeup) plan Re-emphasize a few points about xv6 thread switching sequence coordination sleep & wakeup lost wakeup problem termination Why hold p->lock across swtch()? this is an important point and affects many situations in xv6 [diagram: P1, STACK1, swtch, STACK_SCHED] yield: acquire(&p->lock); p->state = RUNNABLE; swtch(); scheduler: swtch(); release(&p->lock); the main point of holding p->lock across swtch(): prevent another core’s scheduler from seeing p->state == RUNNABLE until after the...