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:

#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 (直接点击邮箱可自动跳转至默认邮箱App,并填写收信人和邮件主题)或者点击这里在线留言,我会挑选对读者有价值的评论附加到文章末尾。



可通过以下渠道赞赏此文