操作系统知识点整理
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
《操作系统》知识点总结
Chap 1
1. What is an Operating System
(OS 运行在内核态的软件)
an operating system is as an extended machine and a resource manager
2. The program that users interact with, usually called the shell when it is text based and the GUI (Graphical User Interface).
3. Most computers have two modes of operation: kernel mode and user mode. The operating system is the most fundamental piece of soft-ware and runs in kernel mode (also called supervisor mode).In this mode it has complete access to all the hardware and can execute any instruction the machine is capable of executing. The rest of the software runs in user mode, in which only a subset of the machine instructions is available.
内核态中,OS拥有对所有的硬件的完全访问权,可以执行机器能够运行的任何指令。软件的其余部分运行在用户态下,只使用了机器指令中的一个子集。
4. To obtain services from the operating system, a user program must make a system call, which traps into the kernel and invokes the operating system.
Chap 2: Processes and Threads
Process
1. A process is just an executing program, including the current values of the
program counter, registers and variables.
2.进程的三态模型:
1) Running(运行):该时刻进程实际占有CPU
2) Ready(就绪):可运行,但因为其他进程正在运行而暂时停止
3) Block(阻塞):除非某种外部事件发生,否则进程不能运行
3.进程表(process table):每个进程占有一个进程表项(process entry)(也叫进程
控制块, PCB),该表项包含了进程状态的所有信息
4.CPU利用率
CPU utilization = 1 –pn(n个进程,每个等待io的时间与停留在内存中时间的比为p)
Threads
1. 允许在同一个进程空间中存在多个线程,这些线程之间有较大的独立性
一个进程中所有线程共享的内容(进程的属性):
每个线程独有的内容:
(每个线程有自己的堆栈)
2. 线程实现的两种方式——用户空间和内核中
①在用户空间中实现线程
内核对线程包一无所知,从内核角度考虑,就是按正常的方式管理,即单线程进程(存在运行时系统)
②在内核中实现线程
在某个线程希望创建一个新线程或撤销一个已有线程时,它进行一个系统调用,这个系统调用通过对线程表的更新完成线程创建和撤销工作。
③混合实现
在此模型中,每个内核级线程有一个可以轮流使用的用户级线程集合。
Inter Process Communication/ IPC
1.Situations like this, where two or more processes are reading or writing some shared data and the final result depends on who runs precisely when(进程运行的精确时序), are called race conditions.
2. Critical Regions(临界区)
prohibit(阻止)more than one process from reading and writing the shared data at the same time——mutual exclusion(互斥)
That part of the program where the shared memory is accessed is called the critical region or critical section.对共享内存进行访问的程序片段
3. Mutual Exclusion with Busy Waiting忙等待的互斥
1)Disabling Interrupts屏蔽中断
2)Lock Variables锁变量
3)Strict Alternation严格轮换法
4)Peterson's Solution
5)The TSL Instruction TSL指令
a proposal that requires a little help from the hardware. have an instruction like TSL REGISTER,LOCK (Test and Set Lock)
Both Peterson's solution and the solutions using TSL or XCHG are correct, but both