os_kernel_lab/code/lab8/user/yield.c

17 lines
340 B
C
Raw Normal View History

2012-08-22 12:32:13 +08:00
#include <ulib.h>
#include <stdio.h>
int
main(void) {
int i;
cprintf("Hello, I am process %d.\n", getpid());
for (i = 0; i < 5; i ++) {
yield();
cprintf("Back in process %d, iteration %d.\n", getpid(), i);
}
cprintf("All done in process %d.\n", getpid());
cprintf("yield pass.\n");
return 0;
}