Skip to content
Snippets Groups Projects
Commit 43a8594a authored by Putegnat Theo's avatar Putegnat Theo
Browse files

act 2 1

parent f488da9b
No related branches found
No related tags found
No related merge requests found
...@@ -512,6 +512,31 @@ wait(uint64 addr) ...@@ -512,6 +512,31 @@ wait(uint64 addr)
// - swtch to start running that process. // - swtch to start running that process.
// - eventually that process transfers control // - eventually that process transfers control
// via swtch back to the scheduler. // via swtch back to the scheduler.
struct
proc* pick_highest_priority_runnable_proc(){
int k;
acquire(&prio_lock);
for (k=0;k<NPRIO;k++){
struct list_proc * liste_proc = prio[k];
while(liste_proc && liste_proc->p ){
acquire (&liste_proc->p->lock);
if (liste_proc->p->state == RUNNABLE){
return liste_proc->p;
}
else {
release(&liste_proc->p->lock);
liste_proc = liste_proc->next;
}
}
}
release(&prio_lock);
return 0;
}
void void
scheduler(void) scheduler(void)
{ {
......
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