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)
commitd4c30c6a386fe850e7eed1025e459fbc82a0b6e2
tree15a5aaec7e569da79b34d8f3908e3a08f0271598
parent17102846d22591590c37548f8514067e2be6c5f6
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!
25 files changed:
doc/threads.texi
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