操作系统基础知识

来源:互联网 发布:mac上安装mysql 编辑:程序博客网 时间:2024/05/23 13:11

linux系统组成部分:linux内核、shell、实用工具utility、应用程序、文件系统。


原语:若干机器指令构成的一段代码,原语在执行期间不可分割,一旦开始执行,不能被中断。


PV原语:与进程间通信机制信号量对应的话,当信号量大于0时,表示可供并发进程使用的资源数,小于0时,表示等待中的进程数。P操作信号量-1,V操作信号量+1。PV操作每个进程只能成对使用一次。


进程调度:先进先出、时间片轮询、最高优先级和多级队列反馈。


进程间通信方法:

信号量(特殊地,互斥信号量和同步信号量为初始值为1和0的信号量)、

共享内存、

消息机制(包括消息缓冲和信箱)、

管道通信(也叫共享文件通信)。


http://en.wikipedia.org/wiki/Deadlock

进程死锁的四个条件:互斥条件、请求与保持条件、不剥夺条件和循环等待条件。

A deadlock situation can arise if and only if all of the following conditions hold simultaneously in a system:[1]

  1. Mutual Exclusion: At least one resource must be non-shareable.[1] Only one process can use the resource at any given instant of time.
  2. Hold and Wait or Resource Holding: A process is currently holding at least one resource and requesting additional resources which are being held by other processes.
  3. No Preemption: The operating system must not de-allocate resources once they have been allocated; they must be released by the holding process voluntarily.
  4. Circular Wait: A process must be waiting for a resource which is being held by another process, which in turn is waiting for the first process to release the resource. In general, there is a set of waiting processes, P = {P1, P2, ..., PN}, such that P1 is waiting for a resource held by P2, P2 is waiting for a resource held by P3 and so on till PN is waiting for a resource held by P1.[1][7]

These four conditions are known as the Coffman conditions from their first description in a 1971 article by Edward G. Coffman, Jr.[7]Unfulfillment of any of these conditions is enough to preclude a deadlock from occurring.


------------------------------------------------------------------------------

存储管理:可变分区管理、页式管理、虚拟页式管理(又叫请求页式管理)。

可变分区管理:编程时,所用地址都是逻辑地址,当程序装载到内存时,通过存储管理得到该进程内存空间的物理基地址和限定长度,并将两者存储在该进程的进程控制块PCB中。进程运行时,所有地址的访问,均会“逻辑地址+基地址”得到程序或数据的物理地址。逻辑上相邻的地址,物理上也相邻。

页式管理:内存等长地分为若干物理页面(块),程序的逻辑空间按照同样大小划分为等长逻辑页面(页)。每个进程有一张页表,记录逻辑页面和物理页面的对应关系,页表行数等于逻辑页面数。逻辑上相邻的页面,物理上不一定相邻。页表基址和页表长度存储在该进程的进程控制块中。如果程序占用存储空间较大,则页表占用空间可能超过一个页面,此时可采用多级页表结构。

原创粉丝点击