Project 2 - System Call & CPU Scheduling
System Call (Cont.)
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 in ExceptionHandler
Note the use of kernel->alarm->WaitUntil()
System Call (Cont.)
Alarm - software alarm clock, that generates an interrupt every X time ticks
The WaitUntil() will be called when a thread going to sleep.
Call the CallBack() to check which thread should wake up.
See the comments in the file, they are helpful.
Don’t forget the useful data structure like list in the lib folder.
System Call (Cont.)
Write your own test code like test1 and test2
Create test.c
in test/
Modify the Makefile in test/
Compile in the same way as test1 and test2
Part 2 - CPU Scheduling
RR, FCFS, SJF, Priority
CPU Scheduling
Choose at least one of the following to implement (The extra implementation will be considered as BONUS) :
First-Come-First-Service (FCFS)
Shortest-Job-First (SJF)
Priority
Design your own test code :
Modify Thread::SelfTest()
or create your method for testing.
CPU Scheduling (Cont.)
Design at least 2 test cases to proof your result
Specify your algorithm in the report.
Specify the test case setting and output in your report.
Design the NachOS interface to switch different scheduling algorithm
Report & Policy
Report contents, grading policy, late policy
Report
Motivation
Motivation and the problem analysis
What’s your plan to deal with the problem
Implementation
How do you implement to solve the problem in Nachos
You can including some (not all) important code segments and comments
Result
Experiment result and some discussion
Extra effort or observation
Grading Policy
Nachos source code: (40%)
Report: (40%)
Correct format: (20%)
No plagiarism
Late Policy
10% penalty per day
After 7 days, you will get 70% penalty, but no more penalty after that.
Create a folder for the source code and report
{Student ID}_Nachos2/
| _ nachos-4.0 /
| _ report.pdf
Compress
tar -zcvf {Student ID}_Nachos2.tar.gz ./{Student ID}_Nachos2
Your source code and report should be handed out by Ceiba
Resume presentation
Project 2 - System Call & CPU Scheduling
{"metaMigratedAt":"2023-06-15T15:01:39.443Z","metaMigratedFrom":"YAML","title":"Nachos Project 2 - System Call & CPU Scheduling","breaks":true,"slideOptions":"{\"theme\":\"sky\",\"transition\":\"fade\",\"spotlight\":{\"enabled\":false}}","contributors":"[{\"id\":\"db1bbfb1-bf49-4f62-8368-01fe50a4bb3c\",\"add\":3392,\"del\":0}]"}