mirror of
https://github.com/SmallPond/MIT6.828_OS.git
synced 2026-04-28 12:50:48 +08:00
LAB 4 IS DONE.
This commit is contained in:
17
lab/user/yield.c
Normal file
17
lab/user/yield.c
Normal file
@@ -0,0 +1,17 @@
|
||||
// yield the processor to other environments
|
||||
|
||||
#include <inc/lib.h>
|
||||
|
||||
void
|
||||
umain(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
cprintf("Hello, I am environment %08x.\n", thisenv->env_id);
|
||||
for (i = 0; i < 5; i++) {
|
||||
sys_yield();
|
||||
cprintf("Back in environment %08x, iteration %d.\n",
|
||||
thisenv->env_id, i);
|
||||
}
|
||||
cprintf("All done in environment %08x.\n", thisenv->env_id);
|
||||
}
|
||||
Reference in New Issue
Block a user