Frans Kaashoek 26f306113a Fix a lost wakeup bug: the disk driver's wakeup() can run after the
reading process acquired p->lock and released virtio lock in sleep(),
but before the process had set p->status to SLEEPING, because the
wakeup tested p->status without holding p's lock.  Thus, wakeup can
complete without seeing any process SLEEPING and then p sets p->status
to SLEEPING.

Fix some other issues:

- Don't initialize proc lock in allocproc(), because freeproc() sets
np->state = UNUSED and allocproc() can choose np and calls initlock()
on the process's lock, releasing np's lock accidentally.  Move
initializing proc's lock to init.

- Protect nextpid using ptable.lock (and move into its own function)

Some clean up:
- Don't acquire p->lock when it p is used in a private way (e.g., exit()/grow()).
- Move find_runnable() back into scheduler().
2019-07-02 19:29:14 -04:00
..
2019-06-13 06:57:38 -04:00
2019-06-11 09:57:14 -04:00
2019-06-13 10:29:27 -04:00
2019-06-11 09:57:14 -04:00
2019-06-13 10:29:27 -04:00
2019-06-13 10:29:27 -04:00
2019-06-13 10:29:27 -04:00
2019-06-13 06:49:02 -04:00
2019-06-13 06:49:02 -04:00
2019-06-11 09:57:14 -04:00
2019-06-13 06:57:38 -04:00
2019-06-13 09:40:17 -04:00
2019-06-13 09:40:17 -04:00
2019-06-13 10:29:27 -04:00
2019-07-02 14:19:31 -04:00
2019-07-02 14:19:31 -04:00
2019-07-02 14:19:31 -04:00
2019-07-02 14:19:31 -04:00
x
2019-07-01 08:28:14 -04:00