《操作系统》的实验代码。

16 wiersze
340 B

12 lat temu
  1. #include <ulib.h>
  2. #include <stdio.h>
  3. int
  4. main(void) {
  5. int i;
  6. cprintf("Hello, I am process %d.\n", getpid());
  7. for (i = 0; i < 5; i ++) {
  8. yield();
  9. cprintf("Back in process %d, iteration %d.\n", getpid(), i);
  10. }
  11. cprintf("All done in process %d.\n", getpid());
  12. cprintf("yield pass.\n");
  13. return 0;
  14. }