mirror of
https://github.com/SmallPond/MIT6.828_OS.git
synced 2026-04-30 21:59:45 +08:00
LAB 4 IS DONE.
This commit is contained in:
20
lab/user/idle.c
Normal file
20
lab/user/idle.c
Normal file
@@ -0,0 +1,20 @@
|
||||
// idle loop
|
||||
|
||||
#include <inc/x86.h>
|
||||
#include <inc/lib.h>
|
||||
|
||||
void
|
||||
umain(int argc, char **argv)
|
||||
{
|
||||
binaryname = "idle";
|
||||
|
||||
// Loop forever, simply trying to yield to a different environment.
|
||||
// Instead of busy-waiting like this,
|
||||
// a better way would be to use the processor's HLT instruction
|
||||
// to cause the processor to stop executing until the next interrupt -
|
||||
// doing so allows the processor to conserve power more effectively.
|
||||
while (1) {
|
||||
sys_yield();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user