diff options
author | Frans Kaashoek <[email protected]> | 2019-07-02 19:29:14 -0400 |
---|---|---|
committer | Frans Kaashoek <[email protected]> | 2019-07-02 19:29:14 -0400 |
commit | 26f306113a1b4057ac1f59050213c8f62c3a211a (patch) | |
tree | b786133dd648a65b2522790474686798bfad6d0f /user | |
parent | 1e4d7065d6582fd57d251dfe405afbbe68a55309 (diff) | |
download | xv6-labs-26f306113a1b4057ac1f59050213c8f62c3a211a.tar.gz xv6-labs-26f306113a1b4057ac1f59050213c8f62c3a211a.tar.bz2 xv6-labs-26f306113a1b4057ac1f59050213c8f62c3a211a.zip |
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().
Diffstat (limited to 'user')
0 files changed, 0 insertions, 0 deletions