Fix two bugs in the base Pintos code:
authorBen Pfaff <blp@cs.stanford.edu>
Mon, 25 Sep 2006 20:26:35 +0000 (20:26 +0000)
committerBen Pfaff <blp@cs.stanford.edu>
Mon, 25 Sep 2006 20:26:35 +0000 (20:26 +0000)
commit92866b2056d927d32ea6343bd62eed25e4c6b612
tree6b71d25bb2bb765e4ca18cf898bafa892559c789
parent3b6ef3f86bdb454cca9a5ce62c1845f019dba46a
Fix two bugs in the base Pintos code:

1. Idle thread doesn't get initialized well: it hangs around on the
   ready list until we have idle time.  Fix by using a semaphore to
   make sure the idle thread gets initialized.

2. After idle thread does get initialized, it can get put back on the
   ready list if you yield from the timer interrupt.  Fix by not ever
   putting the idle thread on the ready list.

Plus fix a bug in the sample solution that tends to mask #2:

3. Doesn't yield from timer interrupt when unblocking a thread.  Fix
   by yielding from timer interrupt when unblocking a thread (of
   higher priority).

Also, fix something that confused students:

4. Rename enable_mlfqs to thread_mlfqs and move it to thread.c (to
   reduce confusion about where it is declared), and heavily comment
   to ensure that students know when it gets initialized.

These problems were drawn to my attention by Godmar Back.  Thanks!
26 files changed:
doc/threads.texi
solutions/p1.patch
src/tests/threads/alarm-priority.c
src/tests/threads/alarm-simultaneous.c
src/tests/threads/alarm-wait.c
src/tests/threads/mlfqs-block.c
src/tests/threads/mlfqs-fair.c
src/tests/threads/mlfqs-load-1.c
src/tests/threads/mlfqs-load-60.c
src/tests/threads/mlfqs-load-avg.c
src/tests/threads/mlfqs-recent-1.c
src/tests/threads/priority-change.c
src/tests/threads/priority-condvar.c
src/tests/threads/priority-donate-lower.c
src/tests/threads/priority-donate-multiple.c
src/tests/threads/priority-donate-multiple2.c
src/tests/threads/priority-donate-nest.c
src/tests/threads/priority-donate-one.c
src/tests/threads/priority-donate-sema.c
src/tests/threads/priority-fifo.c
src/tests/threads/priority-preempt.c
src/tests/threads/priority-sema.c
src/threads/init.c
src/threads/init.h
src/threads/thread.c
src/threads/thread.h