操作系统原理的知识,请讲解得让我容易理解和记忆---```plain 程序 ├── 前驱图 │ └── 有向无环图, 用于描述进程之间执行的先后顺序 ├── 程序顺序执行的特征 │ ├── 顺序性 │ │ └── 程序每个动作都按顺序执行 │ ├── 封闭性 │ │ └── 只有程序本身的动作才能改变程序运行的环境 │ └── 可再现性 │ └── 程序的执行结果与程序运行速度有关 ├── 程序并发执行的特征 │ ├── 失去封闭性 │ │ ├── 多个程序共享全局资源, 执行状态受外界因素影响 │ │ └── 程序经过多次执行后, 虽然其执行时的环境和初始条件都相同, 但得到的结果却各不相同。(不可再现性) │ └── 间断性 │ ├── 并发程序之间相互制约。 │ └── 具有“执行——暂停执行——执行”活动规律 └── 程序与计算不再一一对应 └── 一个共享程序可被多个用户作业调用, 从而形成多个“计算” ``` **Extraction Content:** **Chart Description:** * **Type:** Hierarchical diagram (similar to a mind map or tree structure). * **Main Elements:** * Nodes: Text labels representing concepts related to processes. * Lines: Arrows connecting parent nodes to child nodes, indicating hierarchical relationships. * Text Labels: Chinese text and English terms in parentheses. One specific label ("PCB是进程存在的唯一标识;") is colored red. * Structure: The diagram starts with main concepts and branches out into sub-concepts, forming a tree-like structure. **Textual Information:** 进程的描述 - 进程映像 - 程序 - 数据集 - 栈 - PCB - 进程控制块 (PCB) - 是操作系统中最重要的记录型数据结构 - 作用 - PCB是进程存在的唯一标识; (Red text) - 操作系统根据PCB对进程实施控制和管理; - 提供进程管理所需的信息; - 进程的动态、并发等特征是利用PCB表现出来的 - PCB的组织方式 - 线性方式 - 链接方式 - 索引方式 - 进程的状态及转换 - 三种基本状态 - 运行状态 (Running) - 就绪状态 (Ready) - 阻塞状态 (Blocked) - 进程状态的转换 **Chart Description:** * **Type:** Flowchart or hierarchical diagram / mind map. * **Main Structure:** A tree-like structure branching from the central concept "进程管理" (Process Management). * **Main Branches:** Four main branches extend from "进程管理": "进程创建" (Process Creation), "进程终止" (Process Termination), "进程阻塞与唤醒" (Process Blocking and Waking), and "进程挂起与激活" (Process Suspending and Activating). * **Sub-branches and Details:** Each main branch except the last one has sub-branches and detailed steps or descriptions. * "进程创建" branches into "引起进程创建的事件" and "进程创建过程". * "进程终止" branches into "引起进程终止情况" and "进程的终止过程". * "进程阻塞与唤醒" branches into "阻塞" and "唤醒". "阻塞" further branches into "引起进程阻塞的事件" and "进程阻塞过程". "唤醒" has a condition "当引起阻塞进程所等待的时间出现时" and branches into "进程唤醒过程". * **Text Labels:** All nodes and connecting lines have text labels describing concepts, events, processes, and steps. * **Numbering:** Steps in the "进程创建过程", "进程的终止过程", and "进程阻塞过程", and "进程唤醒过程" are numbered (1, 2, 3, 4 or 1, 2, 3). * **Connections:** Lines connect parent nodes to child nodes, indicating relationships or flow. Arrows are used on some connecting lines (e.g., leading to the step lists). **Extracted Text Content:** **进程管理 (Process Management)** * **进程创建 (Process Creation)** * 引起进程创建的事件 (Events causing process creation): 用户登录, 作业调度, 提供服务, 应用请求 (User login, job scheduling, service provision, application request) * 进程创建过程 (Process creation process): 1. 申请空白PCB; (Apply for empty PCB;) 2. 分配所需资源; (Allocate necessary resources;) 3. 初始化PCB; (Initialize PCB;) 4. 插入就绪队列 (Insert into ready queue) * **进程终止 (Process Termination)** * 引起进程终止情况 (Situations causing process termination): 正常结束, 异常结束, 外界干预 (Normal completion, abnormal termination, external intervention) * 进程的终止过程 (Process termination process): 1. 从PCB集合中检索出该进程的PCB, 若被终止进程正处于执行状态, 应立即终止该进程的执行; (Retrieve the process's PCB from the PCB set. If the terminated process is in the executing state, immediately terminate the process's execution;) 2. 回收该进程占用的全部资源; (Reclaim all resources occupied by the process;) 3. 若该进程还有子孙进程, 则还有终止所有子孙进程, 并回收资源; (If the process has child processes, terminate all child processes and reclaim resources;) 4. 将被终止进程 (PCB) 从所在队列中移去。 (Remove the terminated process (PCB) from its queue.) * **进程阻塞与唤醒 (Process Blocking and Waking)** * 阻塞 (Blocking) * 引起进程阻塞的事件 (Events causing process blocking): 向系统请求共享资源失败; 等待某种操作的完成; 新数据尚未到达; 等待新任务的到达 (Failed request for shared resources from the system; Waiting for the completion of a certain operation; New data has not arrived; Waiting for the arrival of a new task) * 进程阻塞过程 (Process blocking process): 1. 停止执行; (Stop execution;) 2. 保存现场信息, 将状态由执行改为阻塞; (Save context information, change state from executing to blocked;) 3. 将PCB插入阻塞队列; (Insert PCB into the blocked queue;) 4. 转到调度程序 (Transfer to scheduler) * 唤醒 (Waking) * 当引起阻塞进程所等待的时间出现时 (When the event that the blocked process was waiting for occurs) * 进程唤醒过程 (Process waking process): 1. 从阻塞队列中移出; (Remove from the blocked queue;) 2. 状态由阻塞改为就绪; (Change state from blocked to ready;) 3. 将PCB插入就绪队列。(Insert PCB into the ready queue.) * **进程挂起与激活 (Process Suspending and Activating)** **Diagram Description:** * **Type:** Mind Map / Hierarchical Diagram. * **Main Node:** "进程同步与互斥" (Process Synchronization and Mutual Exclusion). * **Branches:** The diagram branches out from the main node into several sub-topics connected by lines. * **Structure:** The diagram presents definitions, concepts, principles, operations, and classic problems related to process synchronization and mutual exclusion in a tree-like structure. **Extracted Content:** **Main Topic:** 进程同步与互斥 (Process Synchronization and Mutual Exclusion) **Sub-topic 1:** 同步 (Synchronization) * Text: 进程的同步是指进程之间的一种直接的协调工作关系。即进程之间相互制约的等待与互通消息。 **Sub-topic 2:** 互斥 (Mutual Exclusion) * Text: 进程的互斥是指进程之间的一种间接关系。即两个或两个以上的进程之间相互竞争临界资源的现象 **Sub-topic 3:** 临界资源 (Critical Resource) * Text: 系统中某些资源一次只允许一个进程使用, 称这样的资源为临界资源 **Sub-topic 4:** 临界区 (Critical Section) * Text: 进程互斥执行的程序段。 * **Sub-branch:** 临界区的调用原则 (Calling principles of Critical Section) * Text: 有空让进 (Allow entry if empty) * Text: 忙则等待 (Wait if busy) * Text: 有限等待 (Bounded waiting) * Text: 让权等待 (Yielding waiting) **Sub-topic 5:** 信号量 (Semaphore) * Text: 是一个特殊变量, 表示资源的实体, 其值仅能由P、V操作来改变 * **Sub-branch:** 互斥信号量 (Mutual exclusion semaphore) * Text: 用于实现进程间的互斥, 初值为1, 可进行P、V操作 * **Sub-branch:** 同步信号量 (Synchronization semaphore) * Text: 用于实现进程间的同步, 初值为0或正整数n, 拥有它的进程只能进行P操作 **Sub-topic 6:** P、V操作 (P, V operations) * **Sub-branch:** P操作 (P operation) * Text: 执行S=S-1, 申请调用资源 * Text: 若S≥0, 则进程继续执行 * Text: 若S<0, 则进程阻塞, 并进入阻塞队列 * **Sub-branch:** V操作 (V operation) * Text: 执行S=S+1, 申请回收资源 * Text: 若S>0, 则进程继续执行 * Text: 若S<=0, 则从等待队列中取出一个进程 * Text below P and V operations: P、V操作都应作为一个整体实施, 不允许分割或相互穿插执行 **Sub-topic 7:** 经典同步互斥问题 (Classic Synchronization and Mutual Exclusion Problems) * Text: 生产者-消费者问题 (Producer-Consumer Problem) * Text: 读者-写者问题 (Reader-Writer Problem) * Text: 哲学家就餐问题 (Dining Philosophers Problem) **Extraction Content:** **Diagram Description:** * **Type:** Hierarchical diagram (Mind Map). * **Main Elements:** * The diagram shows a tree structure originating from a central concept, branching out into sub-concepts and their details. * Nodes are represented by text labels enclosed in implicit boxes (or simply text). * Connections are shown by orange lines indicating relationships (typically parent-child or category-subcategory). * The structure represents the concept of "Process Communication" categorized into "Low-level" and "High-level" methods, with further details and examples branching out from these categories. **Textual Information:** * **Root Node:** 进程通信 (Process Communication) * **Level 1 Nodes:** * 低级 (Low-level) * 高级 (High-level) * **Level 2 Nodes (under 低级):** * 进程的同步和互斥 (Process Synchronization and Mutual Exclusion) * 特点 (Features) * **Level 3 Nodes (under 特点, under 低级):** * 效率低 (Low Efficiency) * 通信对用户不透明 (Communication is Opaque to Users) * **Level 2 Nodes (under 高级):** * 特点 (Features) * 共享存储器 (Shared Memory) * 消息传递系统 (Message Passing System) * 管道文件 (Pipe File) * 客户机-服务器系统 (Client-Server System) * **Level 3 Nodes (under 特点, under 高级):** * 使用方便 (Easy to Use) * 高效地传送大量数据 (Efficient Transmission of Large Amounts of Data) * **Level 3 Nodes (under 消息传递系统):** * 直接通信方式 (消息队列) [Direct Communication Method (Message Queue)] * 间接通信方式 (通过邮箱) [Indirect Communication Method (via Mailbox)] * **Level 3 Nodes (under 客户机-服务器系统):** * 套接字 (Socket) [Socket] * 远程调用 (Remote Procedure Call / Remote Invocation) **Chart Description:** - Type: Concept map / Mind map. - Main Elements: - Central Node: "线程" (Thread). - Branches: Three main branches extending from the central node, labeled "定义" (Definition), "引入线程概念" (Introduction of Thread Concept), and "线程与进程的比较" (Comparison of Thread and Process). - Sub-branches: Each main branch has sub-branches containing textual descriptions or points. - Lines: Orange lines connect the nodes and sub-nodes, showing the hierarchical relationship. **Extracted Content:** 线程 **定义** 线程 (Thread) 是进程中执行运算的最小单位, 即执行处理器调度的基本单位 **引入线程概念** 使并行实体获得共享同一地址空间和所有可用数据的能力 易于切换, 代价低 可以改善系统的性能 **线程与进程的比较** 一个进程可以有多个线程, 但至少要有一个线程; 而一个线程只能在一个进程的地址空间内活动。 资源分配给进程, 同一进程的所有线程共享该进程的所有资源。 处理器机分配给线程, 即真正处在处理机上运行的是线程。 线程在执行过程中需要协作同步。不同进程的线程间要利用消息通信的办法实现同步。

视频信息