操作系统
Round-Robin算法
Multiple-Queues
12/03 2013
Introduction to Scheduling
Personal Computer
Scheduling is simpler in personal computers because (1) there is only one active process, (2) CPU is more faster than I/O.
Process Behavior
Compute-bound: long CPU bursts and thus infrequent I/O waits.
I/O-bound: short CPU bursts and thus frequent I/O waits.
操作系统
IPC
中断
互斥量
信号量
11/25 2013
race conditions
Two or more processes are reading or writing some shared data and the final result depends on who runs precisely when.
Critical Regions
mutual exclusion
Prohibit more than one process from reading and writing the shared data at the same time.
critical region
Also called critical section , the part of the program where the shared memory is accessed.
Conditions to a good solution
No two processes may be simultaneously inside their critical regions
No assumptions may be made about speeds or the number of CPUs
No process running outside its critical region may block other processes
No process should have to wait forever to enter its critical region
fork
pthread
sed
线程
内核空间
操作系统
用户空间
进程
11/21 2013
Thread Usage
Multiple activities going on at once with the ability to share an address space
Lighter weight than processes, easy to create and destroy.
Overlap activities with substantial I/O to speeding up the application.
Useful on systems with multiple CPUs.
Three ways to construct a server
Thread. Parallelism, blocking system calls.
Single-threaded process. No parallelism, blocking system calls.
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.
操作系统
进程
Unix
Windows
fork
kill
sed
11/17 2013
pseudoparallelism
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
System init
Process creation system call by a running process
A user request to create a new process.
Init of a batch job.
Unix
Windows
操作系统
11/11 2013
What is OS
extendes machines : providing programmers(and programs) a clean abstract set of resources instead of the messy hardware
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
Bash
Unix
sed
编译
11/08 2013
Vim是从vi发展出来的一个文本编辑器。代码补全、编译及错误跳转等方便编程的功能特别丰富,在程序员中被广泛使用。和Emacs并列成为类Unix系统用户最喜欢的编辑器。
文档参见:http://vimdoc.sourceforge.net/htmldoc/
中文文档:http://vimcdoc.sourceforge.net/doc/
ArchLinux
Linux
镜像
磁盘
网络
操作系统
11/07 2013
本文介绍如何安装 Arch Linux,一个轻量级、简单的 Linux 发行版。
制作镜像并启动
在 Arch 官网下载 下载镜像(x86 和 x86_64是同一镜像)。
然后刻录 USB 安装盘 :
linux:
dd if = /path/to/iso of = /dev/sdc # 确认 sdc 为你的U盘
windows:
下载 dd4dos
dd if=/path/to/iso of="\\.\G:" # 确认G盘为你的U盘
另外,有些 U 盘就是启动不了,换一个即可。