Nachos Project Assignment 2 CPU scheduling

Nachos Project Assignment 2
CPU scheduling
If you still have trouble to install Nachos
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/
• Add a new case for Sleep
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
addiu $2,$0,SC_Sleep
// put system call number in register 2
/* all parameter of this system call will be stored in register4, 5, 6, and 7 by MIPS machine
automatically. */
.end PrintInt
Part 2-Non-preemptive shortest job first
• 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
• E-mail your code and presentation files(report) to TA
Non-preemptive shortest job first scheduler
• thread/, thread/alarm.h
• Implement WaitUntil(int x) to handle sleep(int t)
• Add a class to management the threads which are sleeping
Begin Running
Per timer interrupt:
1.Record actual CPU burst
2.Wake up time up threads
Invoke Sleep(x)
1.Set next predicted CPU burst
2.Insert this thread to Sleeping thread lists
3.Invoke thread->Sleep
More details

similar documents