Download presentation
Presentation is loading. Please wait.
1
Nachos Project Assignment 2 CPU scheduling
2
If you still have trouble to install Nachos
decstation.linux-xgcc.gz
3
Part 1-System call Implement a system call – Sleep()
userprog/syscall.h Define a system call number of Sleep test/start.s Prepare registers for Sleep userprog/exception.cc Add a new case for Sleep
4
System call:start.s Assembly language assist to make system calls to the Nachos kernel Take System call Sleep as an example .globl Sleep .ent Sleep PrintInt: addiu $2,$0,SC_Sleep // put system call number in register 2 syscall /* all parameter of this system call will be stored in register4, 5, 6, and 7 by MIPS machine automatically. */ .end PrintInt
5
Part 2-Non-preemptive shortest job first scheduler
Nachos default scheduler: Round Robin Shortest job first n+1 = tn + (1- )n n time of the nth predicate CPU burst tn time of the nth actual CPU burst Design several test case to proof your result your code and presentation files(report) to TA
6
Non-preemptive shortest job first scheduler
thread/alarm.cc, thread/alarm.h Implement WaitUntil(int x) to handle sleep(int t) Add a class to management the threads which are sleeping Begin Running Invoke Sleep(x) Per timer interrupt: 1.Record actual CPU burst 2.Wake up time up threads 1.Set next predicted CPU burst 2.Insert this thread to Sleeping thread lists 3.Invoke thread->Sleep
7
More details system-call.html
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.