Modern Operating Systems 笔记 - Threads

fork pthread sed 线程 内核空间 操作系统 用户空间 进程

Thread Usage

  1. Multiple activities going on at once with the ability to share an address space
  2. Lighter weight than processes, easy to create and destroy.
  3. Overlap activities with substantial I/O to speeding up the application.
  4. Useful on systems with multiple CPUs.

Three ways to construct a server

  1. Thread. Parallelism, blocking system calls.
  2. Single-threaded process. No parallelism, blocking system calls.
  3. Finite-state machine. Parallelism, nonblocking system calles, use interrupts to simulate thread.

Classical Thread Model

Processes are used to group resources together; threads are the entities scheduled for execution on the CPU. There are no protection betwwen threads because (1) it’s impossible, and (2) it should not be nessessary.

While threads share one memory space, it takes fewer space to maintain a thread, including Program Counter, Registers, Stack and State.

Modern Operating Systems 笔记 - Processes

操作系统 进程 Unix Windows fork kill sed


The illusion of parallelism while CPU is switching from process to process quickly.

The Process Model

process is an instance of an executing program, is the activity of a program.

If a program is running twice, it counts as two processes.

Process Creation

Processes are created when

  1. System init
  2. Process creation system call by a running process
  3. A user request to create a new process.
  4. Init of a batch job.

Modern Operating Systems 笔记 - Introduction

Unix Windows 操作系统

What is OS

  1. extendes machines : providing programmers(and programs) a clean abstract set of resources instead of the messy hardware
  2. resource manager : managing hardware resources

History of OS

The first digital computer was designed by Charles Babbage. Ada Lovelace was the first programmer(hired by Babbage).

1st Generation Vacuum Tubes

  • The first functioning digital computer, by John Atanasoff and Clifford Berry, Iowa State University.
  • Z3, Konrad Zuse, Berlin.
  • Colossus, a group at Bletchey Park, England
  • Mark I, Howard Aiken, Harvard
  • ENIAC, William Mauchley and J. Presper Eckert, University of Pennsylvania


Vim-Practice Bash Unix Vim sed 编译




安装 Arch Linux

ArchLinux Linux 镜像 磁盘 网络 操作系统

本文介绍如何安装 Arch Linux,一个轻量级、简单的 Linux 发行版。


Arch 官网下载 下载镜像(x86 和 x86_64是同一镜像)。 然后刻录 USB 安装盘

  • linux:

    dd if=/path/to/iso of=/dev/sdc  # 确认 sdc 为你的U盘
  • windows:

    1. 下载 dd4dos
    2. dd if=/path/to/iso of="\\.\G:" # 确认G盘为你的U盘

另外,有些 U 盘就是启动不了,换一个即可。

搜索引擎搭建:Heritrix + Lucene

搜索引擎 倒排索引 PageRank Web

采用 Heritix + Lucene 搭建搜索引擎原型,支持网站排名(PageRank)和倒排索引(Inverted Index),并评估其性能。


Heritrix 是用作 Web 归档的爬虫框架,java语言实现,具有 Apache License 自由软件许可。我们采用heritrix抓取网页数据。 可参照官方 Guide:

上一页 下一页