Skip to content
Snippets Groups Projects
Commit fd37e189 authored by Fache Charles's avatar Fache Charles
Browse files

WIP2 1.2, 20/24 tests pass, tests broken ?

parent cf3dbc6c
No related branches found
No related tags found
No related merge requests found
......@@ -22,3 +22,4 @@ xv6.out*
.vagrant/
submissions/
.~lock.*
tracking_down_panic
No preview for this file type
......@@ -254,11 +254,7 @@ userinit(void)
{
struct proc *p;
acquire(&prio_lock);
p = allocproc();
if (p != 0) {
insert_into_prio_queue(p);
}
initproc = p;
// allocate one user page and copy init's instructions
......@@ -275,6 +271,11 @@ userinit(void)
p->cwd = namei("/");
p->state = RUNNABLE;
release(&p->lock);
acquire(&prio_lock);
acquire(&p->lock);
insert_into_prio_queue(p);
release(&p->lock);
release(&prio_lock);
}
......@@ -343,6 +344,12 @@ fork(void)
release(&np->lock);
acquire(&prio_lock);
acquire(&np->lock);
insert_into_prio_queue(np);
release(&np->lock);
release(&prio_lock);
return pid;
}
......@@ -461,7 +468,7 @@ wait(uint64 addr)
if(np->parent == p){
// np->parent can't change between the check and the acquire()
// because only the parent changes it, and we're the parent.
acquire(&prio_lock);
// acquire(&prio_lock);
acquire(&np->lock);
havekids = 1;
if(np->state == ZOMBIE){
......@@ -471,14 +478,18 @@ wait(uint64 addr)
sizeof(np->xstate)) < 0) {
release(&np->lock);
release(&p->lock);
release(&prio_lock);
return -1;
}
freeproc(np);
release(&np->lock);
acquire(&prio_lock);
acquire(&np->lock);
remove_from_prio_queue(np);
release(&np->lock);
release(&p->lock);
release(&prio_lock);
release(&p->lock);
return pid;
}
release(&np->lock);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment