Operating Systems: Three Easy Pieces(READing)

书的主页书的示例代码书的项目代码书的 Homework 代码

书的目录(PDF 文件)

  • Introduction to Operating Systems
    • Virtualizing The CPU
    • Virtualizing Memory
    • Concurrency
    • Persistence
    • Design Goals
    • Some history
    • Summary
    • References
    • Homework

Intro

Virtualizing The CPU

主文件 cpu.c:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <assert.h>
#include "common.h"

int main(int argc, char *argv[])
{
  if (argc != 2) {
    fprintf(stderr, "usage: cpu <string>\n");
    exit(1);
  }
  char *str = argv[1];
  while(1) {
    Spin(1);
    printf("%s\n", str);
  }
  return 0;
}





评论和交流请发送邮件到 me@tianhegao.com





通过以下渠道赞赏此文