[
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "操作系统概述"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                115,
                314,
                137
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "计算机系统"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                187,
                287,
                210
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "完整的计算机由硬件和软件两部分组成"
                    }
                ]
            },
            "bbox": [
                144,
                254,
                452,
                269
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "计算机硬件是指计算机系统中由电子、机械、光电组件组成的各种计算机部件和设备"
                    }
                ]
            },
            "bbox": [
                144,
                272,
                801,
                286
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "计算机软件是指计算机系统中的程序、数据和有关的文档。"
                    }
                ]
            },
            "bbox": [
                144,
                291,
                600,
                305
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "根据软件的作业可以将其分为系统软件、支撑软件和应用软件三类。"
                    }
                ]
            },
            "bbox": [
                144,
                310,
                668,
                324
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "操作系统：操作系统是一组控制和管理计算机硬件和软件资源，合理地对各类作业进行调"
                    }
                ]
            },
            "bbox": [
                144,
                328,
                845,
                342
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "度、以及方便用户使用计算机的程序的集合"
                    }
                ]
            },
            "bbox": [
                144,
                347,
                485,
                361
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "任务：管理计算机的资源"
                    }
                ]
            },
            "bbox": [
                144,
                365,
                344,
                379
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "操作系统的目标："
                    }
                ]
            },
            "bbox": [
                144,
                384,
                280,
                398
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "方便性"
                    }
                ]
            },
            "bbox": [
                146,
                403,
                203,
                417
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "有效性"
                    }
                ]
            },
            "bbox": [
                146,
                420,
                203,
                435
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "3. OS 的作用"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                439,
                245,
                454
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "‐ OS 是用户与计算机硬件之间的接口；"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "‐ OS 是计算机系统资源的管理者；"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "‐ OS 是扩充裸机功能的软件，它实现了对计算机资源的抽象；"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "‐ OS 是计算机系统工作流程的组织者"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                146,
                458,
                613,
                527
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "计算机硬件"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                556,
                268,
                575
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "中央处理器、存储器、各种输入设备。"
                    }
                ]
            },
            "bbox": [
                146,
                615,
                440,
                631
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "计算机软件"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                659,
                268,
                678
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "系统软件、应用软件和支撑软件三类。"
                    }
                ]
            },
            "bbox": [
                146,
                719,
                440,
                734
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "系统软件支持和管理硬件你，它创立的是一个平台，如编译程序、装配程序、操作系统"
                    }
                ]
            },
            "bbox": [
                144,
                738,
                821,
                752
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "应用软件是某个特定应用领域专用的软件"
                    }
                ]
            },
            "bbox": [
                146,
                756,
                468,
                771
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "支撑软件是支撑其他软件的编址和维护，如中间件"
                    }
                ]
            },
            "bbox": [
                146,
                775,
                539,
                789
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "计算机系统自上而下可分为四部分：硬件、操作系统、应用程序和用户。操作系统管理计"
                    }
                ]
            },
            "bbox": [
                144,
                793,
                845,
                807
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "算机硬件，为应用程序提供基础"
                    }
                ]
            },
            "bbox": [
                146,
                812,
                398,
                827
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "操作系统的发展与分类"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                99,
                420,
                122
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "手工操作"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                174,
                247,
                193
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "单道批处理"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                241,
                268,
                261
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "多道批处理"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                309,
                268,
                329
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1、 多道"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2、宏观上并行"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "3、微观上串行"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                146,
                370,
                268,
                420
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "equation_inline",
                                "content": "\\blacktriangle"
                            },
                            {
                                "type": "text",
                                "content": "批处理首先考虑资源利用率和系统吞吐量，分时系统首先考虑交互能力和响应时间，实时系统首先考虑实时性和可靠性。"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "equation_inline",
                                "content": "\\blacktriangle"
                            },
                            {
                                "type": "text",
                                "content": "批处理系统的特点：资源利用率高，系统吞吐量大"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                144,
                426,
                810,
                476
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "无交互能力，作业平均周转时间长"
                    }
                ]
            },
            "bbox": [
                146,
                481,
                415,
                495
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "equation_inline",
                        "content": "\\blacktriangle"
                    },
                    {
                        "type": "text",
                        "content": "多道程序设计技术：多道程序同时装入内存，允许他们并发运行。优点：提高 CPU、存储器、设备的资源利用率，增加系统吞吐量。"
                    }
                ]
            },
            "bbox": [
                144,
                500,
                806,
                533
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "分时操作"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                561,
                247,
                580
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "按照时间片轮流将处理器分配给各联机作业使用。"
                    }
                ]
            },
            "bbox": [
                144,
                621,
                527,
                636
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1、同时性"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2、 交互性"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "3、独立性"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "4、及时性"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                146,
                640,
                235,
                709
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "分时系统的关键问题：人机交互"
                    }
                ]
            },
            "bbox": [
                144,
                714,
                396,
                728
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "作业提交直接进入内存，引入时间片分时共享 CPU"
                    }
                ]
            },
            "bbox": [
                144,
                733,
                537,
                747
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "响应时间 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\approx"
                    },
                    {
                        "type": "text",
                        "content": "进程数目 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\times"
                    },
                    {
                        "type": "text",
                        "content": "时间片大小"
                    }
                ]
            },
            "bbox": [
                146,
                751,
                418,
                766
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "equation_inline",
                        "content": "\\blacktriangle"
                    },
                    {
                        "type": "text",
                        "content": "分时系统和实时系统的特征比较"
                    }
                ]
            },
            "bbox": [
                146,
                770,
                415,
                784
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "交互能力： 分时系统强于实时系统"
                    }
                ]
            },
            "bbox": [
                146,
                789,
                418,
                803
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "实时性： 实时系统优于分时系统"
                    }
                ]
            },
            "bbox": [
                146,
                807,
                401,
                821
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "可靠性： 实时系统优于分时系统"
                    }
                ]
            },
            "bbox": [
                146,
                825,
                401,
                840
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "实时操作系统"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                101,
                294,
                120
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "必须在决定的世家安内完成该事件的处理"
                    }
                ]
            },
            "bbox": [
                146,
                161,
                470,
                175
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "微机操作系统"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                204,
                294,
                223
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "网络操作系统"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                272,
                294,
                291
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "分布式操作系统"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                338,
                317,
                359
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "嵌入式操作系统"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                407,
                317,
                426
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "操作系统的特性"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                473,
                339,
                495
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "并发性 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                548,
                221,
                567
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "两个或多个事件在同一时间间隔内同时发生，宏观上由多个程序在同时执行，微观上在单处理机系统中这多个程序时交替运行的。"
                    }
                ]
            },
            "bbox": [
                144,
                608,
                847,
                642
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "并行性是同时刻发生的。"
                    }
                ]
            },
            "bbox": [
                146,
                645,
                334,
                661
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "▲并发与并行的区别"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                664,
                307,
                680
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "并发性：指两个或多个事件在同一时间间隔内发生。如单处理器中的两个进程（宏观上同时，微观上交替）（只并发，但不并行）"
                    }
                ]
            },
            "bbox": [
                144,
                682,
                786,
                715
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "并行性：两个或多个事件在同一时刻同时发生。如计算机中的 CPU 与 I/O 设备、I/O设备与 I/O 设备的工作"
                    }
                ]
            },
            "bbox": [
                144,
                720,
                789,
                753
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "一个程序的一次运行过程，每个进程设置一个PCB，存放下一条要执行的指令地址。"
                    }
                ]
            },
            "bbox": [
                146,
                757,
                789,
                772
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "共享性"
                    }
                ]
            },
            "bbox": [
                147,
                101,
                221,
                120
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "虚拟性"
                    }
                ]
            },
            "bbox": [
                147,
                168,
                221,
                187
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "异步性"
                    }
                ]
            },
            "bbox": [
                147,
                236,
                221,
                255
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "操作系统的功能"
                    }
                ]
            },
            "bbox": [
                147,
                303,
                339,
                325
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "处理器管理"
                    }
                ]
            },
            "bbox": [
                147,
                378,
                268,
                397
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "即进程管理，对处理器进行分配调度"
                    }
                ]
            },
            "bbox": [
                147,
                438,
                433,
                454
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "存储器管理"
                    }
                ]
            },
            "bbox": [
                147,
                481,
                268,
                500
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "设备管理"
                    }
                ]
            },
            "bbox": [
                147,
                548,
                245,
                567
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "文件管理"
                    }
                ]
            },
            "bbox": [
                147,
                615,
                245,
                634
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "作业管理"
                    }
                ]
            },
            "bbox": [
                147,
                719,
                245,
                738
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "提供用户接口"
                    }
                ]
            },
            "bbox": [
                147,
                787,
                290,
                806
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "命令接口（联机命令、脱机命令）"
                    }
                ]
            },
            "bbox": [
                146,
                847,
                406,
                863
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "应用程序接口（即系统调用，是 OS 提供的一组实现特殊功能的子程序，以供应用程序 取得 OS 的服务）。"
                    }
                ]
            },
            "bbox": [
                144,
                865,
                848,
                900
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "操作系统的内核结构"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                133,
                391,
                155
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/182ba6075eea3d9073687b0f8540f0546b24c7084d7107bd5aeda8ba80534f47.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td></td><td>特性、思想</td><td>优点</td><td>缺点</td></tr><tr><td rowspan=\"2\">分层结构</td><td rowspan=\"2\">内核分多层,每层可单向调用更低一层提供的接口</td><td>1.便于调试和验证,自底向上逐层调试验证</td><td>1.仅可调用相邻低层,难以合理定义各层的边界</td></tr><tr><td>2.易扩充和易维护,各层之间调用接口清晰固定</td><td>2.效率低,不可跨层调用,系统调用执行时间长</td></tr><tr><td rowspan=\"4\">模块化</td><td rowspan=\"4\">将内核划分为多个模块,各模块之间相互协作。内核=主模块+可加载内核模块主模块:只负责核心功能,如进程调度、内存管理可加载内核模块:可以动态加载新模块到内核,而无需重新编译整个内核</td><td>1.模块间逻辑清晰易于维护,确定模块间接口后即可多模块同时开发</td><td rowspan=\"2\">1.模块间的接口定义未必合理、实用</td></tr><tr><td rowspan=\"2\">2.支持动态加载新的内核模块(如:安装设备驱动程序、安装新的文件系统模块到内核),增强OS适应性</td></tr><tr><td rowspan=\"2\">2.模块间相互依赖,更难调试和验证</td></tr><tr><td>3.任何模块都可以直接调用其他模块,无需采用消息传递进行通信,效率高</td></tr><tr><td rowspan=\"2\">宏内核(大内核)</td><td rowspan=\"2\">所有的系统功能都放在内核里(大内核结构的OS通常也采用了“模块化”的设计思想)</td><td rowspan=\"2\">1.性能高,内核内部各种功能都可以直接相互调用</td><td>1.内核庞大功能复杂,难以维护</td></tr><tr><td>2.大内核中某个功能模块出错,就可能导致整个系统崩溃</td></tr><tr><td rowspan=\"2\">微内核</td><td rowspan=\"2\">只把中断、原语、进程通信等最核心的功能放入内核。进程管理、文件管理、设备管理等功能以用户进程的形式运行在用户态</td><td>1.内核小功能少、易于维护,内核可靠性高</td><td>1.性能低,需要频繁的切换 用户态/核心态。用户态下的各功能模块不可以直接相互调用,只能通过内核的“消息传递”来间接通信</td></tr><tr><td>2.内核外的某个功能模块出错不会导致整个系统崩溃</td><td>2.用户态下的各功能模块不可以直接相互调用,只能通过内核的“消息传递”来间接通信</td></tr><tr><td rowspan=\"3\">外核(exokernel)</td><td rowspan=\"3\">内核负责进程调度、进程通信等功能,外核负责为用户进程分配未经抽象的硬件资源,且由外核负责保证资源使用安全</td><td rowspan=\"2\">1.外核可直接给用户进程分配“不虚拟、不抽象”的硬件资源,使用户进程可以更灵活的使用硬件资源</td><td>1.降低了系统的一致性</td></tr><tr><td rowspan=\"2\">2.使系统变得更复杂</td></tr><tr><td>2.减少了虚拟硬件资源的“映射层”,提升效率</td></tr></table>",
                "table_type": "complex_table",
                "table_nest_level": 1
            },
            "bbox": [
                156,
                195,
                890,
                479
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "整体结构"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                520,
                245,
                539
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "（实内核、单体结构模型、五结构模型）"
                    }
                ]
            },
            "bbox": [
                157,
                580,
                458,
                595
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "模块结构"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                623,
                245,
                642
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "内核 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\vdots = \\quad"
                    },
                    {
                        "type": "text",
                        "content": "主模块 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "^ { \\cdot + }"
                    },
                    {
                        "type": "text",
                        "content": "可加载内核模块"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                683,
                381,
                697
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "(2）模块化"
                    }
                ],
                "level": 1
            },
            "bbox": [
                213,
                703,
                267,
                712
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "模块化是将操作系统按功能划分为若干个具有一定独立性的模块。每个模块具有某方面的管细分为若于个具有一定功能的子模块，同样也规定好各子模块之间的接口。把这种设计方法称为模块-接口法，图1.3所示为由模块、子模块等组成的模块化操作系统结构。"
                    }
                ]
            },
            "bbox": [
                184,
                712,
                616,
                750
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/e69c964be106eeacaf5865ef396bec7634a04679e60136cabe8d99355bdc30f0.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                247,
                750,
                557,
                831
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/9f25d2409b7b1cb76f651d2bb31b67e1203f824c22cfb68b6fa1a67b1fc77dfd.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                339,
                832,
                364,
                841
            ]
        },
        {
            "type": "page_header",
            "content": {
                "page_header_content": [
                    {
                        "type": "text",
                        "content": "图形接口"
                    }
                ]
            },
            "bbox": [
                147,
                93,
                221,
                108
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "层次结构"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                101,
                247,
                120
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/e05652a813ec6f7a256792d2232771ea60b9eeb292d961a51d378ac2d9fb67ae.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                179,
                184,
                460,
                381
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                519,
                256,
                820,
                274
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                521,
                290,
                702,
                307
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "微内核结构"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                444,
                268,
                464
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "（Client/Server 模型 ）"
                    }
                ]
            },
            "bbox": [
                157,
                504,
                312,
                520
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "宏内核结构"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                546,
                268,
                567
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/6e2d51ead79a58653df6b25e0c7b4a490d7e20c8c221d4d7e189140182ec8603.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                176,
                621,
                668,
                791
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "OS 的其他分类方法"
                    }
                ],
                "level": 1
            },
            "bbox": [
                144,
                99,
                379,
                122
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "– 用户数量：单用户 OS，多用户 OS"
                    }
                ]
            },
            "bbox": [
                144,
                166,
                428,
                181
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "– 任务数量：单任务 OS，多任务 OS"
                    }
                ]
            },
            "bbox": [
                146,
                184,
                428,
                199
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "单用户单任务 OS，单用户多任务 OS，多用户多任务 OS"
                    }
                ]
            },
            "bbox": [
                144,
                203,
                579,
                218
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "– 计算机体系结构：微机 OS，网络 OS，多处理机 OS，分布式 OS 等"
                    }
                ]
            },
            "bbox": [
                144,
                221,
                673,
                237
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "操作系统的硬件基础"
                    }
                ],
                "level": 1
            },
            "bbox": [
                144,
                262,
                394,
                284
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "处理器"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                370,
                223,
                390
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "处理器指令"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                438,
                270,
                458
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "计算机的所有操作都是由处理器指令（机器指令或计算机指令）所决定的"
                    }
                ]
            },
            "bbox": [
                144,
                498,
                717,
                514
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每条处理器指令包含处理器执行所需的信息：操作码、源操作数、目的操作数和下一条指令地址"
                    }
                ]
            },
            "bbox": [
                144,
                517,
                848,
                550
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "寻址方式：指令寻址和数据寻址"
                    }
                ]
            },
            "bbox": [
                146,
                554,
                400,
                569
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "寄存器"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                596,
                223,
                615
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "CPU的控制部件中，包含的寄存器有指令寄存器IR和程序计数器PC、算术逻辑单元有累加器ACC。包括通用寄存器、专用寄存器和控制寄存器。"
                    }
                ]
            },
            "bbox": [
                144,
                657,
                850,
                692
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "处理器特权级"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                718,
                294,
                738
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "计算机系统中运行的程序可以分为两大类：操作系统的管理程序和用户程序。"
                    }
                ]
            },
            "bbox": [
                144,
                778,
                742,
                793
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "即，CPU 上会运行两种程序，一种是操作系统内核程序，一种是应用程序。"
                    }
                ]
            },
            "bbox": [
                144,
                797,
                722,
                813
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "多数系统将处理器特权级划分为管态和目态。"
                    }
                ]
            },
            "bbox": [
                146,
                815,
                495,
                831
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "管态又称为系统态、核心态等，是操作系统管理程序运行时处理器所处状态。"
                    }
                ]
            },
            "bbox": [
                144,
                834,
                742,
                848
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "所谓特权指令（清内存、外部设备输入输出、修改特殊寄存器、改变机器状态等）。使用系统中所有资源等等权限。"
                    }
                ]
            },
            "bbox": [
                144,
                852,
                848,
                885
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "目态又称为用户态，时用户程序执行时处理器其所处的状态。"
                    }
                ]
            },
            "bbox": [
                146,
                890,
                616,
                904
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "存储器"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                101,
                223,
                120
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "磁盘的工作原理。"
                    }
                ]
            },
            "bbox": [
                176,
                161,
                312,
                175
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "1、盘面。每个盘片又两个盘面。每一个这样的有效盘面都由一个盘面号，按顺序从上至下、从0开始依次编号"
                    }
                ]
            },
            "bbox": [
                176,
                179,
                845,
                212
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "磁面号又叫磁头号，因为每一个有效盘面都有对应的读写磁头。"
                    }
                ]
            },
            "bbox": [
                205,
                217,
                695,
                231
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "2、磁道。磁盘在低级格式化时被划分成许多同心圆。这些痛惜暖的轨迹叫做磁道。信息以脉冲串的形式记录再写轨迹中。磁道由外向内，从0开始顺序编号。"
                    }
                ]
            },
            "bbox": [
                176,
                235,
                845,
                269
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每条磁道不是连续记录数据，而是划分成一段段圆弧。这些圆弧的角速度一样，线速度不一样。"
                    }
                ]
            },
            "bbox": [
                205,
                272,
                845,
                306
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每一段圆弧叫做一个删去，删去从 1 开始编号。每个删去中断数据作为一个单元读出或写入。"
                    }
                ]
            },
            "bbox": [
                171,
                309,
                847,
                343
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "3、柱面。所有盘面上的同一磁道构成一个圆柱，称作柱面。每个援助上的磁头由上而下从0开始编号 。数据的读写按柱面进行，即从0磁头开始进行从左。只有同一柱面上所有磁头全部读写完毕后，磁头才转移到下一柱面。"
                    }
                ]
            },
            "bbox": [
                176,
                346,
                847,
                399
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "选取磁头只需通过电子切换，但是柱面必须通过急切切换。所以数据的读写按柱面进行，而不是盘面进行。"
                    }
                ]
            },
            "bbox": [
                203,
                401,
                845,
                436
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "4．扇区。操作系统一扇区的形式将新抄袭存储在硬磁盘上。每个扇区包含两个主要部分：扇区标识符和存储数据的数据段。512B"
                    }
                ]
            },
            "bbox": [
                144,
                439,
                847,
                472
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "扇区标识符，又称为扇区头标，包括组成山区三维地质的三个数字：1、盘面好 2柱面号3扇区号，也叫做块号"
                    }
                ]
            },
            "bbox": [
                144,
                476,
                848,
                508
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "还有其余字段"
                    }
                ]
            },
            "bbox": [
                216,
                513,
                327,
                527
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "CPU——进程"
                    }
                ]
            },
            "bbox": [
                144,
                569,
                250,
                583
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "内存（主存）——存储器"
                    }
                ]
            },
            "bbox": [
                146,
                587,
                346,
                602
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "磁盘/硬盘——文件系统"
                    }
                ]
            },
            "bbox": [
                146,
                606,
                336,
                621
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/259250d3ec3eb138fab880fb1fa77f031ae6e877c4cae498908c44e44622d37b.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                621,
                608,
                765
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "中断和时钟"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                794,
                285,
                816
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "中断会使得 CPU 由用户态变为内核态，使操作系统重新夺回对 CPU 控制权。"
                    }
                ]
            },
            "bbox": [
                144,
                860,
                727,
                876
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "内核态->用户态，执行一条特权指令修改 PSW的标志位为用户态。这个动作意味着操作系"
                    }
                ]
            },
            "bbox": [
                144,
                879,
                847,
                895
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "统将主动让出 CPU。"
                    }
                ]
            },
            "bbox": [
                144,
                93,
                299,
                108
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "用户态- "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\cdot >"
                    },
                    {
                        "type": "text",
                        "content": "内核态：由中断引发，硬件自动完成变态过程，触发中断信号意味着操作系统夺取CPU的使用权。"
                    }
                ]
            },
            "bbox": [
                144,
                112,
                847,
                145
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "响应中断时，保存到主存中。"
                    }
                ]
            },
            "bbox": [
                146,
                149,
                369,
                162
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "硬件 PS 和 PC"
                    }
                ]
            },
            "bbox": [
                146,
                168,
                252,
                181
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "中断/异常处理程序"
                    }
                ]
            },
            "bbox": [
                146,
                186,
                299,
                200
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "所有通用寄存器"
                    }
                ]
            },
            "bbox": [
                146,
                205,
                275,
                219
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "需要的其他信息：中断/异常、错误码"
                    }
                ]
            },
            "bbox": [
                146,
                223,
                440,
                237
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "SS ：段地址"
                    }
                ]
            },
            "bbox": [
                146,
                242,
                242,
                256
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "ESP： 端内偏移量"
                    }
                ]
            },
            "bbox": [
                146,
                261,
                285,
                275
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "按中断功能分类"
                    }
                ]
            },
            "bbox": [
                146,
                279,
                275,
                293
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1、输入输出中断I/O 传输结束或出错终端"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2、外中断：时钟中断、操作员控制中断、通信中断"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "3、机器的故障中断：电源故障、主存取指令等 "
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "4、 程序性中断：（？）溢出、用户态下用核心态指令"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                144,
                297,
                569,
                368
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "5、访管中断 "
                    }
                ]
            },
            "bbox": [
                146,
                372,
                252,
                386
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "要么是执行用户态中的代码——"
                    }
                ]
            },
            "bbox": [
                146,
                390,
                396,
                405
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "要么执行核心态的代码——"
                    }
                ]
            },
            "bbox": [
                146,
                407,
                361,
                423
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                284,
                439,
                425,
                451
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [],
                "level": 1
            },
            "bbox": [
                154,
                451,
                347,
                470
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "九曲阑干"
                    }
                ],
                "level": 1
            },
            "bbox": [
                556,
                450,
                643,
                473
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/1b44b5af64decdd77f6ae83d8478a33f80e2c7fce32681c40b28d11d46adfec7.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                191,
                476,
                647,
                644
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "系统调用"
                    }
                ]
            },
            "bbox": [
                146,
                649,
                221,
                665
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "用陷入指令"
                    }
                ]
            },
            "bbox": [
                146,
                668,
                238,
                683
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "操作系统的启动"
                    }
                ]
            },
            "bbox": [
                146,
                686,
                275,
                701
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "操作系统存储在硬盘上"
                    }
                ]
            },
            "bbox": [
                146,
                705,
                327,
                719
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "操作系统从硬盘加载到内存里去运行"
                    }
                ]
            },
            "bbox": [
                146,
                722,
                433,
                738
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "CPU执行的第一条指令来自哪里？"
                    }
                ]
            },
            "bbox": [
                146,
                741,
                405,
                757
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "将 CS 和 RIP 复位"
                    }
                ]
            },
            "bbox": [
                146,
                760,
                275,
                775
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "从 ROM（BIOS 程序）中读取 basic input/output system"
                    }
                ]
            },
            "bbox": [
                146,
                778,
                559,
                795
            ]
        }
    ],
    [
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/436cfb9a722aa06ea9e117cdd76ede7e5e6d1b16475e90a82da6601c667367a5.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                146,
                86,
                611,
                280
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1.上电自检(POST，Power-on Self-Test) "
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2.初始化硬件设备"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "3.搜索一个操作系统来启动。例如：硬盘、U盘、光盘"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "4.找到有效的设备后，把第一个扇区的内容拷贝到内存中起始地址是0x00007c00，然后跳转到这个地址处"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                159,
                288,
                576,
                413
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [],
                "level": 1
            },
            "bbox": [
                171,
                428,
                247,
                445
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                336,
                423,
                450,
                429
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "九曲闲干"
                    }
                ],
                "level": 1
            },
            "bbox": [
                500,
                428,
                574,
                447
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "扇区，磁盘基本的读写单位，通常一个扇区大小是512个字节5B"
                    }
                ]
            },
            "bbox": [
                173,
                455,
                579,
                470
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "·硬盘的第一个扇区称为主引导记录（MBR，Master Boot Record）"
                    }
                ]
            },
            "bbox": [
                176,
                476,
                529,
                491
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "·引导程序（bootloader），大小446 Byte"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                186,
                495,
                574,
                527
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "引导程序（boot loader）"
                    }
                ]
            },
            "bbox": [
                188,
                537,
                324,
                549
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "根据分区表的信息，寻找操作系统所在的具体分区，加载操作系统"
                    }
                ]
            },
            "bbox": [
                186,
                554,
                544,
                565
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "由于空间的限制，引导程序一般需要两步"
                    }
                ]
            },
            "bbox": [
                164,
                598,
                482,
                615
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "·第二步，分区引导程序执行内核的加载"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                183,
                621,
                465,
                667
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/92622f4b31f4c2e16b7acc7dc470a52316dfb0d702766d7e86671d56eb15d494.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                152,
                688,
                699,
                780
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "中断一般是异步的，由硬件随机产生，中断信号来自 CPU 外部。"
                    }
                ]
            },
            "bbox": [
                144,
                834,
                636,
                850
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "异常一般是同步的，在特殊的或出错指令执行时由 CPU控制单元产生，中断信号来源于CPU内部，内中断。"
                    }
                ]
            },
            "bbox": [
                144,
                852,
                845,
                887
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "中断进一步可分为屏蔽中断和非屏蔽中断。可屏蔽中断是由程序控制器屏蔽行的中断，处"
                    }
                ]
            },
            "bbox": [
                144,
                890,
                847,
                906
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "于屏蔽状态时，处理器忽略该类中断信号。"
                    }
                ]
            },
            "bbox": [
                144,
                93,
                473,
                108
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "非屏蔽中断，不能由程序控制其屏蔽性。"
                    }
                ]
            },
            "bbox": [
                144,
                112,
                457,
                126
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "异常又包括："
                    }
                ]
            },
            "bbox": [
                146,
                130,
                245,
                143
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "1、处理器异常"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                149,
                268,
                162
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "故障 "
                    }
                ]
            },
            "bbox": [
                176,
                168,
                216,
                181
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "陷阱 "
                    }
                ]
            },
            "bbox": [
                178,
                186,
                216,
                200
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "异常终止"
                    }
                ]
            },
            "bbox": [
                178,
                205,
                250,
                219
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "2、编程异常"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                223,
                250,
                237
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "屏蔽中断 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                241,
                221,
                255
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "对于单处理器系统，最简单的方法就是每个进程刚刚进入临界区后，立即屏蔽所有中断，在离开之前再打开中断。"
                    }
                ]
            },
            "bbox": [
                144,
                258,
                480,
                281
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "CPU只有发生时钟中断或者其他中断时，才会进行进程切换。"
                    }
                ]
            },
            "bbox": [
                144,
                286,
                442,
                296
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "对于多核处理器，屏蔽中断只对执行屏蔽指令的CPU有效"
                    }
                ]
            },
            "bbox": [
                144,
                309,
                428,
                319
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "对于内核来说，当使用几条指令更新变量时，将中断屏蔽是很方便的"
                    }
                ]
            },
            "bbox": [
                144,
                330,
                485,
                340
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "一种合适的通用互斥机制。"
                    }
                ]
            },
            "bbox": [
                144,
                349,
                477,
                369
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "用户获得中断的权限会有系统风险。一个进程禁止中断后，一直没有开放中断，会影响系统的正常运行。"
                    }
                ]
            },
            "bbox": [
                144,
                388,
                847,
                423
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "中断/异常混淆的概念"
                    }
                ],
                "level": 1
            },
            "bbox": [
                176,
                470,
                408,
                491
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "九曲闲干"
                    }
                ],
                "level": 1
            },
            "bbox": [
                618,
                469,
                717,
                495
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "·操作系统启动时，分配和初始化一个跳转表"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "例如：缺页故障、缺页异常、缺页表示同一含义"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "Intel手册中将中断分为内中断和外中断，内中断与异常表示同一含义"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                169,
                502,
                682,
                683
            ]
        }
    ],
    [
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/f1ad9accb4893c0dea1c5bf85152beef8e22c2e50d5b85e4ad7aa6c886cfb9a5.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                89,
                1000,
                307
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "中断"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                338,
                200,
                359
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "当前 CPU 执行完指令，中断引脚电压变高说明有中断"
                    }
                ]
            },
            "bbox": [
                147,
                399,
                559,
                416
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "然后去响应中断 "
                    }
                ]
            },
            "bbox": [
                147,
                418,
                275,
                434
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "时钟中断 "
                    }
                ]
            },
            "bbox": [
                147,
                437,
                221,
                451
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "I/O中断请求 "
                    }
                ]
            },
            "bbox": [
                147,
                456,
                248,
                470
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "不同中断信号"
                    }
                ]
            },
            "bbox": [
                147,
                474,
                255,
                489
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "中断向量表"
                    }
                ]
            },
            "bbox": [
                147,
                493,
                240,
                508
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "中断处理程序处于内核态"
                    }
                ]
            },
            "bbox": [
                147,
                511,
                346,
                526
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/dfc01753df0f69c7b2be3aaf2ac24667df63af7b54165d5495774ccc83b32e15.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                527,
                690,
                653
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "陷阱 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                99,
                201,
                120
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/b78e84d58dc676643c80c101240c825e813e9e9047cf52b9742db6689be3753d.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                156,
                801,
                407
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "故障 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                444,
                200,
                463
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "缺页故障、缺页异常——地址不在内存中"
                    }
                ]
            },
            "bbox": [
                144,
                504,
                468,
                521
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "保护异常——地址不合法"
                    }
                ]
            },
            "bbox": [
                147,
                523,
                347,
                538
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "因此需要再次取一次故障指令"
                    }
                ]
            },
            "bbox": [
                147,
                542,
                381,
                556
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/47e683f97cfcb1e83fd0f5380803eae1066353b0d0b847f7b75dd6b2e0db8779.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                557,
                853,
                701
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "中止"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                101,
                200,
                120
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/4a31576b14a791537c99077ff350c866216ba52927e7321a2fa4f99fbff197d1.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                156,
                878,
                303
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "异常表"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                351,
                221,
                370
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "存储在内存中"
                    }
                ]
            },
            "bbox": [
                147,
                412,
                258,
                426
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "异常号相当于偏移量"
                    }
                ]
            },
            "bbox": [
                147,
                430,
                310,
                445
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "找到异常处理程序"
                    }
                ]
            },
            "bbox": [
                147,
                449,
                292,
                464
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/8c1cdb8de23cdc4bf55f3d3ee93d37ff2f4bc25332daeb2d15e48f53afcb64ff.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                464,
                477,
                571
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/3e8b269fca3357d31be03b7a3ce82320dbe231c6298538f573b31b85ae00d202.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                594,
                559,
                674
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/977ddaab1967b4afa82d15a06d77c95ddcb42aee58b3644f7572e1d5b70f61ba.jpg"
                },
                "table_caption": [
                    {
                        "type": "text",
                        "content": "图8-9x86-64系统中的异常示例"
                    }
                ],
                "table_footnote": [],
                "html": "<table><tr><td>异常号</td><td>描述</td><td>异常类别</td></tr><tr><td>0</td><td>除法错误</td><td>故障</td></tr><tr><td>13</td><td>一般保护故障</td><td>故障</td></tr><tr><td>14</td><td>缺页</td><td>故障</td></tr><tr><td>18</td><td>机器检查</td><td>终止</td></tr><tr><td>32~255</td><td>操作系统定义的异常</td><td>中断或陷阱</td></tr></table>",
                "table_type": "simple_table",
                "table_nest_level": 1
            },
            "bbox": [
                171,
                697,
                719,
                816
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "陷阱和系统调用"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                99,
                339,
                122
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "系统调用"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                174,
                247,
                193
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "操作系统作为用户和计算机硬件之间的接口，为方便用户调用这些内核服务功能需要提供一些简单易用的服务。主要包括命令接口和程序接口，其中程序接口由一组系统调用组成"
                    }
                ]
            },
            "bbox": [
                144,
                253,
                852,
                290
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "用户态和核心（内核）态"
                    }
                ]
            },
            "bbox": [
                146,
                326,
                347,
                343
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "用户不能直接访问磁盘"
                    }
                ]
            },
            "bbox": [
                147,
                344,
                329,
                361
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "只能通过操作系统提供的接口"
                    }
                ]
            },
            "bbox": [
                147,
                363,
                379,
                380
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "操作系统替用户访问磁盘"
                    }
                ]
            },
            "bbox": [
                147,
                382,
                346,
                398
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "执行系统调用（请求操作系统内核的服务），程序必须执行特殊的陷阱指令（syscall x86）"
                    }
                ]
            },
            "bbox": [
                146,
                401,
                835,
                417
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "可以理解为一种可供程序调用的特殊函数，应用程序可以通过系统调用来获得操作系统内核的服务"
                    }
                ]
            },
            "bbox": [
                146,
                420,
                848,
                454
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/f619c311d11fb91729f41ed6212d29423975240abc306ca0c205fb927c45a7b8.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td>普通应用程序</td><td>可直接进行系统调用，也可使用库函数。有的库函数涉及系统调用，有的不涉及</td></tr><tr><td>编程语言</td><td>向上提供库函数。有时会将系统调用封装成库函数，以隐藏系统调用的一些细节，使程序员编程更加方便。</td></tr><tr><td>操作系统</td><td>向上提供系统调用，使得上层程序能请求内核的服务</td></tr><tr><td>裸机</td><td></td></tr></table>",
                "table_type": "simple_table",
                "table_nest_level": 1
            },
            "bbox": [
                147,
                474,
                611,
                632
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/23b678a97c5812bdc937a6dc92b48374e1ad9c2c4b7ad25dc8f45d764b201265.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                171,
                722,
                808,
                843
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "由于应用程序运行在用户态，而系统调用服务例程运行在内核态，因此应用程序布恩那个直接调用内核发服务例程，而是通过执行一条叫做“访管指令”（陷入指令/trap指令）的机器指令来实现调用的，这条指令的功能时引发一个编程异常，促使 CPU从用户态切换到内核态，即系统调用入口程序"
                    }
                ]
            },
            "bbox": [
                144,
                93,
                848,
                164
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "根据向量号查找中断描述表，得到该异常的中断处理程序入口地址"
                    }
                ]
            },
            "bbox": [
                144,
                167,
                663,
                184
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "执行 system_call()函数，找到这个系统调用服务例程的入口地址"
                    }
                ]
            },
            "bbox": [
                144,
                186,
                636,
                202
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "程序的特权级从用户模型提升至内核级"
                    }
                ]
            },
            "bbox": [
                144,
                223,
                452,
                239
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "一旦进入内核，系统可以执行任何需要的特权操作"
                    }
                ]
            },
            "bbox": [
                144,
                241,
                541,
                256
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "当系统完成后，执行从陷阱返回（return-from-trap）指令"
                    }
                ]
            },
            "bbox": [
                144,
                260,
                588,
                275
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "因此陷阱指令是用户使用系统调用的窗口。"
                    }
                ]
            },
            "bbox": [
                144,
                279,
                475,
                294
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "用户->read->访问磁盘"
                    }
                ]
            },
            "bbox": [
                146,
                297,
                319,
                312
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/f541eaa76f03a3c47a4acbdfad91f50ea73e023de24545084f09bfe81f8b870d.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                315,
                584,
                448
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Sys_call 是在内核态"
                    }
                ]
            },
            "bbox": [
                146,
                464,
                299,
                479
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "系统调用函数在内核态"
                    }
                ]
            },
            "bbox": [
                146,
                482,
                327,
                497
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "执行哪一个系统调用？ 系统调用号"
                    }
                ]
            },
            "bbox": [
                146,
                501,
                450,
                514
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/340325887d6ef29dce84caf31271f6e50e64721467c65932bf5bd69766d384e9.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                516,
                579,
                686
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/5f70274e80799cc8ff8ba53057a0df3542149b993b3f741504298a3b2edf6d77.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td>编号</td><td>名字</td><td>描述</td><td>编号</td><td>名字</td><td>描述</td></tr><tr><td>0</td><td>read</td><td>读文件</td><td>33</td><td>pause</td><td>挂起进程直到信号到达</td></tr><tr><td>1</td><td>write</td><td>写文件</td><td>37</td><td>alarm</td><td>调度告警信号的传送</td></tr><tr><td>2</td><td>open</td><td>打开文件</td><td>39</td><td>getpid</td><td>获得进程ID</td></tr><tr><td>3</td><td>close</td><td>关闭文件</td><td>57</td><td>fork</td><td>创建进程</td></tr><tr><td>4</td><td>stat</td><td>获得文件信息</td><td>59</td><td>exe#ve</td><td>执行一个程序</td></tr><tr><td>9</td><td>mmap</td><td>将内存页映射到文件</td><td>60</td><td>exit</td><td>终止进程</td></tr><tr><td>12</td><td>brk</td><td>重置堆顶</td><td>61</td><td>halt4</td><td>等待一个进程终止</td></tr><tr><td>32</td><td>dup2</td><td>复制文件描述符</td><td>62</td><td>k#1</td><td>发送信号到一个进程</td></tr></table>",
                "table_type": "simple_table",
                "table_nest_level": 1
            },
            "bbox": [
                147,
                702,
                579,
                802
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "控制寄存器有一位记录了当前模式是用户模式还是内核模式"
                    }
                ]
            },
            "bbox": [
                146,
                816,
                611,
                831
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                159,
                92,
                406,
                105
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": ">·进程在用户模式下不运行执行特权指令/操作"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "进在停止处理、起一个1/权操作，操中"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "·不允许在用户模式下直接引用内核区域的代码和数据"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                147,
                115,
                539,
                192
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/6df2c8106dd4fe2552e1c66a682d466406fbe481810f4e6b4594199d20da974c.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                217,
                494,
                344
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/309bb212126a35535f1ad1913041d8a152f86709dc8e47401d52a42c162f064c.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                146,
                347,
                557,
                475
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "进程管理"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                504,
                258,
                526
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "引入进程的原因"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                570,
                273,
                585
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "1. 引入进程的原因"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                589,
                292,
                604
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "– 为了提高资源利用率必须让多个程序并发运行。"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "– 程序的并发运行出现了新的特征：间断性、 失去封闭性、 不可再现性。"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "– 为了让程序能正确并发运行，引入进程概念。"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                146,
                607,
                707,
                659
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "操作系统的代码是所有进程的公共代码"
                    }
                ]
            },
            "bbox": [
                144,
                681,
                450,
                696
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "运行模式和进程切换"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                700,
                310,
                715
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/d2818a53733fb719994bb7c40f2b4cd2201f2ffe88c5b84c92b960d355df54c3.jpg"
                },
                "image_caption": [
                    {
                        "type": "text",
                        "content": "进程1 "
                    }
                ],
                "image_footnote": []
            },
            "bbox": [
                147,
                715,
                289,
                831
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/41c3feaf39deb0a28146bdebdf2ee87a65fae697302b68dd62e3cc06b710b300.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                299,
                714,
                678,
                859
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如何切换进程？"
                    }
                ]
            },
            "bbox": [
                146,
                885,
                265,
                901
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "要从用户模式切换到内核模式"
                    }
                ]
            },
            "bbox": [
                144,
                93,
                381,
                108
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "访问了内核区域，触发一般保护故障"
                    }
                ]
            },
            "bbox": [
                146,
                112,
                433,
                128
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程：一个正在运行程序的抽象，程序的一次执行。"
                    }
                ]
            },
            "bbox": [
                144,
                148,
                547,
                164
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "程序：指令的有序集合。"
                    }
                ]
            },
            "bbox": [
                146,
                168,
                334,
                183
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "·Linux:创建进程使用系统调用fork(+execve()"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "·Windows:CreateProcess() "
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "·父进程 shell "
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "·子进程 hello "
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                154,
                214,
                657,
                328
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "在./hello->shell 中 fork()+execute()"
                    }
                ]
            },
            "bbox": [
                144,
                353,
                403,
                369
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "父进程和子进程具有独立的但是相同的虚拟地址空间"
                    }
                ]
            },
            "bbox": [
                144,
                370,
                556,
                387
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Init——最初的父进程"
                    }
                ]
            },
            "bbox": [
                146,
                390,
                312,
                405
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "树形的关系"
                    }
                ]
            },
            "bbox": [
                146,
                407,
                240,
                423
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程运行时有独立的虚拟地址空间"
                    }
                ]
            },
            "bbox": [
                146,
                426,
                415,
                442
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/11df7ec02fddceb002b766c44e5344f70bc39ff07fe885f860e2a836bebc5b74.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                444,
                574,
                674
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "进程的创建"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                99,
                285,
                122
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "进程的创建"
                    }
                ],
                "level": 1
            },
            "bbox": [
                157,
                161,
                292,
                181
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [],
                "level": 1
            },
            "bbox": [
                473,
                161,
                532,
                184
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "九曲"
                    }
                ],
                "level": 1
            },
            "bbox": [
                557,
                161,
                600,
                181
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1.系统初始化（操作系统启动过程中）"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2.正在运行的程序执行了创建进程的系统调用(fork)"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "3.用户请求创建一个新进程"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "4.一个批处理作业的初始化"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                159,
                197,
                596,
                300
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "程序是静态的"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                313,
                257,
                329
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "但是一个程序对应一个进程"
                    }
                ]
            },
            "bbox": [
                146,
                332,
                363,
                347
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程是具有一定独立功能的程序关于讴歌数据集合的一次运行过程，是系统进行资源分配和调度的一个独立单位。"
                    }
                ]
            },
            "bbox": [
                144,
                350,
                847,
                384
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程的特征 "
                    }
                ]
            },
            "bbox": [
                146,
                388,
                238,
                403
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "结构特征"
                    }
                ]
            },
            "bbox": [
                146,
                407,
                221,
                422
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "动态性"
                    }
                ]
            },
            "bbox": [
                146,
                426,
                203,
                439
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "并发性 "
                    }
                ]
            },
            "bbox": [
                147,
                444,
                203,
                458
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "独立性"
                    }
                ]
            },
            "bbox": [
                147,
                463,
                203,
                476
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "异步性"
                    }
                ]
            },
            "bbox": [
                147,
                481,
                203,
                495
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "结构性"
                    }
                ]
            },
            "bbox": [
                147,
                499,
                203,
                514
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "程序的并发执行：多个程序共享资源，并发运行"
                    }
                ]
            },
            "bbox": [
                144,
                536,
                522,
                552
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1、间断性。并发程序并不是一气呵成的，中间总会因此彼此间的各种制约关系出现暂停，因为系统只有一个 CPU"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2、 失去封闭性而导致程序运行结果不可再现性，即对没有对资源的互斥共享"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "3、静态程序结构不能支持并发运行的实现"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                146,
                555,
                855,
                625
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程控制"
                    }
                ]
            },
            "bbox": [
                147,
                629,
                221,
                644
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "分配内存资源、回收内存资源、控制状态转换"
                    }
                ]
            },
            "bbox": [
                146,
                648,
                504,
                662
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程互斥 "
                    }
                ]
            },
            "bbox": [
                147,
                665,
                221,
                681
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "互斥方式：多个进程载访问某些共享资源（临界资源）应采用互斥的方式访问"
                    }
                ]
            },
            "bbox": [
                146,
                684,
                749,
                700
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "同步方式：多个进程相互合作完成一些共同任务，前驱满足后继"
                    }
                ]
            },
            "bbox": [
                146,
                703,
                645,
                718
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程通信近九成之间的信息交换"
                    }
                ]
            },
            "bbox": [
                146,
                722,
                398,
                736
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "调度"
                    }
                ]
            },
            "bbox": [
                147,
                740,
                186,
                755
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "对资源或人物进行合理分配和管理"
                    }
                ]
            },
            "bbox": [
                146,
                758,
                416,
                772
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "能够后背队列中按照一定的算法选择若干个作业调入内存，为他们创建进程，分配必要资源，插入就绪队列"
                    }
                ]
            },
            "bbox": [
                144,
                777,
                847,
                810
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "4. 进程与程序的区别"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                832,
                310,
                848
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "(1)从定义上看，程序是一组指令的有序集合；进程是程序的运行过程；"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "(2)从结构上看，进程不仅包含程序段，还包含数据段和 PCB；"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "(3)进程是动态性，而程序是静态的；"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                146,
                851,
                690,
                904
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "(4)进程可独立地、并发地执行，程序则不能独立、并发执行"
                    }
                ]
            },
            "bbox": [
                146,
                93,
                613,
                109
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "5. 进程与程序的对应关系"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                112,
                346,
                127
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "‐ 在某个时刻一个进程对应于一个程序；"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "‐ 在整个生命周期中，进程可执行多个程序；( fork+exec )"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "‐ 一个程序多次执行则将对应多个进程；"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                146,
                130,
                584,
                183
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "进程控制块/进程表"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                206,
                379,
                229
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "PCB（struct）"
                    }
                ]
            },
            "bbox": [
                146,
                274,
                243,
                288
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程描述信息"
                    }
                ]
            },
            "bbox": [
                146,
                311,
                257,
                326
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程控制和管理信息"
                    }
                ]
            },
            "bbox": [
                146,
                330,
                309,
                344
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "资源分配清单"
                    }
                ]
            },
            "bbox": [
                146,
                348,
                257,
                363
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "处理机相关信息"
                    }
                ]
            },
            "bbox": [
                146,
                367,
                273,
                382
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "进程控制块/进程表"
                    }
                ],
                "level": 1
            },
            "bbox": [
                151,
                384,
                478,
                413
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "九曲阑干"
                    }
                ],
                "level": 1
            },
            "bbox": [
                732,
                380,
                865,
                413
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/8c5fd40337b03e6ab6f99d727264e375f3aa9191cad60e65e5fab46b24e43054.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td>进程管理\n寄存器\n程序计数器\n程序状态字\n堆栈指针\n进程状态\n优先级\n调度参数\n进程ID\n父进程\n进程组\n信号\n进程开始时间\n使用的CPU时间\n子进程的CPU时间\n下次报警时间</td><td>存储管理\n正文段指针\n数据段指针\n堆栈段指针</td><td>文件管理\n根目录\n工作目录\n文件描述符\n用户ID\n组ID</td><td>PCB\nStruct</td></tr></table>",
                "table_type": "simple_table",
                "table_nest_level": 1
            },
            "bbox": [
                213,
                432,
                855,
                680
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程映像是指进程实体的组成。"
                    }
                ]
            },
            "bbox": [
                146,
                681,
                386,
                696
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "程序（段）正文段——代码段CS"
                    }
                ]
            },
            "bbox": [
                146,
                700,
                401,
                715
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "数据集数据段DS"
                    }
                ]
            },
            "bbox": [
                146,
                719,
                278,
                733
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "（有的包含栈堆栈段SP"
                    }
                ]
            },
            "bbox": [
                157,
                737,
                329,
                752
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "）"
                    }
                ]
            },
            "bbox": [
                146,
                756,
                157,
                770
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "PCB进程描述信息"
                    }
                ]
            },
            "bbox": [
                146,
                775,
                287,
                789
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程是动态的，进程是进程实体（进程映像）的组成"
                    }
                ]
            },
            "bbox": [
                146,
                793,
                556,
                808
            ]
        }
    ],
    [
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/3f277a24134a1fff284952aea3bf5e3b9b9e2e23e516558143d83af7346a6e9b.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                89,
                931,
                350
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程状态 "
                    }
                ]
            },
            "bbox": [
                147,
                370,
                221,
                386
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程被创建后，进入就绪队列，等待被调度执行"
                    }
                ]
            },
            "bbox": [
                146,
                407,
                522,
                423
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "8. 内核态与用户态"
                    }
                ],
                "level": 1
            },
            "bbox": [
                144,
                445,
                292,
                460
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "CPU 指令（特权指令，非特权指令）"
                    }
                ]
            },
            "bbox": [
                144,
                464,
                421,
                479
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "equation_inline",
                                "content": "\\blacktriangle"
                            },
                            {
                                "type": "text",
                                "content": "特权指令：关机指令、清主存、启动外设指令、设置系统时钟时间、关中断、修改存储器管理寄存器等"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "equation_inline",
                                "content": "\\blacktriangle"
                            },
                            {
                                "type": "text",
                                "content": "非特权指令：通用寄存器清0 指令，访问内存指令，算术运算指令等"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                144,
                482,
                803,
                535
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "CPU 的执行状态"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                539,
                273,
                552
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "内核态（核心态、系统态、管态）：能访问所有的内存空间和 I/O 端口，能执行特权和非特权指令。"
                    }
                ]
            },
            "bbox": [
                144,
                556,
                781,
                590
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "用户态（目态）只能访问分配给自己的内存空间，只能执行非特权指令。"
                    }
                ]
            },
            "bbox": [
                144,
                593,
                705,
                609
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "进程的三（五）种状态："
                    }
                ],
                "level": 1
            },
            "bbox": [
                144,
                633,
                430,
                656
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "运行"
                    }
                ]
            },
            "bbox": [
                146,
                700,
                186,
                715
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "就绪 "
                    }
                ]
            },
            "bbox": [
                147,
                718,
                186,
                734
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "阻塞 "
                    }
                ]
            },
            "bbox": [
                149,
                737,
                186,
                751
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "创建状态和终止状态"
                    }
                ]
            },
            "bbox": [
                147,
                755,
                310,
                771
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "进程状态 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                173,
                90,
                268,
                108
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程被创建后，进入就绪队列"
                    }
                ]
            },
            "bbox": [
                171,
                118,
                351,
                131
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "等待被调度执行"
                    }
                ]
            },
            "bbox": [
                174,
                135,
                268,
                147
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                174,
                158,
                302,
                172
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "·阻塞 "
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                178,
                181,
                220,
                231
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/651bc6b37b1a89309442cffe1a9dfd057d2304036fc3f7582a89eade6c7f69fa.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                394,
                123,
                576,
                236
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/8f8f6b1a0546fe3bcc56c8a2213aec037a5222b383b5575aee22751401616032.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                181,
                341,
                600,
                488
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "7．单CPU中N个进程的情况"
                    }
                ],
                "level": 1
            },
            "bbox": [
                169,
                514,
                332,
                526
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/1b78a15a1499de4d104e751077664a772cc7e9547cf7e88e31e42211ae37a77b.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                171,
                527,
                574,
                639
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "具有挂起状态的进程状态转换"
                    }
                ]
            },
            "bbox": [
                171,
                639,
                347,
                652
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/fabd57b4939f01b6eaf4906027767a9f33e5719a444ac61072ca412e94a54755.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                171,
                652,
                494,
                810
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "跟踪进程状态 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                169,
                838,
                304,
                854
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "进程终止"
                    }
                ],
                "level": 1
            },
            "bbox": [
                589,
                834,
                663,
                848
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/729bce6cf25fcc63f1057a7b78a4c9682779b2769dd2367e2c4057a52daeb3e6.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td>时间</td><td>Process0</td><td>Process1</td><td>注</td></tr><tr><td>1</td><td>运行</td><td>就绪</td><td></td></tr><tr><td>2</td><td>运行</td><td>就绪</td><td></td></tr><tr><td>3</td><td>运行</td><td>就绪</td><td>Process0发起I/O</td></tr><tr><td>4</td><td>阻塞</td><td>运行</td><td>Process0被阻塞</td></tr><tr><td>5</td><td>阻塞</td><td>运行</td><td>所以Process1运行</td></tr><tr><td>6</td><td>阻塞</td><td>运行</td><td></td></tr><tr><td>7</td><td>就绪</td><td>运行</td><td>I/O完成</td></tr><tr><td>8</td><td>就绪</td><td>运行</td><td>Process1现在完成</td></tr><tr><td>9</td><td>运行</td><td>-</td><td></td></tr><tr><td>10</td><td>运行</td><td>-</td><td>Process0现在完成</td></tr></table>",
                "table_type": "simple_table",
                "table_nest_level": 1
            },
            "bbox": [
                171,
                865,
                566,
                996
            ]
        },
        {
            "type": "page_header",
            "content": {
                "page_header_content": [
                    {
                        "type": "text",
                        "content": "九曲阑干"
                    }
                ]
            },
            "bbox": [
                529,
                89,
                613,
                109
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "进程终止"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                237,
                213,
                250
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "例如：打开文件失"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "除数为零，引用不存在的内存等"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "执行系统调用kiII杀死其他进程"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                147,
                255,
                290,
                348
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "单 CPU，所以一次只能有一个进程运行（交给 CPU）"
                    }
                ]
            },
            "bbox": [
                147,
                370,
                542,
                387
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": []
            },
            "bbox": [
                181,
                436,
                519,
                514
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "但是就绪队列还是可以有多个进"
                    }
                ]
            },
            "bbox": [
                591,
                519,
                850,
                535
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/659cfe3993816a0e3f9ec5c5ab4f117e78ce566b3e0299509a3fb97dcac3e3fe.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                198,
                536,
                576,
                600
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Eg：假设PCB中的变量state表示进程当前所处状态，1表示就绪态，2表示阻塞态.."
                    }
                ]
            },
            "bbox": [
                203,
                602,
                505,
                609
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/2a999be6a5cf15a590b2e419e7e34bd5c45f885ae6f9e939a3eba31d489a76c9.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                198,
                612,
                489,
                670
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "假设此时进程2等待的事件发生，则操作系统中，负责进程控制的内核程序至少需要做这样两件事："
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "①将PCB2的state设为1 "
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "②将PCB2从阻塞队列放到就绪队列 "
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                196,
                671,
                554,
                694
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                522,
                696,
                576,
                701
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "周转时间：一个是性能指标，另外一个是指标时公平性能和公平中往往是矛盾的"
                    }
                ]
            },
            "bbox": [
                144,
                722,
                557,
                756
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如何实现原语的原子性？"
                    }
                ]
            },
            "bbox": [
                147,
                760,
                336,
                775
            ]
        }
    ],
    [
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/0e6277d46f3ca6e6d4de052cd8a45b4def34f3966da291f77acfbce75f427dd1.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                89,
                215,
                104
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [],
                "level": 1
            },
            "bbox": [
                270,
                93,
                423,
                104
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "原语的执行具有原子性，即执行过程只能一气呵成，期间不允许被中断。可以用“关中断指令”和“开中断指令”这两个特权指令实现原子性"
                    }
                ]
            },
            "bbox": [
                166,
                118,
                428,
                134
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                418,
                131,
                426,
                140
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/1f7ddb9dcae01810b1a00eecf6bad483af571af2df0131e683ade11ebfc12f7f.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                181,
                146,
                363,
                231
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "CPU执行了关中断指令之后，就不再例行检查中断信号，直到执行开中断指令之后才会恢复检查。"
                    }
                ]
            },
            "bbox": [
                384,
                155,
                537,
                179
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "这样，关中断、开中断之间的这些指令序列就是不可被中断的，这就实现了“原子性"
                    }
                ]
            },
            "bbox": [
                384,
                183,
                537,
                206
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "OS 的内核运行于核心态，应用程序则运行于用户态。（进程控制的大量原语）"
                    }
                ]
            },
            "bbox": [
                144,
                260,
                746,
                275
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "进程通信"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                300,
                258,
                322
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "1、共享存储器系统通信"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                366,
                339,
                382
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "在存储器中划分出一块共享存储区，诸进程通过对共享存储区的读写操作来实现通信"
                    }
                ]
            },
            "bbox": [
                144,
                403,
                805,
                419
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Shm_open() "
                    }
                ]
            },
            "bbox": [
                146,
                441,
                240,
                458
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Void * map() "
                    }
                ]
            },
            "bbox": [
                146,
                460,
                242,
                475
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "通过系统调用，申请一片共享内存区"
                    }
                ]
            },
            "bbox": [
                374,
                439,
                660,
                456
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "通过 mmap 系统调用，将共享内存区映射到自己的地址空间"
                    }
                ]
            },
            "bbox": [
                374,
                458,
                838,
                474
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [],
                "level": 1
            },
            "bbox": [
                268,
                473,
                374,
                489
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/fdb9646d4742569587c516f0ede3ba8b28476971f01e63a8fa139a79e0a04d3b.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                176,
                495,
                746,
                750
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                144,
                736,
                171,
                750
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                278,
                734,
                315,
                750
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                463,
                697,
                742,
                744
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "同步互斥工作"
                    }
                ]
            },
            "bbox": [
                144,
                791,
                257,
                808
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "基于数据的共享"
                    }
                ]
            },
            "bbox": [
                147,
                810,
                273,
                827
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "基于存储区的共享"
                    }
                ]
            },
            "bbox": [
                147,
                829,
                290,
                845
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "高级通信方式"
                    }
                ]
            },
            "bbox": [
                147,
                848,
                257,
                863
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "2、消息传递系统通信"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                885,
                322,
                900
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "以格式化的信息为单位"
                    }
                ]
            },
            "bbox": [
                147,
                112,
                327,
                127
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "直接通信方式"
                    }
                ]
            },
            "bbox": [
                147,
                130,
                258,
                145
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "由一对通信原语 send(),receive() "
                    }
                ]
            },
            "bbox": [
                147,
                149,
                389,
                164
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "间接通信方式"
                    }
                ]
            },
            "bbox": [
                147,
                168,
                257,
                181
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程 Q 的消息队列"
                    }
                ]
            },
            "bbox": [
                147,
                186,
                294,
                200
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如果其他进程要发送给进程Q的消息都在Q的消息队列中"
                    }
                ]
            },
            "bbox": [
                146,
                204,
                594,
                219
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程 P 建立消息 msg，发送原语,send(Q,msg) "
                    }
                ]
            },
            "bbox": [
                147,
                223,
                489,
                239
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "被复制到了Q的消息队列中"
                    }
                ]
            },
            "bbox": [
                147,
                241,
                363,
                256
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "接受原语（receive (p,&msg)） "
                    }
                ]
            },
            "bbox": [
                147,
                260,
                366,
                275
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/70923663158f7f516917b74eecdb0207f55655a4f8292cb14a4a1ab91a24a179.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                198,
                286,
                838,
                521
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "间接通信方式，以“信箱中作为中间实体进行消息传递"
                    }
                ]
            },
            "bbox": [
                144,
                538,
                576,
                554
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Send (A,msg)发送到哪个信箱 "
                    }
                ]
            },
            "bbox": [
                147,
                557,
                369,
                571
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "3、管道通信"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                612,
                253,
                627
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "管道式一个特殊的共享问题件，又名为pipe文件。就是在内存中开辟一个大小固定的内存缓冲区"
                    }
                ]
            },
            "bbox": [
                144,
                649,
                847,
                682
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "先进先出的"
                    }
                ]
            },
            "bbox": [
                147,
                686,
                238,
                701
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "单向通信的"
                    }
                ]
            },
            "bbox": [
                147,
                705,
                238,
                719
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "管道文件被读取的部分会消失"
                    }
                ]
            },
            "bbox": [
                147,
                722,
                379,
                738
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "无名管道"
                    }
                ]
            },
            "bbox": [
                147,
                741,
                221,
                757
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "有名管道"
                    }
                ]
            },
            "bbox": [
                147,
                760,
                221,
                775
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "4、客户服务通信"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                797,
                287,
                813
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "消息缓冲队列通信机制"
                    }
                ]
            },
            "bbox": [
                147,
                816,
                327,
                831
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "进程控制"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                99,
                258,
                122
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "进程创建"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                208,
                245,
                228
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "作业调度"
                    }
                ]
            },
            "bbox": [
                147,
                268,
                221,
                285
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "用户登录"
                    }
                ]
            },
            "bbox": [
                147,
                287,
                221,
                303
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "提供特定服务"
                    }
                ]
            },
            "bbox": [
                147,
                305,
                255,
                321
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "应用请求 "
                    }
                ]
            },
            "bbox": [
                147,
                324,
                221,
                340
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程创建原语"
                    }
                ]
            },
            "bbox": [
                147,
                361,
                255,
                376
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "进程撤销 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                404,
                245,
                424
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "进程切换 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                470,
                245,
                491
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "进程切换 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                171,
                539,
                247,
                556
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                463,
                531,
                510,
                539
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "九曲闲干"
                    }
                ],
                "level": 1
            },
            "bbox": [
                445,
                539,
                509,
                555
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程切换，又叫上下文切换"
                    }
                ]
            },
            "bbox": [
                171,
                561,
                334,
                577
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "0 "
                    }
                ]
            },
            "bbox": [
                393,
                558,
                431,
                575
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1.保存当前进程的上下文"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2.恢复某个之前被抢占的进程的被保存的上下文"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "3.将控制传递给这个新恢复的进程"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                171,
                585,
                445,
                633
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                171,
                640,
                494,
                668
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "进程阻塞与唤醒 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                101,
                315,
                120
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "进程调度"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                167,
                258,
                189
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "调度的层次"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                242,
                268,
                262
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "高级：负责将进程调入内存，分配资源。从外存的后被队列中选择若干个作业调入内存，创建进程，并将新创建的进程插入就绪队列，准备执行；此外，当作业执行完毕后回收进程。"
                    }
                ]
            },
            "bbox": [
                144,
                302,
                848,
                355
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "中级：提高内存利用率和 CPU 吞吐量。将进程换出到外存，挂起状态。"
                    }
                ]
            },
            "bbox": [
                146,
                357,
                689,
                374
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "低级：负责分配 CPU 资源"
                    }
                ]
            },
            "bbox": [
                146,
                376,
                349,
                392
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "调度频率：低级>中级 "
                    },
                    {
                        "type": "equation_inline",
                        "content": ">"
                    },
                    {
                        "type": "text",
                        "content": "高级"
                    }
                ]
            },
            "bbox": [
                146,
                395,
                363,
                410
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/acbe7e281d4861ed3d3a2e7363c9d5d493361056a7096ce97f52a3565e1da77f.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                411,
                697,
                529
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程调度是操作系统在内核模式中进行"
                    }
                ]
            },
            "bbox": [
                146,
                562,
                453,
                577
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "忙等待 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                605,
                221,
                624
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "While(1) "
                    }
                ]
            },
            "bbox": [
                144,
                683,
                213,
                697
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "用户态一直占用CPU，无法切换到内核模式，就无法进行进程的切换。"
                    }
                ]
            },
            "bbox": [
                144,
                701,
                685,
                715
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "时钟中断 "
                    }
                ]
            },
            "bbox": [
                146,
                720,
                221,
                734
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "CPU响应中断，处理中断处理程序"
                    }
                ]
            },
            "bbox": [
                144,
                739,
                413,
                753
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "从用户态切换到内核态"
                    }
                ]
            },
            "bbox": [
                146,
                757,
                327,
                772
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "用户能关中断的话，就可以一直占用，这是不行的。"
                    }
                ]
            },
            "bbox": [
                144,
                776,
                546,
                791
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "进程调度方式"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                99,
                294,
                120
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "非抢占式"
                    }
                ]
            },
            "bbox": [
                146,
                161,
                221,
                175
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "抢占式"
                    }
                ]
            },
            "bbox": [
                147,
                180,
                206,
                193
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "内核完全不可抢占"
                    }
                ]
            },
            "bbox": [
                147,
                199,
                290,
                212
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "内核部分抢占"
                    }
                ]
            },
            "bbox": [
                147,
                217,
                255,
                231
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "内核完全可抢占"
                    }
                ]
            },
            "bbox": [
                147,
                235,
                273,
                250
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "考虑的目标"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                278,
                270,
                297
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "系统设计目标"
                    }
                ]
            },
            "bbox": [
                147,
                338,
                257,
                353
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "调度的公平性"
                    }
                ]
            },
            "bbox": [
                147,
                357,
                257,
                370
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "资源的均衡利用"
                    }
                ]
            },
            "bbox": [
                149,
                375,
                273,
                390
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "合理的系统开销"
                    }
                ]
            },
            "bbox": [
                149,
                394,
                275,
                409
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "评价指标"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                436,
                245,
                455
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "CPU 利用率 忙碌时间/总时间"
                    }
                ]
            },
            "bbox": [
                146,
                514,
                371,
                530
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "甘特图"
                    }
                ]
            },
            "bbox": [
                149,
                533,
                203,
                549
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "系统吞吐量"
                    }
                ]
            },
            "bbox": [
                149,
                552,
                240,
                567
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "总共完成了多少道作业/总共花了多少时间"
                    }
                ]
            },
            "bbox": [
                146,
                589,
                475,
                605
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "周转时间和带权周转时间"
                    }
                ]
            },
            "bbox": [
                147,
                608,
                344,
                623
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "周转时间——从作业提交给系统开始，到作业完成为止的这段时间间隔"
                    }
                ]
            },
            "bbox": [
                146,
                626,
                699,
                640
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "它包括四部分：作业在外存后备队列上等待作业调度（进入到内存并创建进程）的时间、进程在就绪队列上等待（调入到CPU）进程调度、进程在CPU上执行的时间，进程等待I/O操作完成的时间。后三项可能在一个作业处理过程中可能发生多次。"
                    }
                ]
            },
            "bbox": [
                146,
                645,
                847,
                697
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "周转时间 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "="
                    },
                    {
                        "type": "text",
                        "content": "作业完成时间-作业提交时间"
                    }
                ]
            },
            "bbox": [
                146,
                700,
                448,
                715
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "平均周转时间——各作业周转时间之和/作业数"
                    }
                ]
            },
            "bbox": [
                146,
                719,
                510,
                734
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "带权周转时间——作业周转时间/实际运行的时间 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "="
                    },
                    {
                        "type": "text",
                        "content": "作业完成时间-作业提交时间/作业实际运行的时间"
                    }
                ]
            },
            "bbox": [
                146,
                737,
                848,
                771
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "平均带权周转时间"
                    }
                ]
            },
            "bbox": [
                147,
                775,
                292,
                789
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "等待时间——进程/作业处于等待处理机时间之和"
                    }
                ]
            },
            "bbox": [
                146,
                793,
                529,
                808
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "对于进程来说，等待时间就是指建立后等待被服务的时间之和，在等待 I/O完成的期间其实进程也是在被服务的，所以不计入等待时间"
                    }
                ]
            },
            "bbox": [
                146,
                810,
                847,
                845
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "对于作业来说，不仅要考虑建立进程后的等待时间，还要加上作业在外存后备队列中等待的时间"
                    }
                ]
            },
            "bbox": [
                146,
                848,
                847,
                883
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "响应时间"
                    }
                ]
            },
            "bbox": [
                147,
                885,
                221,
                901
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                171,
                148,
                524,
                162
            ]
        },
        {
            "type": "equation_interline",
            "content": {
                "math_content": "\\mathrm {T} _ {\\text {响 应 时 间}} = \\mathrm {T} _ {\\text {首 次 运 行}} - \\mathrm {T} _ {\\text {到 达 时 间}}",
                "math_type": "latex",
                "image_source": {
                    "path": "images/42ef9e2ee8711cbc56e76f80c299b29457d01bc349f065ce523e610329165faa.jpg"
                }
            },
            "bbox": [
                184,
                175,
                428,
                196
            ]
        },
        {
            "type": "equation_interline",
            "content": {
                "math_content": "T _ {\\text {响 应 时 间}} = T _ {\\text {等 待 时 间}}",
                "math_type": "latex",
                "image_source": {
                    "path": "images/ff99e884ef98da75e6b1c15219ab4728c70472e83f7956929a658144ad54a41c.jpg"
                }
            },
            "bbox": [
                480,
                178,
                636,
                195
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/2ec455e962d174086eb9faac0d226ef4004594ba35fb515c885508fe653ca012.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                196,
                218,
                455,
                303
            ]
        },
        {
            "type": "equation_interline",
            "content": {
                "math_content": "\\mathrm {T} _ {\\text {响 应 时 间} \\mathrm {A}} = 0",
                "math_type": "latex",
                "image_source": {
                    "path": "images/f6746059e80216c955e129236d25c7edbc8790d1a8bfd7031584b44715047cd1.jpg"
                }
            },
            "bbox": [
                505,
                219,
                611,
                237
            ]
        },
        {
            "type": "equation_interline",
            "content": {
                "math_content": "\\mathrm {T} _ {\\text {响 应 时 间} \\mathrm {B}} = 0",
                "math_type": "latex",
                "image_source": {
                    "path": "images/b0ddaf931aed0cdebe4ec5a9e52d85e988d2f2522fa2b2649da42f0b548681a1.jpg"
                }
            },
            "bbox": [
                507,
                247,
                611,
                263
            ]
        },
        {
            "type": "equation_interline",
            "content": {
                "math_content": "\\mathrm {T} _ {\\text {响 应 时 间} \\mathrm {C}} = 1 0 \\mathrm {s}",
                "math_type": "latex",
                "image_source": {
                    "path": "images/07732192a3b304018205f2847efebca259568b1c48cf7db0dc14eea886a3c009.jpg"
                }
            },
            "bbox": [
                507,
                273,
                628,
                288
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "对截止时间的保证"
                    }
                ]
            },
            "bbox": [
                147,
                316,
                292,
                331
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "调度算法"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                357,
                245,
                378
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "周转时间 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "="
                    },
                    {
                        "type": "text",
                        "content": "完成时间-提交时间"
                    }
                ]
            },
            "bbox": [
                146,
                455,
                376,
                470
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "带权周转时间 周转时间/要求执行时间"
                    }
                ]
            },
            "bbox": [
                147,
                473,
                445,
                489
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "先来先服务FCFS"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                517,
                317,
                536
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/f8ab93ea171d8db7f9b0783a43696bb4c9cb2452fecc1e239c9161cf500f0358.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                152,
                590,
                509,
                687
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "ABC同时到达就绪队列 "
                    }
                ]
            },
            "bbox": [
                147,
                689,
                324,
                703
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "缺点：有些任务先到达到时间非常长，系统平均周转时间比较高"
                    }
                ]
            },
            "bbox": [
                146,
                706,
                645,
                722
            ]
        },
        {
            "type": "page_header",
            "content": {
                "page_header_content": [
                    {
                        "type": "text",
                        "content": "用户提交请求到首次相应的时间间隔"
                    }
                ]
            },
            "bbox": [
                147,
                93,
                433,
                109
            ]
        },
        {
            "type": "page_header",
            "content": {
                "page_header_content": [
                    {
                        "type": "text",
                        "content": "响应时间"
                    }
                ]
            },
            "bbox": [
                169,
                109,
                284,
                128
            ]
        },
        {
            "type": "page_header",
            "content": {
                "page_header_content": [
                    {
                        "type": "text",
                        "content": "九曲阑十"
                    }
                ]
            },
            "bbox": [
                601,
                107,
                697,
                129
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "短作业优先"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                99,
                268,
                120
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                151,
                159,
                519,
                177
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "先运行最短的任务，然后是次短的任务"
                    }
                ]
            },
            "bbox": [
                151,
                185,
                433,
                200
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "当所有任务同时到达时，最短任务优先是一个最优的调度算法"
                    }
                ]
            },
            "bbox": [
                151,
                209,
                596,
                223
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/e39c4f75d37dd96d70ad0deecfabaebf3d023a867caa5e3cbc7c07b307b131b1.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                237,
                426,
                315
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "平均周转时间："
                    }
                ]
            },
            "bbox": [
                445,
                249,
                569,
                265
            ]
        },
        {
            "type": "equation_interline",
            "content": {
                "math_content": "(1 0 + 2 0 + 1 2 0) / 3 = 5 0",
                "math_type": "latex",
                "image_source": {
                    "path": "images/5f79e38d7e0481df6e50df154f715e4a7c2b3831eb8b152ae5e67c78d96c8713.jpg"
                }
            },
            "bbox": [
                445,
                273,
                670,
                290
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "不会产生饥饿现象"
                    }
                ]
            },
            "bbox": [
                144,
                346,
                294,
                363
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "非抢占式"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                387,
                233,
                405
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "短作业优先 SJF"
                    }
                ]
            },
            "bbox": [
                144,
                426,
                265,
                442
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "假设A在t0时到达，需要运行100s，而B和C在t=10到达，各自需要运行10s"
                    }
                ]
            },
            "bbox": [
                196,
                469,
                788,
                487
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "平均周转时间：（100+（110-10）+（120-10)）/3=103.33s"
                    }
                ]
            },
            "bbox": [
                194,
                505,
                759,
                523
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/9169ebb547d183aac1d6d8de258eab88ceb6d687216a79368c914b0fd32c2026.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                198,
                542,
                492,
                631
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "抢占式"
                    }
                ],
                "level": 1
            },
            "bbox": [
                144,
                671,
                213,
                690
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "最短剩余时间优先算法SRTN"
                    }
                ]
            },
            "bbox": [
                144,
                730,
                369,
                745
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "需要比较该进程的下一次运行时间是否比当前运行进程剩余运行时间段，如果是，则抢占当前运行进程的 CPU"
                    }
                ]
            },
            "bbox": [
                144,
                747,
                847,
                782
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                161,
                96,
                635,
                114
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每当有新的任务到达时，会确定剩余任务和新任务中，谁的剩余时间最少"
                    }
                ]
            },
            "bbox": [
                166,
                118,
                635,
                135
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "然后调度该时间最少的任务"
                    }
                ]
            },
            "bbox": [
                166,
                142,
                344,
                156
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/4577daa70247aa1c13c98c266c25715da67b24070d3d029ef249a770e98cd73c.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                171,
                166,
                416,
                247
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "平均周转时间："
                    }
                ]
            },
            "bbox": [
                436,
                186,
                542,
                200
            ]
        },
        {
            "type": "equation_interline",
            "content": {
                "math_content": "(1 0 + 2 0 + 1 2 0) / 3 = 5 0",
                "math_type": "latex",
                "image_source": {
                    "path": "images/ec49e46448358f6b62c0ecaf568ab77145951a516dcd4bb3e64222b0a73f4655.jpg"
                }
            },
            "bbox": [
                433,
                210,
                633,
                222
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "产生饥饿现象"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                260,
                258,
                275
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "高响应比优先调度算法"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                302,
                388,
                323
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "等待时间和执行时间两个因素"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                362,
                381,
                378
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "高响应比优先调度算法"
                    }
                ],
                "level": 1
            },
            "bbox": [
                183,
                385,
                410,
                403
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/55fac5c9d3c374e0c25098f27aebcbb299e388c0cf6eef627044ba6b96a5e3f8.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                448,
                380,
                490,
                395
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "九曲阑干"
                    }
                ],
                "level": 1
            },
            "bbox": [
                588,
                382,
                680,
                406
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                189,
                419,
                529,
                437
            ]
        },
        {
            "type": "equation_interline",
            "content": {
                "math_content": "\\text {响 应 比 (R)} = \\frac {\\text {等 待 时 间} + \\text {执 行 时 间}}{\\text {执 行 时 间}}",
                "math_type": "latex",
                "image_source": {
                    "path": "images/ebdad0aff34681b6edb972702f2eba059f13c22b82c92cef67befc924fb5216c.jpg"
                }
            },
            "bbox": [
                242,
                449,
                547,
                486
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "·当执行时间相同时，等待时间越长，响应比越高"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                191,
                500,
                564,
                539
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                191,
                552,
                616,
                567
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/1910558a13c24221a05785295d0530972ce1556d568eaca15951b304b224457c.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td>算法</td><td>思想&amp;规则</td><td>可抢占?</td><td>优点</td><td>缺点</td><td>考虑到等待时间&amp;运行时间?</td><td>会导致饥饿?</td></tr><tr><td>FCFS</td><td>自己回忆</td><td>非抢占式</td><td>公平；实现简单</td><td>对短作业不利</td><td>等待时间√运行时间×</td><td>不会</td></tr><tr><td>SJF/SPF</td><td>自己回忆</td><td>默认为非抢占式，也有SJF的抢占式版本最短剩余时间优先算法（SRTN）</td><td>“最短的”平均等待/周转时间；</td><td>对长作业不利，可能导致饥饿；难以做到真正的短作业优先</td><td>等待时间×运行时间√</td><td>会</td></tr><tr><td>HRRN</td><td>自己回忆</td><td>非抢占式</td><td>上述两种算法的权衡折中，综合考虑的等待时间和运行时间</td><td></td><td>等待时间√运行时间√</td><td>不会</td></tr></table>",
                "table_type": "simple_table",
                "table_nest_level": 1
            },
            "bbox": [
                171,
                620,
                705,
                737
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "优先级调度算法"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                770,
                275,
                785
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "抢占式、非抢占都有"
                    }
                ]
            },
            "bbox": [
                146,
                789,
                309,
                804
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "非抢占式，每次调度时选择当前已到达且优先级最高的进程，当前进程主动放弃处理机时发生调度"
                    }
                ]
            },
            "bbox": [
                144,
                807,
                845,
                840
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "抢占式还需在就绪队列变化时，检查是否发生抢占 "
                    }
                ]
            },
            "bbox": [
                146,
                844,
                537,
                860
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "P2先到达，先上处理机"
                    }
                ]
            },
            "bbox": [
                146,
                881,
                332,
                897
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "确定优先级？"
                    }
                ]
            },
            "bbox": [
                147,
                93,
                250,
                108
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "系统进程优先级高于用户进程"
                    }
                ]
            },
            "bbox": [
                147,
                112,
                381,
                127
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "前台进程优先级高于后台进程"
                    }
                ]
            },
            "bbox": [
                147,
                130,
                381,
                145
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "操作系统更偏好I/O型进程"
                    }
                ]
            },
            "bbox": [
                147,
                148,
                359,
                164
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "与 I/O 型进程相对的时计算型进程（CPU）"
                    }
                ]
            },
            "bbox": [
                147,
                167,
                463,
                183
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "动态提升？"
                    }
                ]
            },
            "bbox": [
                147,
                186,
                231,
                200
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "线程I/O操作结束提升优先级"
                    }
                ]
            },
            "bbox": [
                147,
                204,
                374,
                219
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "在就绪队列中随等待时间延长而提升"
                    }
                ]
            },
            "bbox": [
                147,
                223,
                431,
                237
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "随占用CPU时间延长而降低"
                    }
                ]
            },
            "bbox": [
                147,
                241,
                364,
                256
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "随剩余运行时间缩短而提升"
                    }
                ]
            },
            "bbox": [
                147,
                260,
                361,
                275
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "完成I/O操作后提升"
                    }
                ]
            },
            "bbox": [
                147,
                279,
                302,
                294
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "时间片调度（轮转调度RR）"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                334,
                357,
                350
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                147,
                355,
                447,
                370
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每个进程被分配一个时间段，称为时间片 允许进程在该时间段内执行如果在时间片内结束时，该进程没有执行完，接下来会将CPU分配另外"
                    }
                ]
            },
            "bbox": [
                147,
                375,
                647,
                414
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                147,
                423,
                216,
                437
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/62431af8f3619f49eca687eb1384b6858e5f9a6a66a7795b46b1fdf188728667.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                161,
                445,
                374,
                508
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/eb8d6b9e8bfa6448fb6f192be2e024294f775659de2b2b918d8bd7b0a8dc54f5.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                415,
                444,
                630,
                508
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "刻就绪队列中的进程、进程的剩余运行时间）"
                    }
                ]
            },
            "bbox": [
                149,
                561,
                552,
                596
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/6422c90657fb0b5f824af42a30fb896178f038a2625d23deff101daaef9661ab.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                601,
                550,
                867,
                598
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "0时刻（P1（5））：0时刻只有P1到达就绪队列，让P1上处理机运行一个时间片"
                    }
                ]
            },
            "bbox": [
                149,
                604,
                798,
                621
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "2时刻（P2（4）→P1（3））：2时刻P2到达就绪队列，P1运行完一个时间片，被剥夺处理机，重新放到此时P2排在队头，因此让P2上处理机。（注意：2时刻，P1下处理机，同一时刻新进程P2到达，如题目中遇到这种情况，默认新到达的进程先进入就绪队列）"
                    }
                ]
            },
            "bbox": [
                149,
                623,
                998,
                673
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "7时刻（P2（2)→P4（6）→P1（1））：虽然P3的时间片没用完，但是由于P3只需运行1个单位的时间，完了会主动放弃处理机，因此也会发生调度。队头进程P2上处理机。"
                    }
                ]
            },
            "bbox": [
                147,
                720,
                998,
                755
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如果每个进程都在一个时间片内完成，则轮转算法退化为FCFS算法如何确定时间片的长度？"
                    }
                ]
            },
            "bbox": [
                144,
                778,
                668,
                813
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1、系统响应时间"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2、就绪进程的数量"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "3、进程调度以及上下文切换的时间开销"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "4、CPU指令的速度"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                147,
                816,
                463,
                887
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "多级队列调度"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                99,
                294,
                120
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/4dee2ffc70f1763025c5332eac4f88e12fb826926ad7caafb3972d85b8da3cbd.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                171,
                663,
                372
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "多级反馈队列调度"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                407,
                339,
                426
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/5feb8df8efe4e3b81a322d1ceff0baee9d767c6c1ecec1554a5c1499b4eefbbd.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                462,
                522,
                594
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "优先级从高到低，时间片从小到大"
                    }
                ]
            },
            "bbox": [
                146,
                615,
                418,
                632
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "各队列之间采用抢占式优先级算法调度"
                    }
                ]
            },
            "bbox": [
                144,
                653,
                452,
                668
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "当CPU正在运行第i个队列中的某个进程时，又有进程而进入优先级较高的队列，则系统立即调度高优先级的进程进行"
                    }
                ]
            },
            "bbox": [
                144,
                671,
                847,
                706
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/b2aa995952420c614aad187ef45f2e14ace53b95b1c6681320e9410efc78c2c0.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td>算法</td><td>思想&amp;规则</td><td>可抢占?</td><td>优点</td><td>缺点</td><td>会导致饥饿?</td><td>补充</td></tr><tr><td>时间片轮转</td><td></td><td>抢占式</td><td>公平,适用于分时系统</td><td>频繁切换有开销,不区分优先级</td><td>不会</td><td>时间片太大或太小有何影响?</td></tr><tr><td>优先级调度</td><td></td><td>有抢占式的,也有非抢占式的。注意做题时的区别</td><td>区分优先级,适用于实时系统</td><td>可能导致饥饿</td><td>会</td><td>动态/静态优先级。各类型进程如何设置优先级?如何调整优先级?</td></tr><tr><td>多级反馈队列</td><td>较复杂,注意理解</td><td>抢占式</td><td>平衡优秀666</td><td>一般不说它有缺点,不过可能导致饥饿</td><td>会</td><td></td></tr></table>",
                "table_type": "simple_table",
                "table_nest_level": 1
            },
            "bbox": [
                166,
                722,
                778,
                858
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "多处理器调度"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                99,
                294,
                120
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "除了调度算法决定让哪个进程上 CPU，还要确定上哪个 CPU"
                    }
                ]
            },
            "bbox": [
                144,
                179,
                606,
                193
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "负载均衡 "
                    }
                ]
            },
            "bbox": [
                147,
                198,
                221,
                212
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "处理机亲和性"
                    }
                ]
            },
            "bbox": [
                147,
                217,
                255,
                231
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "XPU数据共享"
                    }
                ]
            },
            "bbox": [
                147,
                236,
                255,
                250
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "缓存一致性"
                    }
                ]
            },
            "bbox": [
                147,
                254,
                238,
                268
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "1、公共就绪队列"
                    }
                ]
            },
            "bbox": [
                147,
                272,
                284,
                287
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "线程"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                312,
                205,
                332
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "·许多应用中，存在许多同时发生的多种活动"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "·线程比进程更轻量级，所以比进程更容易创建，也更容易撤销 "
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "·如果多个线程是计算密集型，那么并不能获得性能上的增加。"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                149,
                373,
                684,
                462
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如果是计算和I0的处理，那么多线程允许这些操作重叠执行。"
                    }
                ]
            },
            "bbox": [
                161,
                470,
                672,
                488
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "轻量级：不需要保存那么多信息"
                    }
                ]
            },
            "bbox": [
                144,
                508,
                396,
                523
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "因为 CPU 只有一个，多个线程还是会竞争 CPU"
                    }
                ]
            },
            "bbox": [
                144,
                527,
                502,
                541
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如果是计算和IO的处理，那么多线程允许这些操作的重叠执行。会提升性能。"
                    }
                ]
            },
            "bbox": [
                144,
                545,
                744,
                560
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "多线程 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\neq"
                    },
                    {
                        "type": "text",
                        "content": "并行"
                    }
                ]
            },
            "bbox": [
                147,
                563,
                257,
                577
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "提高系统的并发程度，同一个进程中两个线程"
                    }
                ]
            },
            "bbox": [
                144,
                582,
                505,
                596
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "线程作为调度和执行到基本单位，把进程作为资源分配和拥有的基本单位"
                    }
                ]
            },
            "bbox": [
                144,
                601,
                714,
                615
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [],
                "level": 1
            },
            "bbox": [
                161,
                634,
                218,
                655
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/66c5c3be6c24cba96a9a16b001da7f181216bcb311934d35b5fbdb09640ac448.jpg"
                },
                "image_caption": [
                    {
                        "type": "text",
                        "content": "a) "
                    }
                ],
                "image_footnote": []
            },
            "bbox": [
                208,
                667,
                423,
                770
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/01bd4101e2902c635f685d0a38604ce5351e06f101bff927347995a1f1ef9950.jpg"
                },
                "image_caption": [
                    {
                        "type": "text",
                        "content": "b) "
                    },
                    {
                        "type": "text",
                        "content": "图2-11a)三个进程，每个进程有一个线程；b)"
                    }
                ],
                "image_footnote": []
            },
            "bbox": [
                438,
                670,
                589,
                770
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "一个进程带三个线程"
                    }
                ]
            },
            "bbox": [
                317,
                820,
                478,
                835
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [],
                "level": 1
            },
            "bbox": [
                181,
                105,
                243,
                129
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "九曲闲干"
                    }
                ],
                "level": 1
            },
            "bbox": [
                611,
                105,
                709,
                129
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每个进程中的内容"
                    }
                ]
            },
            "bbox": [
                203,
                167,
                331,
                181
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "地址空间"
                    }
                ]
            },
            "bbox": [
                205,
                181,
                267,
                191
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "全局变量"
                    }
                ]
            },
            "bbox": [
                205,
                192,
                267,
                203
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "打开文件"
                    }
                ]
            },
            "bbox": [
                205,
                204,
                267,
                215
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "子进程"
                    }
                ]
            },
            "bbox": [
                206,
                216,
                252,
                227
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "即将发生的报警"
                    }
                ]
            },
            "bbox": [
                206,
                228,
                314,
                239
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                206,
                240,
                344,
                250
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                205,
                252,
                268,
                263
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每个线程中的内容"
                    }
                ]
            },
            "bbox": [
                467,
                168,
                591,
                181
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "程序计数器"
                    }
                ]
            },
            "bbox": [
                467,
                181,
                544,
                192
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                467,
                193,
                514,
                204
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                467,
                205,
                499,
                215
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "状态 "
                    }
                ]
            },
            "bbox": [
                467,
                216,
                499,
                227
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "用户级线程"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                334,
                240,
                350
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "运行在用户态，由支撑线程一组应用程序代码完成， 该组代码称为线程库，运行在用户空间，"
                    }
                ]
            },
            "bbox": [
                144,
                370,
                845,
                405
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "操作系统并不知道线程的单位，仍以进程为单位"
                    }
                ]
            },
            "bbox": [
                146,
                407,
                522,
                423
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "很多编程语言提供了强大的线程库，可以实现线程的创建、销毁、调度等功能"
                    }
                ]
            },
            "bbox": [
                146,
                426,
                751,
                442
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "19. 线程的引入"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                445,
                265,
                460
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "‐将拥有资源的实体和执行的实体分开，使执行的实体具有较少的资源，从而减少并发执行的开销，从而提高系统的并发程度。"
                    }
                ]
            },
            "bbox": [
                146,
                464,
                794,
                497
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "‐ 拥有资源的基本单位——进程；"
                    }
                ]
            },
            "bbox": [
                147,
                501,
                398,
                516
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "‐执行的基本单位（即 CPU 调度和分派的单位)——线程。"
                    }
                ]
            },
            "bbox": [
                147,
                519,
                576,
                533
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "equation_inline",
                        "content": "\\blacktriangle"
                    },
                    {
                        "type": "text",
                        "content": "线程是进程内一个相对独立的运行单位，一个进程可以有一个或多个线程（至少有一个），这些线程共享这个进程的代码、数据及大部分管理信息，但每个线程有自己的程序计数器、堆栈和线程控制块。"
                    }
                ]
            },
            "bbox": [
                146,
                538,
                801,
                590
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "equation_inline",
                        "content": "\\blacktriangle"
                    },
                    {
                        "type": "text",
                        "content": "但对用户级线程而言，内核进行 CPU 调度仍然以进程（而不是用户级线程）为单位。"
                    }
                ]
            },
            "bbox": [
                146,
                594,
                789,
                627
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "内核级线程（KLT）"
                    }
                ]
            },
            "bbox": [
                147,
                630,
                287,
                646
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "组合方式"
                    }
                ]
            },
            "bbox": [
                147,
                649,
                221,
                664
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "线程表 TCB"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                692,
                270,
                711
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "左边是线程与进程共享的内容"
                    }
                ]
            },
            "bbox": [
                146,
                752,
                379,
                766
            ]
        }
    ],
    [
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/a6f22609666baedbe9a12d807b64ff08767f2ef517e7b362acca015d251dd511.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                203,
                99,
                477,
                231
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "线程包的实现 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                260,
                258,
                275
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "1、 用户进程管理"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                279,
                289,
                294
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "先放置在用户空间中，内核的角度按正常的方式管理，即单线程进程"
                    }
                ]
            },
            "bbox": [
                176,
                296,
                712,
                313
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "2、 内核管理线程"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                316,
                289,
                331
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "但是内核开销较大"
                    }
                ]
            },
            "bbox": [
                176,
                334,
                322,
                349
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "3、 混合"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                353,
                216,
                368
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/95d95e1016cd7a2a7d37e11fbb97c4d366254424b5a3c272c5bb436192a5d75e.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                201,
                387,
                569,
                615
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/114afbc6a543b8e10757ad564b99d42ff34009a6c9001672e3680b66af5e4992.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                574,
                388,
                806,
                604
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/94c5652d51cb1031475bc3426cb8dee1b4a4a854e3763e4fce776b3cfa99eb8c.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                218,
                632,
                768,
                869
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "同步和异步"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                99,
                285,
                122
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "临界资源"
                    }
                ],
                "level": 1
            },
            "bbox": [
                144,
                166,
                221,
                180
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "系统中某些资源一次只允许一个进程使用。这类自愿成为临界资源"
                    }
                ]
            },
            "bbox": [
                144,
                184,
                662,
                198
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如物理设备打印机、软件资源共享变量、文件、表格等"
                    }
                ]
            },
            "bbox": [
                144,
                203,
                574,
                217
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "必须以互斥的方式共享"
                    }
                ]
            },
            "bbox": [
                144,
                221,
                327,
                235
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每个进程中访问临界资源的那段代码叫做临界区 "
                    }
                ]
            },
            "bbox": [
                144,
                239,
                522,
                254
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每个进程在进入临界区之前应该先对欲访问的临界资源进行检查，看它是否正被其他进程访问，如果临界资源未被其它进程访问，则该进程便可进入临界区访问该临界资源，并把临界源的状态设置为“忙”；"
                    }
                ]
            },
            "bbox": [
                144,
                258,
                847,
                310
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "通常把这段置于临界区之前的用于检查临界资源使用状态的代码称为进入区，相应地，当进程访问完临界资源退出临界区时，将临界资源状态恢复为“空闲”。完成该项工作的代码称为“退出区”。其余无关的称为“剩余区”"
                    }
                ]
            },
            "bbox": [
                144,
                313,
                847,
                365
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "对临界资源的互斥访问，可以在逻辑上分为如下四个部分："
                    }
                ]
            },
            "bbox": [
                221,
                367,
                642,
                381
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/f4e76ceaffff199e788176f40c1c2597f7e2f9ecbfb8b866a887205b150b4a70.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                228,
                391,
                858,
                533
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                221,
                544,
                265,
                557
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "临界区是进程中访问临界资源的代码段。"
                    }
                ]
            },
            "bbox": [
                221,
                558,
                512,
                571
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进入区和退出区是负责实现互斥的代码段。"
                    }
                ]
            },
            "bbox": [
                221,
                571,
                529,
                586
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "互斥 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                611,
                186,
                625
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "互斥共享 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                629,
                221,
                644
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "称之为临界资源。必须以互斥的方式访问"
                    }
                ]
            },
            "bbox": [
                144,
                646,
                468,
                662
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "同时共享"
                    }
                ]
            },
            "bbox": [
                146,
                665,
                221,
                681
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "同步"
                    }
                ]
            },
            "bbox": [
                146,
                684,
                186,
                699
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "直接制约关系，某些位置上协调，相互合作的进程按一定的先后顺序"
                    }
                ]
            },
            "bbox": [
                144,
                702,
                680,
                717
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "进程的制约关系"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                721,
                275,
                736
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "直接制约：源于进程合作"
                    }
                ]
            },
            "bbox": [
                146,
                740,
                347,
                755
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "间接制约：源于资源共享 "
                    }
                ]
            },
            "bbox": [
                146,
                758,
                346,
                772
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "10. 同步"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                777,
                213,
                791
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "为了保证进程正确的并发执行，对多个相关进程在执行的次序上进行协调的过程。"
                    }
                ]
            },
            "bbox": [
                144,
                795,
                774,
                810
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "竞争条件"
                    }
                ]
            },
            "bbox": [
                146,
                814,
                221,
                829
            ]
        }
    ],
    [
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/a4e9f88460c29e79fcb947f62ef003b71da4d7a686a86159a2a52f8b0cefe3c0.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                152,
                87,
                757,
                293
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Out：打印机即将要打印的位置"
                    }
                ]
            },
            "bbox": [
                144,
                297,
                389,
                311
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "In：打印机需要把文件送入的位置"
                    }
                ]
            },
            "bbox": [
                144,
                316,
                411,
                331
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程 A，进程 B 几乎在同一时刻向打印机发送文件"
                    }
                ]
            },
            "bbox": [
                144,
                334,
                534,
                349
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程 A 还没有完，时间片用完，切换进程 B，此时 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\mathsf { i n } { } = 7"
                    },
                    {
                        "type": "text",
                        "content": "是空的，覆盖了。"
                    }
                ]
            },
            "bbox": [
                144,
                351,
                702,
                368
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "临界区："
                    }
                ]
            },
            "bbox": [
                146,
                370,
                211,
                386
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "对共享内存进行访问的程序片段称为临界区。"
                    }
                ]
            },
            "bbox": [
                144,
                388,
                492,
                405
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每个进程中访问临界资源的那段代码为临界区。"
                    }
                ]
            },
            "bbox": [
                144,
                407,
                510,
                423
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "临界资源：系统中某些资源一次只允许一个进程使用，多个进程共享临界资源时，必须互斥方式共享。"
                    }
                ]
            },
            "bbox": [
                144,
                426,
                847,
                460
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "临界区：访问临界资源的那段代码 "
                    }
                ]
            },
            "bbox": [
                146,
                464,
                415,
                478
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/b8faed76a486b5f850ab000b7c0c110cc6e1c1bdfb0689345b183b0fa385177e.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                483,
                739,
                712
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "同步机制满足原则："
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                99,
                349,
                120
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "算法 "
                    }
                ]
            },
            "bbox": [
                181,
                155,
                633,
                198
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1.任何两个进程不能同时处于其临界区"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2.不应对CPU的速度和数量做任何假设"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "3.临界区外运行的进程不得阻塞其他进程"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "4.不得使进程无限期等待进入临界区 "
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                194,
                204,
                505,
                290
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1、 空闲让进，临界区空闲时，允许一个请求进入临界区的进程立即进入临界区"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2、忙则等待，当已有进程接入临界区，其它试图进入临界区的进程必须等待 "
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "3、有限等待，对请求访问的进程，应保证能在有限时间内进入临界区（保证不会饥饿）"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "4、 让权等待，当进程不能进入临界区，应立即释放 CPU"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                144,
                326,
                821,
                399
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Peterson 算法"
                    }
                ]
            },
            "bbox": [
                147,
                401,
                253,
                417
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Falserx "
                    }
                ]
            },
            "bbox": [
                665,
                414,
                863,
                445
            ]
        },
        {
            "type": "code",
            "content": {
                "code_caption": [],
                "code_content": [
                    {
                        "type": "text",
                        "content": "define FALSE 0\n#define TRUE 1\n#define N 2\nint turn;\nint interested[N];\nvoid enter_region(int process);\n{\n    int other;\n    other = 1 - process; //其他进程号 */\n    interested[process] = TRUE; /*另一方进程*/\n    turn = process; /*表明所感兴趣的*/\n    while (turn == process && interested[other] == TRUE); /*空语句 */\n}\nvoid leave_region(int process)\n{\n    interested[process] = FALSE; /*表示离开临界区*/\n} "
                    }
                ],
                "code_language": "txt"
            },
            "bbox": [
                146,
                441,
                868,
                760
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "硬件方式"
                    }
                ],
                "level": 1
            },
            "bbox": [
                144,
                796,
                247,
                816
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "均存在让权等待"
                    }
                ]
            },
            "bbox": [
                146,
                856,
                275,
                873
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "禁止中断 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                99,
                247,
                120
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "利用专用机器指令"
                    }
                ],
                "level": 1
            },
            "bbox": [
                144,
                203,
                339,
                223
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "解决 Swap 指令/XCHG 指令/TSL 指令"
                    }
                ]
            },
            "bbox": [
                144,
                263,
                423,
                279
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "执行的过程不允许中断，利用硬件的方式变成了原子操作"
                    }
                ]
            },
            "bbox": [
                144,
                282,
                594,
                297
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "ISL指令定用硬件实现的，执行的过程不元计被中断，只能一气呵成。以下定用请言拥还的"
                    }
                ]
            },
            "bbox": [
                206,
                296,
                1000,
                307
            ]
        },
        {
            "type": "code",
            "content": {
                "code_caption": [],
                "code_content": [
                    {
                        "type": "text",
                        "content": "//布尔型共享变量lock表示当前临界区是否被加锁  \n//true表示已加锁，false表示未加锁  \nboolTestAndSet（bool\\*lock）{  \n    bool old;  \n    old = \\*lock; //old用来存放lock原来的值  \n    \\*lock = true; //无论之前是否已加锁，都将lock设为true  \n    return old; //返回lock原来的值  \n} "
                    }
                ],
                "code_language": "txt"
            },
            "bbox": [
                188,
                330,
                660,
                460
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "while（TestAndSet（&lock)）：//临界区代码段...lock "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\equiv"
                    },
                    {
                        "type": "text",
                        "content": "false;剩余区代码段"
                    }
                ]
            },
            "bbox": [
                678,
                329,
                1000,
                416
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                166,
                469,
                403,
                483
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                163,
                492,
                265,
                507
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                435,
                491,
                536,
                507
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/87681a05f95e006a4d625ee7c2df8e24a60b08c0de5eb25f2b588075839ac78c.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                164,
                518,
                361,
                619
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/281038ce915aa6b108c92548eb1a89cc69b9dc913c7823c80f2fa3e7b1e6beec.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                433,
                563,
                626,
                619
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                169,
                637,
                672,
                653
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/694a058f4e9470e497633f0d5ada2707aa889b5ad8c6f505d3af48508ad75066.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                171,
                653,
                662,
                816
            ]
        }
    ],
    [
        {
            "type": "code",
            "content": {
                "code_caption": [],
                "code_content": [
                    {
                        "type": "text",
                        "content": "enter_region:  \n→TSL REGISTER,LOCK  \nCMP REGISTER,#0  \nJNE enter_region  \nRET "
                    }
                ],
                "code_language": "asm"
            },
            "bbox": [
                169,
                133,
                352,
                192
            ]
        },
        {
            "type": "code",
            "content": {
                "code_caption": [],
                "code_content": [
                    {
                        "type": "text",
                        "content": "复制锁到寄存器并将锁设为1  \n锁是零吗？  \n若不是零，说明锁已被设置，返回调用者，进入了临界区"
                    }
                ],
                "code_language": "txt"
            },
            "bbox": [
                445,
                143,
                655,
                195
            ]
        },
        {
            "type": "code",
            "content": {
                "code_caption": [],
                "code_content": [
                    {
                        "type": "text",
                        "content": "leave_region:  \nMOVE LOCK,#0  \nRET "
                    }
                ],
                "code_language": "asm"
            },
            "bbox": [
                169,
                215,
                310,
                250
            ]
        },
        {
            "type": "code",
            "content": {
                "code_caption": [],
                "code_content": [
                    {
                        "type": "text",
                        "content": "在锁中存入0返回调用者"
                    }
                ],
                "code_language": "txt"
            },
            "bbox": [
                445,
                227,
                549,
                254
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "利用软件"
                    }
                ],
                "level": 1
            },
            "bbox": [
                144,
                303,
                245,
                322
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "单标志、双标志先检查、双标志后检查"
                    }
                ]
            },
            "bbox": [
                144,
                362,
                450,
                378
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进入区的检查、上锁操作无法一气呵成——锁"
                    }
                ]
            },
            "bbox": [
                144,
                381,
                502,
                397
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Peterson 算法"
                    }
                ]
            },
            "bbox": [
                144,
                418,
                253,
                432
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "有while循环，未遵循让权等待"
                    }
                ]
            },
            "bbox": [
                144,
                437,
                389,
                451
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "信号量机制"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                479,
                267,
                499
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "锁：mutexlock "
                    }
                ]
            },
            "bbox": [
                144,
                558,
                260,
                573
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "只有 true 和 false 两种表示锁是否可用"
                    }
                ]
            },
            "bbox": [
                144,
                577,
                438,
                592
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Aacquire 获得锁。Release 释放锁 "
                    }
                ]
            },
            "bbox": [
                144,
                596,
                400,
                609
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每个互斥锁都有一个布尔变量"
                    }
                ]
            },
            "bbox": [
                144,
                614,
                379,
                629
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                183,
                638,
                226,
                645
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "解决临界区最简单的工具就是互斥锁（mutexlock）。一个进程在进入临界区时应获得锁：在退出临界区时释放锁。函数acquire()获得锁，而函数release()释放锁。"
                    }
                ]
            },
            "bbox": [
                161,
                646,
                569,
                665
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每个互斥锁有一个布尔变量available，表示锁是否可用。如果锁是可用的，调用acqiureO会成功，且债不再可用。当一个进程试图获取不可用的锁时，会被阻塞，直到锁被释放。"
                    }
                ]
            },
            "bbox": [
                161,
                665,
                571,
                682
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/ac94d63523539f14089eca183a6745f7b8f87b74402243a75aecfa5ca4374061.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                163,
                682,
                574,
                747
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "acquire(或release()的执行必须是原子操作，因此互斥锁通常采用硬件机制来实现。"
                    }
                ]
            },
            "bbox": [
                181,
                749,
                532,
                757
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "互斥锁的主要缺点是忙等待，当有一个进程在临界区中，任何其他进程在进入临界区时必须连续循环调用acquireO。当多个进程共享同一CPU时，就浪费了CPU周期。因此，互斥锁通常用于多处理器系统，一个线程可以在一个处理器上等待，不影响其他线程的执行。"
                    }
                ]
            },
            "bbox": [
                161,
                758,
                573,
                784
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                164,
                791,
                583,
                800
            ]
        },
        {
            "type": "page_header",
            "content": {
                "page_header_content": []
            },
            "bbox": [
                146,
                87,
                470,
                110
            ]
        }
    ],
    [
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/5580701b62818b3ca43b08c6498c322a3feee1bd9b68d63379bc49533c31e99a.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                181,
                93,
                707,
                195
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "信号量"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                223,
                205,
                237
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "P/down()wait（S）"
                    }
                ]
            },
            "bbox": [
                176,
                241,
                310,
                256
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "V/up()signal（S）"
                    }
                ]
            },
            "bbox": [
                176,
                260,
                300,
                275
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                357,
                274,
                482,
                282
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [],
                "level": 1
            },
            "bbox": [
                193,
                282,
                403,
                303
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "加曲阑干"
                    }
                ],
                "level": 1
            },
            "bbox": [
                541,
                282,
                623,
                303
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Dijkstra提出了一个方法，用一个整型变量来记录唤醒次数，称作信号量"
                    }
                ]
            },
            "bbox": [
                194,
                312,
                593,
                340
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "两种操作：分别为P操作和V操作，Proberen尝试，Verhogen(增加)"
                    }
                ]
            },
            "bbox": [
                196,
                350,
                626,
                363
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "P：检查信号量的值是否大于0，若值大于0，则将其值减去1并继续 如果该值为0，则进程睡眠 "
                    }
                ]
            },
            "bbox": [
                196,
                376,
                628,
                407
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "V：对信号量的值加1。 "
                    }
                ]
            },
            "bbox": [
                194,
                426,
                339,
                439
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "原子操作：不可分割的操作"
                    }
                ],
                "level": 1
            },
            "bbox": [
                176,
                519,
                394,
                533
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/ac352c5fd48e5ded570560bb7a1eb92dcd41a6dbc52637ae8a949b1faaf2ada8.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                156,
                536,
                490,
                636
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "原语是一种特殊的程序段，不可被中断"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                686,
                453,
                702
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [],
                "level": 1
            },
            "bbox": [
                184,
                759,
                273,
                778
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "加曲闲干"
                    }
                ],
                "level": 1
            },
            "bbox": [
                556,
                757,
                643,
                778
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如何实现不可分割的PV操作？"
                    }
                ]
            },
            "bbox": [
                184,
                791,
                384,
                804
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                484,
                780,
                653,
                829
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "通常将P操作和V操作作为系统调用实现。"
                    }
                ]
            },
            "bbox": [
                183,
                818,
                460,
                834
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "具体操作：测试信号量、更新信号量以及需要时使某个进程睡眠"
                    }
                ]
            },
            "bbox": [
                181,
                845,
                630,
                860
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "对于单个CPU可以通过屏蔽中断，多个CPU可以通过TSL或Swap指令"
                    }
                ]
            },
            "bbox": [
                183,
                872,
                633,
                888
            ]
        }
    ],
    [
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1.分析并发进程的关键活动，划定临界区（如：对临界资源打印机的访问就应放在临界区）"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2.设置互斥信号量mutex，初值为1 "
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                208,
                110,
                675,
                131
            ]
        },
        {
            "type": "algorithm",
            "content": {
                "algorithm_caption": [],
                "algorithm_content": [
                    {
                        "type": "text",
                        "content": "/*信号量机制实现互斥*/\nsemaphore mutex  "
                    },
                    {
                        "type": "equation_inline",
                        "content": "= 1"
                    },
                    {
                        "type": "text",
                        "content": " ；//初始化信号量\nP1({ "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\begin{array}{l}\\cdots\\\\ \\mathrm{P}(\\mathrm{mutex});\\quad \\mathrm{//~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{\\sim}\\\\ \\mathrm{V}(\\mathrm{mutex});\\quad \\mathrm{//~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\mathrm{~}\\end{array}"
                    },
                    {
                        "type": "text",
                        "content": " 临界区代码段...}\n\t\t "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\cdots"
                    },
                    {
                        "type": "text",
                        "content": " }"
                    }
                ]
            },
            "bbox": [
                500,
                126,
                680,
                296
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "理：售号量mutex表示“进入临界"
                    }
                ],
                "level": 1
            },
            "bbox": [
                216,
                328,
                363,
                353
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [],
                "level": 1
            },
            "bbox": [
                384,
                328,
                593,
                343
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                616,
                317,
                722,
                326
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "int value; "
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "semaphore; "
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                616,
                326,
                726,
                363
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                736,
                337,
                794,
                344
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                736,
                346,
                786,
                354
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1.分析并发进程的关键活动，划定临界区（如：对临界资源打印机的访问就应放在临界区）"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2.设置互斥信号量mutex，初值为1 "
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "3.在进入区P（mutex）--申请资源"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "4.在退出区V（mutex)--释放资源"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                223,
                363,
                744,
                407
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "注意：对不同的临界资源需要设置不同的互斥信号量。"
                    }
                ]
            },
            "bbox": [
                181,
                414,
                378,
                437
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "P、V操作必须成对出现。缺少 "
                    }
                ]
            },
            "bbox": [
                181,
                437,
                379,
                449
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "P(mutex）就不能保证临界资源的互 "
                    }
                ]
            },
            "bbox": [
                181,
                449,
                379,
                460
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "斥访问。缺少V（mutex）会导致资源"
                    }
                ]
            },
            "bbox": [
                181,
                460,
                383,
                470
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "永不被释放，等待进程永不被唤醒。"
                    }
                ]
            },
            "bbox": [
                181,
                470,
                383,
                481
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "要会自己定义记录型信号量，但如果题目中没特别说明，可以把信号量的声明简写成这种形式"
                    }
                ]
            },
            "bbox": [
                433,
                407,
                529,
                475
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                549,
                412,
                584,
                420
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "P（mutex）；"
                    }
                ]
            },
            "bbox": [
                561,
                429,
                616,
                441
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "临界区代码段... "
                    }
                ]
            },
            "bbox": [
                561,
                442,
                642,
                453
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "V（mutex）；"
                    }
                ]
            },
            "bbox": [
                561,
                454,
                616,
                463
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                653,
                432,
                779,
                442
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                653,
                443,
                779,
                453
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                653,
                454,
                779,
                464
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                549,
                470,
                581,
                483
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "P(mutex1) "
                    }
                ]
            },
            "bbox": [
                188,
                501,
                248,
                512
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "临界区"
                    }
                ]
            },
            "bbox": [
                194,
                514,
                236,
                526
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "（打印机）"
                    }
                ]
            },
            "bbox": [
                194,
                527,
                248,
                537
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "V(mutex1) "
                    }
                ]
            },
            "bbox": [
                193,
                539,
                248,
                549
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "P(mutex1) "
                    }
                ]
            },
            "bbox": [
                267,
                502,
                322,
                513
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "临界区"
                    }
                ]
            },
            "bbox": [
                270,
                514,
                315,
                526
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "（打印机）"
                    }
                ]
            },
            "bbox": [
                270,
                527,
                322,
                537
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "V(mutex1) "
                    }
                ]
            },
            "bbox": [
                270,
                539,
                322,
                549
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程"
                    }
                ]
            },
            "bbox": [
                223,
                563,
                240,
                574
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "P2进程"
                    }
                ]
            },
            "bbox": [
                273,
                563,
                315,
                574
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "P(mutex2) "
                    }
                ]
            },
            "bbox": [
                381,
                502,
                438,
                513
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "临界区"
                    }
                ]
            },
            "bbox": [
                383,
                514,
                426,
                525
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "（摄像头）"
                    }
                ]
            },
            "bbox": [
                383,
                526,
                438,
                536
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "V(mutex2) "
                    }
                ]
            },
            "bbox": [
                381,
                538,
                438,
                549
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "P(mutex2) "
                    }
                ]
            },
            "bbox": [
                455,
                502,
                510,
                513
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "临界区"
                    }
                ]
            },
            "bbox": [
                455,
                514,
                509,
                525
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "（摄像头）"
                    }
                ]
            },
            "bbox": [
                455,
                526,
                509,
                536
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "V(mutex2) "
                    }
                ]
            },
            "bbox": [
                455,
                538,
                510,
                549
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "P3进程"
                    }
                ]
            },
            "bbox": [
                389,
                564,
                430,
                574
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "P4进程"
                    }
                ]
            },
            "bbox": [
                462,
                564,
                504,
                574
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                549,
                495,
                583,
                506
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                561,
                510,
                616,
                521
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "P（mutex）; 临界区代码 "
                    }
                ]
            },
            "bbox": [
                561,
                523,
                616,
                533
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "V（mutex）："
                    }
                ]
            },
            "bbox": [
                561,
                536,
                616,
                546
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "1 "
                    }
                ]
            },
            "bbox": [
                549,
                551,
                581,
                568
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "信号量背后的含义，一个信号量对应一种资源"
                    }
                ]
            },
            "bbox": [
                176,
                593,
                536,
                609
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "用户可以通过操作系统提供的一对原语来对信号量进行操作"
                    }
                ]
            },
            "bbox": [
                176,
                612,
                640,
                627
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "信号量可以是整型、记录型、AND型、信号量集"
                    }
                ]
            },
            "bbox": [
                176,
                630,
                552,
                645
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "信号量的值 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\mathbf { \\lambda } = \\mathbf { \\lambda }"
                    },
                    {
                        "type": "text",
                        "content": "这种资源的剩余数量"
                    }
                ]
            },
            "bbox": [
                176,
                649,
                436,
                664
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "P(S)/down()/wait()——申请一个资源S，如果资源不够就阻塞等待"
                    }
                ]
            },
            "bbox": [
                176,
                668,
                677,
                683
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "V(S)/up()/signal——释放一个资源S，如果有进程在等待该资源则唤醒一个进程"
                    }
                ]
            },
            "bbox": [
                176,
                686,
                779,
                702
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "一对原语 wait(S)/signal(S)"
                    }
                ]
            },
            "bbox": [
                176,
                705,
                369,
                721
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "整形信号量：只有三种，初始化、P、V "
                    }
                ]
            },
            "bbox": [
                176,
                741,
                484,
                758
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "一个整数型的变量作为信号量，用来表示系统中某种资源的数量"
                    }
                ]
            },
            "bbox": [
                176,
                760,
                675,
                776
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "equation_inline",
                        "content": "\\textsf { S } = \\textsf { 1 }"
                    }
                ]
            },
            "bbox": [
                157,
                788,
                724,
                804
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                156,
                822,
                349,
                838
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "equation_inline",
                        "content": "S < = 8"
                    },
                    {
                        "type": "text",
                        "content": "）；"
                    }
                ]
            },
            "bbox": [
                176,
                840,
                329,
                860
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "S=S-1; "
                    }
                ]
            },
            "bbox": [
                176,
                860,
                238,
                872
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                376,
                822,
                618,
                838
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                376,
                840,
                648,
                854
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                376,
                858,
                631,
                872
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                157,
                875,
                169,
                889
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                156,
                908,
                638,
                925
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "S=S+1; "
                    }
                ]
            },
            "bbox": [
                176,
                927,
                238,
                940
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                305,
                927,
                579,
                940
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "1 "
                    }
                ]
            },
            "bbox": [
                157,
                944,
                169,
                953
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程P0："
                    }
                ]
            },
            "bbox": [
                225,
                170,
                295,
                186
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                231,
                193,
                263,
                202
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "wait(s) "
                    }
                ]
            },
            "bbox": [
                231,
                205,
                317,
                219
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                398,
                205,
                554,
                219
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "使用打印机资源..."
                    }
                ]
            },
            "bbox": [
                231,
                222,
                376,
                237
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                394,
                223,
                551,
                237
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                231,
                239,
                331,
                255
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                388,
                239,
                546,
                255
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                228,
                261,
                263,
                271
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "用原语实现了，“检查”和“上锁”解决了并发、异步的问题"
                    }
                ]
            },
            "bbox": [
                174,
                278,
                658,
                294
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Wait原语又不能被中断。难道CPU卡在哪里了？"
                    }
                ]
            },
            "bbox": [
                176,
                297,
                547,
                312
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "记录型信号量"
                    }
                ]
            },
            "bbox": [
                178,
                316,
                287,
                331
            ]
        },
        {
            "type": "code",
            "content": {
                "code_caption": [],
                "code_content": [
                    {
                        "type": "text",
                        "content": "/*记录型信号量的定义*/  \ntypedef struct {int value; //剩余资源数struct process \\*L; //等待队列}semaphore; "
                    }
                ],
                "code_language": "c"
            },
            "bbox": [
                198,
                331,
                445,
                394
            ]
        },
        {
            "type": "code",
            "content": {
                "code_caption": [],
                "code_content": [
                    {
                        "type": "text",
                        "content": "/*某进程需要使用资源时，通过wait原语申请*/  \nvoid wait(semaphore S){S.value--;if(S.value<0）{block(S.L);}如果剩余资源数不够，  \n1 使用block原语使进程从"
                    }
                ],
                "code_language": "txt"
            },
            "bbox": [
                198,
                411,
                485,
                494
            ]
        },
        {
            "type": "code",
            "content": {
                "code_caption": [],
                "code_content": [
                    {
                        "type": "text",
                        "content": "/*进程使用完资源后，通过signal 原语释放*/  \nvoid signal (semaphore S) {  \n    s.value++;  \n    if (s.value <= 0) {  \n        wakeup(S.L);  \n    }  \n}"
                    }
                ],
                "code_language": "javascript"
            },
            "bbox": [
                519,
                410,
                784,
                495
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                690,
                523,
                848,
                535
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "wait 原语"
                    }
                ]
            },
            "bbox": [
                144,
                575,
                221,
                590
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "某进程需要使用资源S"
                    }
                ]
            },
            "bbox": [
                144,
                594,
                322,
                608
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "S--表示请求分配一个资源"
                    }
                ]
            },
            "bbox": [
                144,
                612,
                347,
                627
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如果S值 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\geqslant 0"
                    },
                    {
                        "type": "text",
                        "content": "，则表示可以为进程分配资源，该进程进入临界区继续执行，"
                    }
                ]
            },
            "bbox": [
                144,
                630,
                710,
                646
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如果 S 的值 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "< 0"
                    },
                    {
                        "type": "text",
                        "content": "，表示-1 之前已没有资源可供分配（ "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\scriptstyle \\left( S = 0 \\right)"
                    },
                    {
                        "type": "text",
                        "content": "）"
                    }
                ]
            },
            "bbox": [
                144,
                649,
                579,
                665
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "执行block原语，将其进程阻塞起来，插入到S的阻塞队列中，然后执行另一进程"
                    }
                ]
            },
            "bbox": [
                144,
                668,
                776,
                683
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Signal "
                    }
                ]
            },
            "bbox": [
                146,
                687,
                194,
                701
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "equation_inline",
                        "content": "{ { \\sf S } } { + } { + }"
                    },
                    {
                        "type": "text",
                        "content": "表明释放一个资源"
                    }
                ]
            },
            "bbox": [
                144,
                705,
                319,
                720
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如果 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\mathsf { S } { \\mathsf { \\Sigma } } { > } 0"
                    },
                    {
                        "type": "text",
                        "content": "，则表示阻塞队列为空，该进程继续执行；；"
                    }
                ]
            },
            "bbox": [
                144,
                722,
                568,
                739
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如果S≤0，表示阻塞队列中有阻塞的进程，wakeup原语唤醒队首进程从阻塞状态变为就绪状态"
                    }
                ]
            },
            "bbox": [
                144,
                741,
                847,
                775
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "不管怎么说，先--或者 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "^ { + + }"
                    },
                    {
                        "type": "text",
                        "content": "，然后判断，决定阻塞or释放 "
                    }
                ]
            },
            "bbox": [
                144,
                778,
                573,
                794
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "equation_inline",
                        "content": "\\mathsf { S } { \\circ } 0"
                    },
                    {
                        "type": "text",
                        "content": "，其值表示当前可供分配的资源数目"
                    }
                ]
            },
            "bbox": [
                144,
                797,
                458,
                812
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "equation_inline",
                        "content": "\\mathsf { S } { < } 0"
                    },
                    {
                        "type": "text",
                        "content": "，其绝对值表示阻塞队列中的进程数目"
                    }
                ]
            },
            "bbox": [
                144,
                816,
                473,
                831
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "信号量集机制"
                    }
                ]
            },
            "bbox": [
                146,
                834,
                257,
                848
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "信号量机制实现进程互斥"
                    }
                ]
            },
            "bbox": [
                176,
                872,
                376,
                887
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如果题目没有特别说明，对于一个信号量的定义只需要 semaphore"
                    }
                ]
            },
            "bbox": [
                176,
                890,
                690,
                904
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "smaphore这个信号量不是整型信号量而是记录型信号量，带有排队阻塞的信号量，并不会忙等"
                    }
                ]
            },
            "bbox": [
                174,
                93,
                847,
                127
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "对于不同的临界资源需要设置不同的信号量"
                    }
                ]
            },
            "bbox": [
                176,
                130,
                517,
                145
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "利用信号量机制可以方便地解决多个进程互斥使用临界资源的问题"
                    }
                ]
            },
            "bbox": [
                176,
                148,
                694,
                164
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "生产者/操作 必须在谁之后执行 依赖的信号量"
                    }
                ],
                "level": 1
            },
            "bbox": [
                144,
                186,
                557,
                202
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "PB 读取 buf1 PA 写完 buf1 full1 "
                    }
                ]
            },
            "bbox": [
                146,
                206,
                482,
                221
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "PC 打印 buf2 PB 写完 buf2 full2"
                    }
                ]
            },
            "bbox": [
                146,
                227,
                482,
                241
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "PA 写 buf1 上一次 PB 读取完 buf1 empty1"
                    }
                ]
            },
            "bbox": [
                146,
                248,
                505,
                262
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "PB 写 buf2 上一次 PC 打印完 buf2 empty2"
                    }
                ]
            },
            "bbox": [
                146,
                268,
                505,
                282
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "信号量机制实现进程同步"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                328,
                371,
                346
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "要让各并发进程按要求有序地推进"
                    }
                ],
                "level": 1
            },
            "bbox": [
                176,
                367,
                445,
                382
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "设置同步信号量S，初始为0 "
                    }
                ]
            },
            "bbox": [
                176,
                387,
                400,
                401
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "用信号量实现进程同步："
                    }
                ]
            },
            "bbox": [
                216,
                406,
                371,
                418
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1.分析什么地方需要实现“同步关系”，即必须保证“一前一后”执行的两个操作（或两句代码）"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2.设置同步信号量S,初始为0 "
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "3.在“前操作”之后执行V（S）"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "4.在“后操作”之前执行P（S）"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                216,
                419,
                847,
                469
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                225,
                479,
                386,
                492
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "semaphoreS=0；//初始化同步信号量，初始值为0 "
                    }
                ]
            },
            "bbox": [
                226,
                495,
                568,
                508
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "理解：信号量s代表“某种资源”，刚开始是没有这种资源的。P2需要使用这种资源，而又只能由P1产生这种资源"
                    }
                ]
            },
            "bbox": [
                606,
                456,
                791,
                506
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/4c7d4a5999c000e46ad370c4569f8db42cbd65273afdf48dc2cddb1cb3c3b2be.jpg"
                },
                "image_caption": [
                    {
                        "type": "text",
                        "content": "保证了代码4一定是在代码2之后执行"
                    }
                ],
                "image_footnote": []
            },
            "bbox": [
                225,
                521,
                440,
                611
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "若先执行到V（S）操作，则 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "{ \\mathsf { S } } { \\mathsf { + } } { \\mathsf { + } }"
                    },
                    {
                        "type": "text",
                        "content": "后S=1。之后当执行到P(S）操作时，由于S=1，表示有可用资源，会执行S-，S的值变回0，P2进程不会执行block原语，而是继续往下执行代码4。"
                    }
                ]
            },
            "bbox": [
                467,
                519,
                862,
                557
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "若先执行到P(S)操作，由于S=O，S--后S=-1，表示此时没有可用资源，因此P操作中会执行block原语，主动请求阻塞。之后当执行完代码2，继而执行V(S)操作，S++，使S变回0，由于此时有进程在该信号量对应的阻塞队列中，因此会在V操作中执行wakeup原语，唤醒P2进程。这样P2就可以继续执行代码4了"
                    }
                ]
            },
            "bbox": [
                467,
                568,
                860,
                644
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "首先可以定义一个初值为1的信号量S（互斥信号量）"
                    }
                ]
            },
            "bbox": [
                176,
                683,
                586,
                697
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "当进程想要进入临界区访问临界资源时，wait（）操作申请资源"
                    }
                ]
            },
            "bbox": [
                176,
                701,
                670,
                715
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "退出临界区时执行signal操作（）释放资源"
                    }
                ]
            },
            "bbox": [
                176,
                719,
                512,
                734
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "只要把进程临界区置于 wait（）和 siganl()之间，就可以实现互斥"
                    }
                ]
            },
            "bbox": [
                176,
                738,
                675,
                753
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "该方案使用了三个信号量"
                    }
                ]
            },
            "bbox": [
                194,
                98,
                416,
                116
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1.一个称为fuI1，用来记录充满的缓冲区的数量"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2.一个称为empty，记录空的缓冲区数目"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "3.一个称为mutex，用来确保生产者和消费者不会同时访问缓冲区"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                194,
                121,
                763,
                183
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "#defineN100 "
                    }
                ]
            },
            "bbox": [
                203,
                197,
                290,
                209
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                465,
                195,
                608,
                206
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "typedef int semaphore; "
                    }
                ]
            },
            "bbox": [
                203,
                210,
                342,
                219
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                465,
                208,
                677,
                219
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "semaphoremutex "
                    },
                    {
                        "type": "equation_inline",
                        "content": "= 1"
                    }
                ]
            },
            "bbox": [
                203,
                221,
                339,
                230
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                465,
                219,
                621,
                230
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "semaphore empty=N; "
                    }
                ]
            },
            "bbox": [
                203,
                231,
                342,
                242
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                465,
                231,
                635,
                241
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "semaphore full=0; "
                    }
                ]
            },
            "bbox": [
                203,
                243,
                322,
                254
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                465,
                241,
                635,
                250
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "为什么 empty 和 full 也要设为信号量？"
                    }
                ]
            },
            "bbox": [
                176,
                278,
                467,
                294
            ]
        },
        {
            "type": "algorithm",
            "content": {
                "algorithm_caption": [],
                "algorithm_content": [
                    {
                        "type": "text",
                        "content": "void producer(void)   \n{ int item; while (TRUE){ /\\*TRUE是常量1\\*/ item  "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\equiv"
                    },
                    {
                        "type": "text",
                        "content": " produce_item(); /\\*产生放在缓冲区中的一些数据\\*/ down(&empty); /\\*将空槽数目减1\\*/ 0  "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\rightarrow"
                    },
                    {
                        "type": "text",
                        "content": " down(&mutex); /\\*进入临界区\\*/ insert_item(item); /\\*将新数据项放到缓冲区中\\*/ up(&mutex);  "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\rightarrow"
                    },
                    {
                        "type": "text",
                        "content": " V(mutex); /\\*离开临界区\\*/ up(&full); /\\*将满槽的数目加1\\*/ }   \nvoid consumer(void) full>0 full-1 int item; while (TRUE){ /\\*无限循环\\*/ down(&full); /\\*将满槽数目减1\\*/ down(&mutex); /\\*进入临界区\\*/ item  "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\equiv"
                    },
                    {
                        "type": "text",
                        "content": " remove_item(); /\\*从缓冲区中取出数据项\\*/ up(&mutex); /\\*离开临界区\\*/ up(&empty); /\\*将空槽数目加1\\*/ consume_item(item); /\\*处理数据项\\*/ 1 "
                    }
                ]
            },
            "bbox": [
                194,
                296,
                710,
                657
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "不能相反"
                    }
                ]
            },
            "bbox": [
                176,
                667,
                250,
                683
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "会导致死锁"
                    }
                ]
            },
            "bbox": [
                176,
                686,
                268,
                701
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Mutex "
                    },
                    {
                        "type": "equation_inline",
                        "content": "^ { = 0 }"
                    },
                    {
                        "type": "text",
                        "content": "；"
                    }
                ]
            },
            "bbox": [
                176,
                706,
                252,
                721
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Producer 会被阻塞；"
                    }
                ]
            },
            "bbox": [
                176,
                724,
                327,
                739
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Consumer 发现 mutex=0，也会被阻塞。"
                    }
                ]
            },
            "bbox": [
                176,
                741,
                472,
                757
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "信号量同步的缺点"
                    }
                ],
                "level": 1
            },
            "bbox": [
                193,
                99,
                400,
                120
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                613,
                89,
                678,
                99
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "九曲闲干"
                    }
                ],
                "level": 1
            },
            "bbox": [
                574,
                99,
                662,
                120
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                203,
                131,
                322,
                147
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "同步操作分散在各个进程中，使用不当就可能导致进程死锁例如：P、V操作的次序错误、重复或遗漏"
                    }
                ]
            },
            "bbox": [
                213,
                154,
                589,
                187
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                203,
                200,
                324,
                215
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "想要了解对于一组共享变量以及信号量的操作是否正确，需要阅读整个并发程序的代码"
                    }
                ]
            },
            "bbox": [
                213,
                222,
                631,
                254
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "经典进程同步问题"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                321,
                339,
                341
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "生产者消费者问题"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                388,
                339,
                409
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "M个生产者"
                    }
                ]
            },
            "bbox": [
                147,
                449,
                240,
                464
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "N个消费者"
                    }
                ]
            },
            "bbox": [
                147,
                468,
                236,
                483
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "共享一个具有k个缓冲区的循环缓冲池"
                    }
                ]
            },
            "bbox": [
                147,
                486,
                448,
                502
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "生产者不断生产产品，将每个产品依次放入缓冲区中（一个缓冲区正好放一个产品）"
                    }
                ]
            },
            "bbox": [
                147,
                504,
                793,
                520
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "消费者依次从缓冲区取出产品并进行消费。规定消费者不能从一个空缓冲区中取产品，生产者不能向一个已装满产品且尚未被取走的缓冲区中投放产品。"
                    }
                ]
            },
            "bbox": [
                147,
                523,
                847,
                557
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "什么时候用数字 out in "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\scriptstyle 1 = 0"
                    },
                    {
                        "type": "text",
                        "content": "，1"
                    }
                ]
            },
            "bbox": [
                147,
                561,
                364,
                576
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "什么时候用信号量 mutex ，Empty，full？"
                    }
                ]
            },
            "bbox": [
                147,
                579,
                457,
                594
            ]
        }
    ],
    [
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/d53299196877c163a349495f6913a53f02effa544db7c6be5512f0ef85b238c3.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                146,
                86,
                712,
                397
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1、 count "
                            },
                            {
                                "type": "equation_inline",
                                "content": "\\mathbf { \\Phi } = \\mathbf { 1 }"
                            },
                            {
                                "type": "text",
                                "content": "时唤醒消费者，保证至少有一个元素可消费；"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2、 count "
                            },
                            {
                                "type": "equation_inline",
                                "content": "\\mathrel { = } \\Nu { - } 1"
                            },
                            {
                                "type": "text",
                                "content": "时唤醒生产者，保证有一个空位可写；"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                211,
                407,
                682,
                443
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "当前缓冲区已空"
                    }
                ]
            },
            "bbox": [
                178,
                445,
                305,
                460
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "消费者去执行的时候发现 coun "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\scriptstyle = = 0"
                    }
                ]
            },
            "bbox": [
                176,
                464,
                447,
                479
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "但是调度程序切换到了生产者，发现 count "
                    },
                    {
                        "type": "equation_inline",
                        "content": "^ { : = 1 }"
                    }
                ]
            },
            "bbox": [
                176,
                482,
                526,
                498
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "生产者向消费者发送 wakeup"
                    }
                ]
            },
            "bbox": [
                176,
                501,
                400,
                517
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "消费者还没来得及 sleep 却 wakeup "
                    }
                ]
            },
            "bbox": [
                176,
                519,
                443,
                535
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "丢失唤醒（lost wakeup）问题"
                    }
                ]
            },
            "bbox": [
                176,
                538,
                408,
                552
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/9bed2fec71ac2c69761a8736fc468bc947966713f6b444a5134501ab134811c1.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                176,
                552,
                655,
                728
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "最后消费者 sleep"
                    }
                ]
            },
            "bbox": [
                176,
                741,
                312,
                758
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "生产者也 sleep 了"
                    }
                ]
            },
            "bbox": [
                176,
                760,
                312,
                776
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "可以设置等待位"
                    }
                ]
            },
            "bbox": [
                176,
                778,
                304,
                794
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "但是麻烦"
                    }
                ]
            },
            "bbox": [
                176,
                797,
                252,
                813
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "读者-写者问题"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                99,
                299,
                120
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "多个进程同时读数据库是可以的"
                    }
                ]
            },
            "bbox": [
                176,
                160,
                430,
                175
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "当一个进程正在写数据库，其它进程既不能读也不能写"
                    }
                ]
            },
            "bbox": [
                176,
                179,
                603,
                195
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "任意时刻只能由一个写数据库"
                    }
                ]
            },
            "bbox": [
                178,
                198,
                410,
                212
            ]
        },
        {
            "type": "algorithm",
            "content": {
                "algorithm_caption": [],
                "algorithm_content": [
                    {
                        "type": "text",
                        "content": "semaphore mutex = 1; /*控制对rc的访问*/  \nsemaphore db = 1; /*控制对数据库的访问*/  \nint rc = 0; /*正在读或者即将读的进程数目*/  \nvoid writer(void)  \n{ while (TRUE) { /*无限循环*/ /*非临界区*/ /*获取互斥访问*/ /*更新数据*/ /*释放互斥访问*/ }  \n}  \n "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\rightarrow"
                    },
                    {
                        "type": "text",
                        "content": " void reader(void) 读  \nwhile (TRUE) { /*无限循环*/ /*获得对rc的互斥访问权*/ /*现在又多了一个读者*/ /*如果这是第一个读者*/ /*释放对rc的互斥访问*/ /*访问数据*/ /*获取对rc的互斥访问*/ /*现在减少了一个读者*/ /*如果这是最后一个读者*/ /*释放对rc的互斥访问*/ /*非临界区*/ }"
                    }
                ]
            },
            "bbox": [
                176,
                216,
                833,
                659
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "读者优先——有写者想写则必须等待"
                    }
                ]
            },
            "bbox": [
                176,
                661,
                463,
                676
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "哲学家就餐问题"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                703,
                317,
                722
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "哲学家就餐问题"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                760,
                294,
                780
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "九曲闲干"
                    }
                ],
                "level": 1
            },
            "bbox": [
                463,
                762,
                536,
                781
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/e7aebfbbf7ad6638f3c2fbc42b8acaa4ada878ca8fed00b55eb0f0f96807950a.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                152,
                791,
                326,
                916
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "（对哲学家而言其他活动无关紧要）"
                    }
                ]
            },
            "bbox": [
                332,
                793,
                537,
                821
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "次去取左边和右边的叉子，每次拿放下叉子继续思考"
                    }
                ]
            },
            "bbox": [
                332,
                834,
                532,
                892
            ]
        }
    ],
    [
        {
            "type": "code",
            "content": {
                "code_caption": [],
                "code_content": [
                    {
                        "type": "text",
                        "content": "define N 5 < /* 哲学家的数目 */\nvoid philosopher(int i) /* i: 哲学家编号, 从0到4 */\n{\n    while (TRUE) {\n        think();\n        take_fork(i); 3\n        take_fork((i+1) % N); 4\n        eat();\n        put_fork(i); /* 将左叉放回桌上 */\n        put_fork((i+1) % N); /* 将右叉放回桌上 */\n}"
                    }
                ],
                "code_language": "c"
            },
            "bbox": [
                181,
                190,
                576,
                319
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "同时成功取到左侧叉子，再取右侧筷子失效。死锁"
                    }
                ],
                "level": 1
            },
            "bbox": [
                176,
                388,
                571,
                406
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "，如果五位哲学家同时拿起了左边的叉子，那么就没有人能够拿到他们右边的叉子，于是发生死锁"
                    }
                ]
            },
            "bbox": [
                176,
                414,
                746,
                455
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "果不可用，放下左叉子，等待一段时间后，重复这个过程。"
                    }
                ]
            },
            "bbox": [
                184,
                469,
                727,
                505
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "可能在某个瞬间，所有哲学家同时拿起了左叉子，然后检查右叉子不可用，又放下友叉子。如此永远重复下去。所有程序都在不停的运行，但是都无法取得进展，称为饥饿"
                    }
                ]
            },
            "bbox": [
                174,
                516,
                727,
                571
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                184,
                583,
                707,
                601
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "哲学家就餐问题"
                    }
                ],
                "level": 1
            },
            "bbox": [
                176,
                606,
                423,
                631
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "种科法"
                    }
                ],
                "level": 1
            },
            "bbox": [
                549,
                606,
                806,
                646
            ]
        },
        {
            "type": "code",
            "content": {
                "code_caption": [],
                "code_content": [
                    {
                        "type": "text",
                        "content": "define N 5\n#define LEFT (i+N-1)%N\n#define RIGHT (i+1)%N\n#define THINKING 0\n#define HUNGRY 1\n#define EATING 2\ntypedef int semaphore;\nint state[N];\nsemaphore mutex = 1;\nsemaphore s[N]; "
                    }
                ],
                "code_language": "c"
            },
            "bbox": [
                181,
                659,
                431,
                801
            ]
        },
        {
            "type": "code",
            "content": {
                "code_caption": [],
                "code_content": [
                    {
                        "type": "text",
                        "content": "/*哲学家数目*/  \n/*i的左邻居编号*/  \n/*i的右邻居编号*/  \n/*哲学家在思考*/  \n/*哲学家试图拿起叉子*/  \n/*哲学家进餐*/  \n/*信号量是一种特殊的整型数据*/  \n/*数组用来跟踪记录每位哲学家的状态*/  \n/*临界区的互斥*/  \n/*每个哲学家一个信号量*/"
                    }
                ],
                "code_language": "txt"
            },
            "bbox": [
                460,
                659,
                776,
                796
            ]
        }
    ],
    [
        {
            "type": "algorithm",
            "content": {
                "algorithm_caption": [],
                "algorithm_content": [
                    {
                        "type": "text",
                        "content": "void take_forks(int i) /\\*i:哲学家编号，从0到N-1\\*/{ down(&mutex); /\\*进入临界区\\*/ state[i]  "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\equiv"
                    },
                    {
                        "type": "text",
                        "content": " HUNGRY; /\\*记录哲学家i处于饥饿的状态\\*/ test(i); /\\*尝试获取2把叉子\\*/ up(&mutex); /\\*离开临界区\\*/ down(&s[i]); /\\*如果得不到需要的叉子则阻塞\\*/ } void test(i) /\\*i:哲学家编号，从0到N-1\\*/ { if(state[i]  "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\equiv"
                    },
                    {
                        "type": "text",
                        "content": " HUNGRY&&state[LEFT]！=EATING&&state[RIGHT]！=EATING){ state[i]  "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\equiv"
                    },
                    {
                        "type": "text",
                        "content": " EATING; up(&s[i]); }   \nvoid put_forks(i)   \n{ down(&mutex); /\\*进入临界区\\*/ state[i]  "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\equiv"
                    },
                    {
                        "type": "text",
                        "content": " THINKING; /\\*哲学家已经就餐完毕\\*/ test(LEFT); /\\*检查左边的邻居现在可以吃吗\\*/ test(RIGHT); /\\*检查右边的邻居现在可以吃吗\\*/ up(&mutex); /\\*离开临界区\\*/ }   \nvoid test(i) /\\*i:哲学家编号，从0到N-1\\*/ { if(state[i]  "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\equiv"
                    },
                    {
                        "type": "text",
                        "content": " HUNGRY&&state[LEFT]！=EATING&&state[RIGHT]！=EATING){ state[i]  "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\equiv"
                    },
                    {
                        "type": "text",
                        "content": " EATING; up(&s[i]); } "
                    }
                ]
            },
            "bbox": [
                174,
                89,
                759,
                514
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "死锁 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                541,
                206,
                563
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "若系统中存在一组进程（两个或两个以上），且它们都无限等待该组进程中另一进程所占有的无法释放的资源，无法向前推进"
                    }
                ]
            },
            "bbox": [
                144,
                607,
                848,
                640
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1、竞争资源"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2、进程推进顺序不当"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                146,
                645,
                322,
                678
            ]
        }
    ],
    [
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/c1e5684d2fdb4dec24258d1f8aad50579db4e1496f67970464f7838746ce6584.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                196,
                89,
                690,
                343
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "3、信号量使用不当（顺序不当，其实可以把互斥信号量、同步信号量也看成一种竞争资源）"
                    }
                ]
            },
            "bbox": [
                144,
                351,
                847,
                387
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "饥饿：长进程一直得不到处理机"
                    }
                ]
            },
            "bbox": [
                146,
                407,
                400,
                423
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "死循环：跳不出循环 "
                    }
                ]
            },
            "bbox": [
                147,
                426,
                310,
                441
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/ca9bb432cdd10ae837ba519599c616f8c819cbeacd07eeaba68e51cdc5a6821f.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td></td><td>共同点</td><td>区别</td></tr><tr><td>死锁</td><td rowspan=\"3\">都是进程无法顺利向前推进的现象（故意设计的死循环除外）</td><td>死锁一定是“循环等待对方手里的资源”导致的，因此如果有死锁现象，那至少有两个或两个以上的进程同时发生死锁。另外，发生死锁的进程一定处于阻塞态。</td></tr><tr><td>饥饿</td><td>可能只有一个进程发生饥饿。发生饥饿的进程既可能是阻塞态(如长期得不到需要的I/O设备)，也可能是就绪态(长期得不到处理机)</td></tr><tr><td>死循环</td><td>可能只有一个进程发生死循环。死循环的进程可以上处理机运行（可以是运行态），只不过无法像期待的那样顺利推进。死锁和饥饿问题是由于操作系统分配资源的策略不合理导致的，而死循环是由代码逻辑的错误导致的。死锁和饥饿是管理者（操作系统）的问题，死循环是被管理者的问题。</td></tr></table>",
                "table_type": "complex_table",
                "table_nest_level": 1
            },
            "bbox": [
                181,
                442,
                722,
                565
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "死锁 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                189,
                571,
                245,
                590
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "九曲闲干"
                    }
                ],
                "level": 1
            },
            "bbox": [
                589,
                571,
                680,
                594
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "指多个进程在运行过程中因争夺资源而造成的一种僵局，当进程处于这种状态时，若无外力作用，这些进程都将无法再向前推进。"
                    }
                ]
            },
            "bbox": [
                189,
                605,
                662,
                639
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/1ecdd7e0287818b71ae40f2737ebdce5c62abb9ca9302b0886bd20ea7e885854.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                225,
                649,
                636,
                741
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "有两个进程分别将文档扫描后刻录到光盘上"
                    }
                ]
            },
            "bbox": [
                272,
                747,
                589,
                764
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "我们把这一类需要排他性使用的对象称为资源"
                    }
                ],
                "level": 1
            },
            "bbox": [
                176,
                778,
                534,
                794
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "资源可以是硬件设备(打印机等)或者是一组信息(数据库中加锁记录)"
                    }
                ]
            },
            "bbox": [
                179,
                796,
                623,
                812
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                181,
                819,
                270,
                833
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "可以从拥有它的进程中抢断而不会产生副作用，例如内存"
                    }
                ]
            },
            "bbox": [
                191,
                840,
                561,
                853
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                181,
                862,
                284,
                873
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "无法从拥有它的进程处抢夺过来，例如光盘刻录机"
                    }
                ]
            },
            "bbox": [
                189,
                881,
                517,
                894
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "产生死锁的必要条件：互斥条件、占有且等待条件、不可剥夺条件、循环等待条件。必要条件：这四个条件必须同时存在才会导致死锁。"
                    }
                ]
            },
            "bbox": [
                174,
                111,
                857,
                146
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "1. 充分条件（ "
                    },
                    {
                        "type": "equation_inline",
                        "content": "( A  \\mathsf { B } )"
                    },
                    {
                        "type": "text",
                        "content": "）："
                    }
                ]
            },
            "bbox": [
                176,
                148,
                371,
                165
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "o A 是 B 的“充分”条件，即 A 成立足以保证 B 成立，但 B 可能由其他原因导致。"
                    }
                ]
            },
            "bbox": [
                235,
                167,
                847,
                200
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "2. 必要条件（ "
                    },
                    {
                        "type": "equation_inline",
                        "content": "( B \\gets A )"
                    },
                    {
                        "type": "text",
                        "content": "）："
                    }
                ]
            },
            "bbox": [
                176,
                204,
                371,
                221
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "o B 是 A 的“必要”条件，即A 成立必须依赖 B 成立（或无 B 必无 A），但 B成立不一定导致 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\mathsf { A } _ { \\mathsf { o } }"
                    },
                    {
                        "type": "text",
                        "content": "。"
                    }
                ]
            },
            "bbox": [
                235,
                223,
                847,
                256
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "3. 关键区别："
                    }
                ]
            },
            "bbox": [
                176,
                260,
                290,
                275
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "o 充分条件关注“A 能否保证 B”，必要条件关注“B 是否是 A 的前提”。"
                    }
                ]
            },
            "bbox": [
                235,
                278,
                805,
                294
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "必要条件"
                    }
                ]
            },
            "bbox": [
                181,
                292,
                292,
                313
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "死锁 "
                    }
                ]
            },
            "bbox": [
                327,
                292,
                381,
                313
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "九澜"
                    }
                ]
            },
            "bbox": [
                589,
                292,
                685,
                313
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                183,
                317,
                263,
                334
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                593,
                317,
                636,
                334
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每个资源要么已经分配给了一个进程，要么就是可以申请使用的"
                    }
                ]
            },
            "bbox": [
                189,
                337,
                621,
                351
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                189,
                355,
                460,
                370
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程已经保持了至少一个资源，但是又提出了新的资源请求。如果该资源"
                    }
                ]
            },
            "bbox": [
                179,
                374,
                684,
                388
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "又被其他进程占有，此时请求进程阻塞，但是对已获得的资源保持不放。"
                    }
                ]
            },
            "bbox": [
                191,
                392,
                675,
                406
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "·不可抢占条件"
                    }
                ]
            },
            "bbox": [
                181,
                410,
                297,
                423
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程已获得的资源不能被强制性的抢占，只能使用完时由其自己释放"
                    }
                ]
            },
            "bbox": [
                189,
                428,
                655,
                443
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "环路等待条件"
                    }
                ]
            },
            "bbox": [
                181,
                450,
                295,
                464
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "发生死锁时 系统中一定有两个或者两个以上的进程组成一条环路，该环路"
                    }
                ]
            },
            "bbox": [
                179,
                467,
                699,
                482
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "中每个进程都在等待着下一个进程所占用的资源"
                    }
                ]
            },
            "bbox": [
                191,
                481,
                515,
                494
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "死锁避免 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                562,
                247,
                581
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "安全状态"
                    }
                ],
                "level": 1
            },
            "bbox": [
                176,
                621,
                253,
                638
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "图中a为安全状态"
                    }
                ]
            },
            "bbox": [
                201,
                646,
                342,
                662
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/27f68b1a443048a5e3ae76ead23e63fb8420d9152ee44d4ff4e56964943b47e8.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                193,
                706,
                295,
                788
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                236,
                682,
                292,
                705
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/bcecaebf53ac2dce2b75e3048678e842f4fdc68f0124ad05267bdbcb5b9de08a.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                309,
                682,
                393,
                778
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/27eace3686e290b8374151fc146f356f0fa890fe1336b821809ae90748c49f38.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                433,
                682,
                489,
                780
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/5774a79f21a96638df76aa68f48fc17869ac7049f7cc39d02b4146d257f81f17.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                504,
                682,
                586,
                778
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/324d9d3c98215a5e4528c4ed963c0857646a5192f6de260cd84739564499dc91.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                601,
                682,
                684,
                778
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "安全序列，就是指如果系统按照"
                    }
                ]
            },
            "bbox": [
                176,
                807,
                430,
                822
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "安全序列可能有多个"
                    }
                ]
            },
            "bbox": [
                176,
                826,
                339,
                841
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "找不出任何一个安全序列，就进入了不安全状态"
                    }
                ]
            },
            "bbox": [
                176,
                844,
                552,
                860
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进入不安全状态，就可能发生死锁"
                    }
                ]
            },
            "bbox": [
                176,
                863,
                445,
                878
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "不安全状态并不是死锁"
                    }
                ]
            },
            "bbox": [
                186,
                127,
                369,
                142
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                226,
                164,
                285,
                187
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/2baa16bee0d6562154edf92a392c2ca89363854e5eae57f871229355fa84481d.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                196,
                190,
                285,
                265
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                361,
                164,
                418,
                187
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/628b8e4ebaff3102a7aa77b40571f15eba00bc7dba14814c8ce2cfc18fdf1cbf.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                315,
                190,
                443,
                265
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                497,
                164,
                554,
                187
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/4fe34c23a09000bcbed71099486fb9f6832c30f46c297ff383af500be52ce5fa.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                468,
                189,
                557,
                262
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                636,
                165,
                692,
                187
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/2e6817351a3fb616c01e41e06c6beeab6e24269c13f7a5bcbbf4312b72a922d4.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                606,
                189,
                692,
                261
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "银行家算法"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                321,
                268,
                341
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "判断对请求的满足是否会导致进入不安全状态"
                    }
                ]
            },
            "bbox": [
                184,
                399,
                569,
                416
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如果会导致不安全状态，就拒绝该请求，否则就满足该请求"
                    }
                ]
            },
            "bbox": [
                184,
                425,
                684,
                441
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                282,
                458,
                337,
                481
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/78b2a54c8a65d7634cacb17b505e4a5c25b05ad0a2ec0f2738952f8c26f1ba66.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                255,
                483,
                337,
                567
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                425,
                458,
                478,
                481
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/bf03375d24ec412c4d74ecc30d07acb840de76ecf38ac7311d383be67a45c106.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                401,
                483,
                480,
                568
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                568,
                460,
                621,
                482
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/65d13fb0dcd2f17efc8b12c656a566ff32b2cf1d8a7d7660975a411fc951bb2b.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                544,
                483,
                625,
                569
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "安全序列"
                    }
                ],
                "level": 1
            },
            "bbox": [
                178,
                585,
                252,
                600
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/82fa1806d32e054e64211e178dde7d0e4b8a815291fbe93bc516d8188dfc98f8.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td></td><td>最大需求</td><td>已借走</td><td>最多还会借</td></tr><tr><td>B</td><td>70</td><td>20+30=60</td><td>50-30=20</td></tr><tr><td>A</td><td>40</td><td>10</td><td>30</td></tr><tr><td>T</td><td>50</td><td>30</td><td>20</td></tr></table>",
                "table_type": "simple_table",
                "table_nest_level": 1
            },
            "bbox": [
                206,
                607,
                376,
                648
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/f3b9191533b6b490acbeab39efea7e4546d57d0004cea9e6c8d08a40df93cba8.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td></td><td>最大需求</td><td>已借走</td><td>最多还会借</td></tr><tr><td>B</td><td>70</td><td>20</td><td>50</td></tr><tr><td>A</td><td>40</td><td>10+20=30</td><td>30-20=10</td></tr><tr><td>T</td><td>50</td><td>30</td><td>20</td></tr></table>",
                "table_type": "simple_table",
                "table_nest_level": 1
            },
            "bbox": [
                416,
                607,
                584,
                648
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "给B借30亿是不安全的..之后手里只剩10亿，如"
                    }
                ]
            },
            "bbox": [
                203,
                652,
                386,
                675
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "给A借20亿是安全的，因为存在T→BA这样的安全序列。"
                    }
                ]
            },
            "bbox": [
                420,
                653,
                589,
                671
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "所谓安全序列，就是指如果系统按照这种序列分配资源，则每个进程都能顺利完成，只要能找出一个安全序列，系统就是安全状态。当然，安全序列可能有多个。如果分配了资源之后，系统中找不出任何一个安全序列，系统就进入了不安全状态。这就意味着之后可能所有进程都无法顺利的执行下去。当然，如果有进程提前归还了一些资源，那系统也有可能重新回到安全状态，不过我们在分配资源之前总是要考虑到最坏的情况。"
                    }
                ]
            },
            "bbox": [
                200,
                678,
                589,
                715
            ]
        }
    ],
    [
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/4c40239f86abaddc0b32c243fc303b000b60af9e2c60870326de5b49aa1eaa67.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                253,
                89,
                359,
                151
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [],
                "level": 1
            },
            "bbox": [
                405,
                96,
                915,
                112
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                405,
                124,
                996,
                158
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/3e24769166f28f1caf428de5e63cee2be705070284d46eb7fd697b17985ed9ab.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td></td><td>最大需求</td><td>已借走</td><td>最多还会借</td></tr><tr><td>B</td><td>70</td><td>20</td><td>50</td></tr><tr><td>A</td><td>40</td><td>10</td><td>30</td></tr><tr><td>T</td><td>50</td><td>30</td><td>20</td></tr></table>",
                "table_type": "simple_table",
                "table_nest_level": 1
            },
            "bbox": [
                250,
                168,
                586,
                256
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/a805ef56ddab93a1469dbfd2820a6939fdb497b5d7655490f45fc42bec172bb8.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td>进程</td><td>最大需求</td><td>已分配</td><td>最多还需要</td></tr><tr><td>P0</td><td>(7,5,3)</td><td>(0,1,0)</td><td>(7,4,3)</td></tr><tr><td>P1</td><td>(3,2,2)</td><td>(2,0,0)</td><td>(1,2,2)</td></tr><tr><td>P2</td><td>(9,0,2)减</td><td>(3,0,2)→</td><td>(6,0,0)</td></tr><tr><td>P3</td><td>(2,2,2)</td><td>(2,1,1)</td><td>(0,1,1)</td></tr><tr><td>P4</td><td>(4,3,3)</td><td>(0,0,2)</td><td>(4,3,1)</td></tr></table>",
                "table_type": "simple_table",
                "table_nest_level": 1
            },
            "bbox": [
                605,
                168,
                996,
                297
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "此时总共已分配（7，2，5），还剩余（3,3,2)"
                    }
                ]
            },
            "bbox": [
                230,
                263,
                561,
                310
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "资源总数（10,5，7），剩余可用资源（7，4"
                    }
                ]
            },
            "bbox": [
                549,
                326,
                784,
                341
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/6884e85be95ecaea192c3cf4a4967ed38603434e62864d639f7a578bcf88dede.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td>进程</td><td>最大需求</td><td>已分配</td><td>最多还需要</td></tr><tr><td>P0</td><td>(7,5,3)</td><td>(0,1,0)</td><td>(7,4,3)</td></tr><tr><td colspan=\"4\"></td></tr><tr><td>P2</td><td>(9,0,2)</td><td>(3,0,2)</td><td>(6,0,0)</td></tr><tr><td colspan=\"4\"></td></tr><tr><td>P4</td><td>(4,3,3)</td><td>(0,0,2)</td><td>(4,3,1)</td></tr></table>",
                "table_type": "complex_table",
                "table_nest_level": 1
            },
            "bbox": [
                233,
                326,
                521,
                417
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "此时系统是否处于安全状态？"
                    }
                ]
            },
            "bbox": [
                240,
                425,
                403,
                436
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "思路：尝试找出一个安全序列.IP1，P3!"
                    }
                ]
            },
            "bbox": [
                240,
                436,
                546,
                445
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "依次检查剩余可用资源（3，3，2）是否能满足各进程的需求"
                    }
                ]
            },
            "bbox": [
                240,
                445,
                554,
                457
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "可满足P1需求，将P1加入安全序列，并更新剩余可用资源值为(5,3,2)"
                    }
                ]
            },
            "bbox": [
                240,
                457,
                635,
                468
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "依次检查剩余可用资源（5，3，2）是否能满足剩余进程（不包括已加入安全序列的进程）的需求"
                    }
                ]
            },
            "bbox": [
                240,
                468,
                757,
                478
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "可满足P3需求，将P3加入安全序列，并更新剩余可用资源值为（7，4，3）"
                    }
                ]
            },
            "bbox": [
                240,
                479,
                635,
                489
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "依次检查剩余可用资源（7，4，3)是否能满足剩余进程（不包括已加入安全序列的进程）的需..."
                    }
                ]
            },
            "bbox": [
                240,
                489,
                774,
                501
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "以此类推，共五次循环检查即可将5个进程都加入安全序列中，最终可得一个安全序列。该算法称为安全性算法。可以很方便地用代码实现以上流程，每一轮检查都从编号较小的进程开始检实际做题时可以更快速的得到安全序列。"
                    }
                ]
            },
            "bbox": [
                240,
                510,
                769,
                544
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "如果导致不安全状态，就拒绝该请求，否则就满足该请求"
                    }
                ],
                "level": 1
            },
            "bbox": [
                176,
                556,
                621,
                571
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "死锁避免从本质上说是不可能的，因为很少由进程在运行之前就知道运行所需的最大资源数，进程数也是不固定的"
                    }
                ]
            },
            "bbox": [
                174,
                574,
                845,
                609
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/42b1ea66009133c8192cd9efac9b11ee7985a8b12ed32e0d3848190c99d93b13.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td>进程</td><td>最大需求</td><td>已分配</td><td>最多还需要</td></tr><tr><td>P0</td><td>(7,5,3)</td><td>(0,1,0)</td><td>(7,4,3)</td></tr><tr><td>P1</td><td>(3,2,2)</td><td>(2,0,0)</td><td>(1,2,2)</td></tr><tr><td>P2</td><td>(9,0,2)</td><td>(3,0,2)</td><td>(6,0,0)</td></tr><tr><td>P3</td><td>(2,2,2)</td><td>(2,1,1)</td><td>(0,1,1)</td></tr><tr><td>P4</td><td>(4,3,3)</td><td>(0,0,2)</td><td>(4,3,1)</td></tr></table>",
                "table_type": "simple_table",
                "table_nest_level": 1
            },
            "bbox": [
                221,
                613,
                771,
                700
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "实际做题（手算）时可用更快速的方法找到一个安全序列："
                    }
                ]
            },
            "bbox": [
                225,
                705,
                544,
                715
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "经对比发现，（3,3,2）可满足P1、P3，说明无论如何，这两个进程的资源需求一定是可以依次被满足的，因此P1、P3一定可以顺利的执行完，并归还资源。可把P1、P3先加入安全序列。"
                    }
                ]
            },
            "bbox": [
                225,
                715,
                759,
                738
            ]
        }
    ],
    [
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/2ab2b12807c566b72a8ee565243671d6a4fd862cda32b0eee79c4c5a99237cfd.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td>进程</td><td>最大需求</td><td>已分配</td><td>最多还需要</td></tr><tr><td>P0</td><td>(8,5,3)</td><td>(0,1,0)</td><td>(8,4,3)</td></tr><tr><td colspan=\"4\"></td></tr><tr><td>P2</td><td>(9,5,2)</td><td>(3,0,2)</td><td>(6,5,0)</td></tr><tr><td colspan=\"4\"></td></tr><tr><td>P4</td><td>(4,3,6)</td><td>(0,0,2)</td><td>(4,3,4)</td></tr></table>",
                "table_type": "complex_table",
                "table_nest_level": 1
            },
            "bbox": [
                213,
                105,
                507,
                198
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                537,
                105,
                779,
                118
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "再看一个找不到安全序列的例子："
                    }
                ]
            },
            "bbox": [
                216,
                203,
                410,
                215
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "经对比发现，（3,3,2）可满足P1、P3，说明无论如何，这两个进程的资源需求一定是可以依次被满足的，因此P1、P3一定可以顺利的执行完，并归还资源。可把P1、P3先加入安全序列。"
                    }
                ]
            },
            "bbox": [
                216,
                215,
                781,
                237
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "（2,0,0)+（2,1,1)+（3,3,2）=（7,4,3）"
                    }
                ]
            },
            "bbox": [
                216,
                237,
                421,
                249
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                406,
                334,
                490,
                347
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                176,
                360,
                368,
                370
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每个进程在运行前先声明对各种资源的最大需求数，则可用一个n*m的矩阵（可用二维数组实现）表示所有进程对各种资源的最大需求数。不妨称为最大需求矩阵Max，Max[i,j]=K表示进程Pi最多需要K个资源Rj。同理，系统可以用一个n*m的分配矩阵Allocation表示对所有进程的资源分配情况。Max-Allocation="
                    }
                ]
            },
            "bbox": [
                191,
                370,
                462,
                430
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Need矩阵，表示各进程最多还需要多少各类资源。另外，还要用一个长度为m的一维数组Available表示当前系统中还有多少可用资源。"
                    }
                ]
            },
            "bbox": [
                191,
                430,
                458,
                458
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "某进程Pi向系统申请资源，可用一个长度为m的一维数组Request表示本次申请的各种资源量。"
                    }
                ]
            },
            "bbox": [
                191,
                458,
                453,
                478
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/c909f0a15c06ce75b9084d9e738493ab933bac3febb493b1967622f0cd3c57f2.jpg"
                },
                "table_caption": [
                    {
                        "type": "text",
                        "content": "Available=(1,2,1) "
                    }
                ],
                "table_footnote": [],
                "html": "<table><tr><td>进程</td><td>最大需求</td><td>已分配</td><td>最多还需要</td></tr><tr><td>P0</td><td>(7,5,3)</td><td>(2,2,1)</td><td>(5,3,2)</td></tr><tr><td>P1</td><td>(3,2,2)</td><td>(2,0,0)</td><td>(1,2,2)</td></tr><tr><td>P2</td><td>(9,0,2)</td><td>(3,0,2)</td><td>(6,0,0)</td></tr><tr><td>P3</td><td>(2,2,2)</td><td>(2,1,1)</td><td>(0,1,1)</td></tr><tr><td>P4</td><td>(4,3,3)</td><td>(0,0,2)</td><td>(4,3,1)</td></tr></table>",
                "table_type": "simple_table",
                "table_nest_level": 1
            },
            "bbox": [
                465,
                362,
                719,
                443
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Max 矩阵 "
                    }
                ]
            },
            "bbox": [
                524,
                449,
                552,
                466
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Allocation "
                    }
                ]
            },
            "bbox": [
                584,
                448,
                633,
                464
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                673,
                447,
                699,
                464
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "因为它所需要的资源数已超过"
                    }
                ],
                "level": 1
            },
            "bbox": [
                524,
                481,
                673,
                498
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "可用银行家算法预判本次分配是否会导致系统进入不安全状态：①如果Request[i]<Need[i，j](0sjsm)便转向②：否则认为出错。②如果Request[j<Available[j]（0sjm），便转向③：否则表示尚"
                    }
                ]
            },
            "bbox": [
                191,
                481,
                507,
                511
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "equation_inline",
                        "content": "\\textcircled{3}"
                    },
                    {
                        "type": "text",
                        "content": "系统试探着把资源分配给进程Pi，并修改相应的数据（并非真的分配，修改数值只是为了做预判）："
                    }
                ]
            },
            "bbox": [
                191,
                511,
                697,
                521
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Available "
                    },
                    {
                        "type": "equation_inline",
                        "content": "="
                    },
                    {
                        "type": "text",
                        "content": "Available-Request; Allocation[i "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\mathrm { i l } ="
                    },
                    {
                        "type": "text",
                        "content": "Allocation[i,j]+ Need[i "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\mathrm { i } ] ="
                    },
                    {
                        "type": "text",
                        "content": "Need[i,j]-Request "
                    }
                ]
            },
            "bbox": [
                191,
                521,
                341,
                550
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "④操作系统执行安全性算法，检查此次资源分配后，系统是否处于安全状态。若安全，才正式分配：否则，恢复相应数据，让进程阻塞等待。"
                    }
                ]
            },
            "bbox": [
                416,
                521,
                707,
                552
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "数据结构："
                    }
                ]
            },
            "bbox": [
                203,
                575,
                255,
                583
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "长度为m的一维数组Available表示还有多少可用资源"
                    }
                ]
            },
            "bbox": [
                203,
                585,
                475,
                594
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "n*m矩阵Max表示各进程对资源的最大需求数"
                    }
                ]
            },
            "bbox": [
                203,
                594,
                440,
                602
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "n*m矩阵Allocation表示已经给各进程分配了多少资源"
                    }
                ]
            },
            "bbox": [
                203,
                604,
                477,
                613
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Max-Allocation "
                    },
                    {
                        "type": "equation_inline",
                        "content": "="
                    },
                    {
                        "type": "text",
                        "content": "Need矩阵表示各进程最多还需要多少资源"
                    }
                ]
            },
            "bbox": [
                203,
                614,
                505,
                623
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "用长度为m的一位数组Request表示进程此次申请的各种资源数"
                    }
                ]
            },
            "bbox": [
                203,
                624,
                527,
                634
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "银行家算法步骤："
                    }
                ]
            },
            "bbox": [
                203,
                643,
                290,
                652
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "①检查此次申请是否超过了之前声明的最大需求数"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "②检查此时系统剩余的可用资源是否还能满足这次请求 "
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "③试探着分配，更改各数据结构"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "④用安全性算法检查此次分配是否会导致系统进入不安全状态"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                203,
                653,
                515,
                692
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "安全性算法步骤："
                    }
                ]
            },
            "bbox": [
                203,
                702,
                290,
                711
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "检查当前的剩余可用资源是否能满足某个进程的最大需求，如果可以，就把该进程加入安全序列，并把该进程持有的资源全部回收。 1"
                    }
                ]
            },
            "bbox": [
                203,
                712,
                692,
                732
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "鸵鸟算法"
                    }
                ],
                "level": 1
            },
            "bbox": [
                616,
                96,
                717,
                117
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                149,
                624,
                480,
                640
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "采用假脱机打印技术（SPOOLing）可以允许多个进程同时产生输出"
                    }
                ]
            },
            "bbox": [
                149,
                646,
                594,
                664
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/5507ccaf4e794d13ca23f853c8f9414881c012a4474a5650342db7cb569ca02d.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                159,
                670,
                606,
                758
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "预防死锁 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                136,
                247,
                155
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/10ee9ed9fa304c92af0edc70d0af5e8ce379e9c19d7a57940ae45461261dce5a.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                176,
                190,
                480,
                231
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": []
            },
            "bbox": [
                186,
                241,
                381,
                300
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "破坏互斥条件"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                350,
                294,
                369
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/17adbdc0b1c87937532d30c4dca7dee74a3987bd9a62d9772bbb00a80f137ea4.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                441,
                608,
                588
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "操作系统采用SPOOLing技术把独占设备在逻辑上改造成共享设备在各进程看来，自己对打印机资源的使用请求立即被接受处理了，不需要再阻塞等待在磁盘上开一个缓冲区实现共享"
                    }
                ]
            },
            "bbox": [
                174,
                632,
                836,
                686
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/ab7ec2b27d401f63d45094a213c565120cad9794b576541a5999b3b5c201e90a.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                225,
                708,
                697,
                825
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "破坏请求和保持条件"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                101,
                361,
                120
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                151,
                167,
                460,
                179
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如果所需的全部资源可用，那么进程肯定可以运行结束"
                    }
                ]
            },
            "bbox": [
                157,
                186,
                499,
                199
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如果有一个或者多个资源正被使用，那么就不进行分配，进程等待"
                    }
                ]
            },
            "bbox": [
                157,
                204,
                566,
                217
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                151,
                231,
                527,
                244
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                157,
                247,
                389,
                259
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "请求和保持条件：进程已经保持了至少一个资源，但又提出了新的资源请求，而该资源又被其他进程占有，此时请求进程被阻塞，但又对自己已有的资源保持不放。"
                    }
                ]
            },
            "bbox": [
                203,
                288,
                704,
                311
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "可以采用静态分配方法，即进程在运行前一次申请完它所需要的全部资源，在它的资源未满足前，不让它投入运行。一旦投入运行后，这些资源就一直归它所有，该进程就不会再请求别的任何资源"
                    }
                ]
            },
            "bbox": [
                203,
                318,
                704,
                350
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "该策略实现起来简单，但也有明显的缺点"
                    }
                ]
            },
            "bbox": [
                203,
                357,
                420,
                367
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "有些资源可能只需要用很短的时间，因此如果进程的整个运行期间都一直保持着所有资源，就会造成严重的资源浪费，资源利用率极低。另外，该策略也有可能导致某些进程饥饿。"
                    }
                ]
            },
            "bbox": [
                203,
                368,
                702,
                388
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/8de858f24c88b43d81c74cb161765a184ea8a9cb83fb61830421c5de9ef94207.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                309,
                393,
                600,
                475
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "破坏不剥夺条件"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                518,
                317,
                539
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "破坏不可抢占条件"
                    }
                ],
                "level": 1
            },
            "bbox": [
                186,
                613,
                379,
                632
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "加曲闲干"
                    }
                ],
                "level": 1
            },
            "bbox": [
                544,
                612,
                626,
                633
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                184,
                645,
                428,
                659
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "打印机"
                    }
                ]
            },
            "bbox": [
                473,
                637,
                561,
                664
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如果它需要的绘图仪无法获得，而强制性的把它占有的打印机抢占掉，会引起一片混乱。"
                    }
                ]
            },
            "bbox": [
                194,
                665,
                610,
                714
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                184,
                726,
                541,
                739
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "例如数据库中的记录是必须被锁定的，因此还是会出现死锁的可能"
                    }
                ]
            },
            "bbox": [
                194,
                746,
                638,
                760
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "不剥夺条件：进程所获得的资源在未使用完之前，不能由其他进程强行夺走，只能主动释放。"
                    }
                ]
            },
            "bbox": [
                186,
                87,
                677,
                101
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "破坏不剥夺条件："
                    }
                ]
            },
            "bbox": [
                186,
                110,
                280,
                120
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "方案一：当某个进程请求新的资源得不到满足时，它必须立即释放保持的所有资源，待以后需要时再重新申请。也就是说，即使某些资源尚未使用完，也需要主动释放，从而破坏了不可剥夺条件。"
                    }
                ]
            },
            "bbox": [
                186,
                120,
                707,
                142
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "方案二：当某个进程需要的资源被其他进程所占有的时候，可以由操作系统协助，将想要的资源强行剥夺。这种方式一般需要考虑各进程的优先级（比如：剥夺调度方式，就是将处理机资源强行剥夺给优先级更高的进程使用）"
                    }
                ]
            },
            "bbox": [
                186,
                149,
                709,
                181
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "该策略的缺点："
                    }
                ]
            },
            "bbox": [
                188,
                191,
                267,
                200
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1.实现起来比较复杂。"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2.释放已获得的资源可能造成前一阶段工作的失效。因此这种方法一般只适用于易保存和恢复状态的资源，如CPU。"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "3.反复地申请和释放资源会增加系统开销，降低系统吞吐量。"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "4.若采用方案一，意味着只要暂时得不到某个资源，之前获得的那些资源就都需要放弃，以后再重新申请。如果一直发生这样的情况，就会导致进程饥饿。"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                186,
                202,
                705,
                263
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "破坏环路等待 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                338,
                295,
                360
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "破坏环路等待 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                211,
                395,
                361,
                414
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "九曲阑干"
                    }
                ],
                "level": 1
            },
            "bbox": [
                584,
                395,
                670,
                416
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "个限制是不可接受的。"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                211,
                429,
                643,
                535
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "循环等待条件：存在一种进程资源的循环等待链，链中的每一个进程已获得的资源同时被下一个进程所请求。"
                    }
                ]
            },
            "bbox": [
                191,
                594,
                606,
                611
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "同类资源（即编号相同的资源）一次申请完。"
                    }
                ]
            },
            "bbox": [
                191,
                618,
                608,
                634
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "原理分析：一个进程只有已占有小编号的资源时，才有资格申请更大编号的资源。按此规则，已持有大编号资源的进程不可能逆向地回来申请小编号的资源，从而就不会产生循环等待的现象。"
                    }
                ]
            },
            "bbox": [
                191,
                642,
                606,
                659
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "假设系统中共有10个资源，编号为1,2.....0"
                    }
                ]
            },
            "bbox": [
                193,
                664,
                386,
                674
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                201,
                690,
                216,
                717
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                245,
                690,
                263,
                715
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                290,
                690,
                307,
                715
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "在任何一个时刻，总"
                    }
                ]
            },
            "bbox": [
                339,
                678,
                428,
                745
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "该策略的缺点："
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1.不方便增加新的设备，因为可能需要重新分配所有的编号："
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2.进程实际使用资源的顺序可能和编号递增顺序不一致，会导致资源浪费："
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "3.必须按规定次序申请资源，用户编程麻烦。"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                460,
                676,
                605,
                741
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "死锁的检测和恢复 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                813,
                339,
                833
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "允许死锁发生，当检测到死锁发生后，采取措施进行恢复"
                    }
                ]
            },
            "bbox": [
                176,
                873,
                623,
                890
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "资源分配图"
                    }
                ],
                "level": 1
            },
            "bbox": [
                179,
                93,
                270,
                108
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                194,
                116,
                561,
                131
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": []
            },
            "bbox": [
                191,
                146,
                709,
                227
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/a50091297857e2b1224a61159ff70eb4337a875f10d412ce17db2333d8031833.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                193,
                236,
                440,
                370
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/349ba9a3d7fa4f8cc34076067b0cd985959b9ec55f5b10d7ebb10cc05c3364b3.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                505,
                272,
                643,
                367
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/69305d2d58e95736b744ed8dafcc3d06808b39f3111debe6318fe1f8209b17c1.jpg"
                },
                "image_caption": [
                    {
                        "type": "text",
                        "content": "b) "
                    }
                ],
                "image_footnote": []
            },
            "bbox": [
                193,
                370,
                327,
                391
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "死锁恢复 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                193,
                392,
                295,
                412
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "力曲阑干 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                416,
                388,
                655,
                417
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                193,
                422,
                310,
                436
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "抢占是否可行，取决于资源的类型"
                    }
                ]
            },
            "bbox": [
                201,
                441,
                443,
                456
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                193,
                464,
                310,
                479
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "周期性的对进程进行检查点检查。"
                    }
                ]
            },
            "bbox": [
                200,
                486,
                433,
                500
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "检查点检查就是把进程的状态写入一个文件以备以后重启"
                    }
                ]
            },
            "bbox": [
                200,
                506,
                598,
                520
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                193,
                532,
                342,
                546
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1、撤销进程"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2、抢占资源"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                178,
                575,
                282,
                609
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1、利用抢占恢复"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2、利用回滚恢复"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                208,
                612,
                347,
                646
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "死锁的数学公式"
                    }
                ]
            },
            "bbox": [
                147,
                649,
                275,
                664
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "1. 死锁条件公式推导"
                    }
                ]
            },
            "bbox": [
                147,
                668,
                309,
                683
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "系统参数："
                    }
                ]
            },
            "bbox": [
                147,
                686,
                228,
                701
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "N：进程数"
                    }
                ]
            },
            "bbox": [
                147,
                705,
                233,
                720
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "W：每个进程最大资源需求"
                    }
                ]
            },
            "bbox": [
                147,
                722,
                359,
                738
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "M：系统资源总数"
                    }
                ]
            },
            "bbox": [
                147,
                741,
                290,
                757
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "最小安全资源数： "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\mathsf { M } \\geq \\mathsf { N } \\times ( \\mathsf { W } - 1 ) + 1"
                    }
                ]
            },
            "bbox": [
                147,
                760,
                398,
                776
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "逻辑证明："
                    }
                ]
            },
            "bbox": [
                147,
                778,
                228,
                794
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每个进程获得(W−1)个资源（共占用 N×(W−1)个）"
                    }
                ]
            },
            "bbox": [
                147,
                797,
                515,
                813
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "系统至少剩1个资源"
                    }
                ]
            },
            "bbox": [
                147,
                816,
                309,
                831
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "该剩余资源可分配给任一进程使其完成"
                    }
                ]
            },
            "bbox": [
                147,
                834,
                450,
                848
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "完成进程释放W个资源，保障其他进程执行"
                    }
                ]
            },
            "bbox": [
                147,
                853,
                490,
                868
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "管程"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                99,
                206,
                122
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "和之前的PV操作一样，实现进程间的互斥和同步"
                    }
                ]
            },
            "bbox": [
                144,
                165,
                529,
                181
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1、局部于管程的共享数据结构"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2、 对于该数据结构进行操作的一组过程"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "3、对于局部于共享数据设置初始值的语句"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                146,
                184,
                480,
                236
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "4、管程的名字"
                    }
                ]
            },
            "bbox": [
                146,
                240,
                268,
                254
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "基本特征："
                    }
                ]
            },
            "bbox": [
                146,
                258,
                228,
                273
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1、局部于管程的数据结构只能被管城内的过程访问，任何外部过程不能访问，而管程内的过程也只能访问该管程内的数据结构"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2、一个进程若想访问管程内的数据结构（共享资源）们只能通过调用管程内地某个过程实现间接访问"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "3、任意时刻，管程中只能有一个进程在管程中执行管程的某个过程，其它任何调用管程的进程都将被阻塞，直到管程变成可用，这一特性使管程能有效地实现互斥"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                144,
                275,
                845,
                384
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "引入管程的目的无非就是要更方便地实现进程互斥和同步。"
                    }
                ]
            },
            "bbox": [
                164,
                385,
                447,
                395
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1.需要在管程中定义共享数据（如生产者消费者问题的缓冲区）"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2.需要在管程中定义用于访问这些共享数据的“入口”一一其实就是一些函数（如生产者消费者问题中，可以定义一个函数用于将产品放入缓冲区，再定义一个函数用于从缓冲区取出产品）"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "入（如生产者消费者问题中，各进程需要互斥地访问共享缓冲区。管程的这种特性即可保证一个时间段内最多只会有一个进程在访问缓冲区。注意：这种互斥特性是由编译器负责实现的，"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "5.可在管程中设置条件变量及等待/唤醒操作以解决同步问题。可以让一个进程或线程在条件变量等待在条件变量上的进程或线程唤醒。"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                164,
                404,
                638,
                508
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "程序员可以用某种特殊的语法定义一个管程（比如：:monitor ProducerConsumer..endmonitor;），之后其他程序员就可以使用这个管程提供的特定“入口”很方便地使用实现进程同步/互斥了。"
                    }
                ]
            },
            "bbox": [
                163,
                516,
                635,
                536
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "量好课v：IT-aixuexi "
                    }
                ]
            },
            "bbox": [
                203,
                576,
                352,
                590
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                230,
                595,
                411,
                617
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "九曲闲干"
                    }
                ]
            },
            "bbox": [
                739,
                590,
                853,
                619
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "管程的基本思想是：把信号量和操作原语封装在一个对象的内部"
                    }
                ]
            },
            "bbox": [
                233,
                639,
                576,
                675
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "也就是把共享变量和共享变量能够进行的所有操作集中在一个模块中"
                    }
                ]
            },
            "bbox": [
                233,
                693,
                598,
                728
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "管程是一个由过程、变量及数据结构等组成的一个集合，它们组成了一个特殊的模块"
                    }
                ]
            },
            "bbox": [
                236,
                750,
                601,
                804
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "monitor example "
                    }
                ]
            },
            "bbox": [
                653,
                644,
                763,
                657
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "integeri; "
                    }
                ]
            },
            "bbox": [
                690,
                658,
                749,
                669
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "condition c; "
                    }
                ]
            },
            "bbox": [
                690,
                671,
                769,
                681
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "procedure producer(); "
                    }
                ]
            },
            "bbox": [
                690,
                694,
                838,
                707
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "end: "
                    }
                ]
            },
            "bbox": [
                695,
                730,
                724,
                741
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "procedure consumer(); "
                    }
                ]
            },
            "bbox": [
                695,
                758,
                845,
                770
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "end: "
                    }
                ]
            },
            "bbox": [
                695,
                781,
                724,
                791
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "end monitor; "
                    }
                ]
            },
            "bbox": [
                653,
                795,
                741,
                804
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [],
                "level": 1
            },
            "bbox": [
                189,
                93,
                352,
                112
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程可以在任何需要的时候调用管程中的过程管程结构确保每次只有一个进程在管程内处于活动状态。"
                    }
                ]
            },
            "bbox": [
                191,
                128,
                485,
                178
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [],
                "level": 1
            },
            "bbox": [
                194,
                195,
                420,
                212
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "编译器必须要识别管程并用某种方式对其互斥做出安排"
                    }
                ]
            },
            "bbox": [
                193,
                228,
                477,
                260
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "因此，管程比信号量更容易保证并行编程的正确性"
                    }
                ]
            },
            "bbox": [
                193,
                272,
                512,
                303
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/b0d562b01db034b4688bd5a3b381da70dbbce5e4a22d9dcbe579bb2efa2f8e9d.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                515,
                122,
                759,
                298
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "管程里的 wait 和 signal 和之前的 wait 和 signal 并不一样"
                    }
                ],
                "level": 1
            },
            "bbox": [
                178,
                334,
                601,
                350
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "wait/ condition "
                    }
                ]
            },
            "bbox": [
                196,
                354,
                648,
                395
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "对于条件变量x，只有操作wait(和signal(可以调用"
                    }
                ]
            },
            "bbox": [
                196,
                399,
                571,
                414
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "对于操作.wait 调用这一操作的进程会被挂起"
                    }
                ]
            },
            "bbox": [
                196,
                419,
                561,
                439
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/c0b922245a7643b327dc7d527ee8768a992815da12af61eee229bf24da66bd7e.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                573,
                416,
                647,
                441
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "一直到另外一个进程调用x.signalOQ"
                    }
                ]
            },
            "bbox": [
                200,
                443,
                484,
                464
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如果没有挂起进程，那么操作signal就没有作用，也就是说x的态如同没有执行任何操作。"
                    }
                ]
            },
            "bbox": [
                200,
                470,
                647,
                495
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                200,
                497,
                581,
                510
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "内存管理"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                558,
                258,
                581
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "内存的分配与回收"
                    }
                ]
            },
            "bbox": [
                176,
                625,
                322,
                640
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "地址映射"
                    }
                ]
            },
            "bbox": [
                176,
                644,
                252,
                659
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "编译器在对程序进行编译的时候，通常从 0开始为程序代码编址，程序中设计的所有地址都是相对起始地址0确定的，这种地址称为虚地址、相对地址或逻辑地址。相应地，这些地址构成的地址空间称为虚地址空间、程序空间或者逻辑地址空间。"
                    }
                ]
            },
            "bbox": [
                174,
                662,
                847,
                715
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "当程序加载到内存中时，通常不是从 0开始的内存空间，程序在物理内存中的空间称为实地址、绝对地址或者物理地址，构成的地址空间称为是地址空间、内存空间或物理空间。虚地址空间可能是一维的连续空间，也可能是二维的非线性空间，这是存储器管理方式所决定的。而实地址空间总是一维线性的。"
                    }
                ]
            },
            "bbox": [
                174,
                718,
                847,
                789
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "程序运行过程中使用的地址都是虚地址，而程序加载到物理内存的实际地址往往与虚地址不同，因此虚地址不能直接用于访存。"
                    }
                ]
            },
            "bbox": [
                174,
                791,
                845,
                826
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "这个从虚地址映射到实际物理地址的地址转换功能称为地址映射，又称为地址重定位。"
                    }
                ]
            },
            "bbox": [
                174,
                829,
                840,
                845
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "这个过程应该由操作系统负责，这样程序员只需要关注指令、数据的逻辑地址"
                    }
                ]
            },
            "bbox": [
                174,
                848,
                781,
                864
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "程序运行过程中"
                    }
                ]
            },
            "bbox": [
                176,
                866,
                304,
                882
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "内存的共享和保护"
                    }
                ]
            },
            "bbox": [
                176,
                885,
                322,
                900
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "内存扩充"
                    }
                ]
            },
            "bbox": [
                179,
                93,
                253,
                108
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "32位机器的4GB限制主要指虚拟地址空间，这是程序能直接“看到”的最大范围。"
                    }
                ]
            },
            "bbox": [
                147,
                112,
                781,
                128
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "什么是内存"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                152,
                285,
                174
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "内存中保存代码的指令和相关数据"
                    }
                ]
            },
            "bbox": [
                147,
                218,
                416,
                233
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "根据物理地址"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                255,
                257,
                269
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/3b8846f257f288d43610b143b5f152649eb6709029c352d5b30dbee39017eedc.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                271,
                594,
                439
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "基于虚拟寻址"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                441,
                257,
                455
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/0f1f9f382779a43e0c29091c649e535542bc18dfac7225928bd5ac2bc897881f.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                456,
                552,
                625
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "CPU发出的地址是逻辑/虚拟地址"
                    }
                ]
            },
            "bbox": [
                176,
                645,
                433,
                659
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "但对于主存希望得到访存的地址依然是物理地址"
                    }
                ]
            },
            "bbox": [
                176,
                663,
                552,
                678
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "将虚拟地址转换成物理地址，翻译的部件叫做MMU 内存管理单元"
                    }
                ]
            },
            "bbox": [
                176,
                681,
                689,
                696
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "（虚拟）地址空间"
                    }
                ]
            },
            "bbox": [
                159,
                700,
                292,
                715
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "{0，1，2….}"
                    }
                ]
            },
            "bbox": [
                176,
                720,
                270,
                733
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "虚拟地址空间最大值，取决于虚拟地址的位数"
                    }
                ]
            },
            "bbox": [
                176,
                737,
                534,
                751
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "虚拟地址的位数取决于什么呢？"
                    }
                ]
            },
            "bbox": [
                176,
                756,
                420,
                770
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "处理器设计时定义了地址总线的位数（或虚拟地址的位数）。"
                    }
                ]
            },
            "bbox": [
                146,
                774,
                616,
                789
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "32 位机器通常指处理器具有 32 位的通用寄存器、数据总线和地址总线。"
                    }
                ]
            },
            "bbox": [
                176,
                793,
                727,
                808
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "32位机器（处理器），最大地址2^32-1"
                    }
                ]
            },
            "bbox": [
                176,
                812,
                485,
                826
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "物理地址空间大小 取决于内存的大小"
                    }
                ]
            },
            "bbox": [
                176,
                829,
                468,
                844
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "4G内存条——就有4G的内存空间"
                    }
                ]
            },
            "bbox": [
                176,
                848,
                443,
                863
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "但绝不是操作系统使用的就是 4GB（并不是最大支持 4GB）"
                    }
                ]
            },
            "bbox": [
                176,
                866,
                623,
                882
            ]
        }
    ],
    [
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/63375c2c6f0f6cf2e38b62f6d9d7236db03c07e0f1e3d92b626dedb591b8c785.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                178,
                89,
                818,
                304
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/edd06b543d92d2516f3b6a560e2e263477c7d62cf13019a07ed33e355db2e395.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                178,
                348,
                951,
                570
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "在编译的过程中会有虚拟地址的概念"
                    }
                ]
            },
            "bbox": [
                178,
                574,
                463,
                590
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "这是hello.o的反汇编，并没有赋予地址的概念"
                    }
                ]
            },
            "bbox": [
                178,
                593,
                537,
                608
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/712ba817af181eba81296371ffb828a8f278fcebaa0dfda34084a5758a35e9a4.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                181,
                609,
                959,
                744
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "然而 hello 的反汇编，赋予了地址"
                    }
                ]
            },
            "bbox": [
                176,
                760,
                438,
                776
            ]
        }
    ],
    [
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/8bcf53c8e6d83031127e5915dfee518e582520617eb66c9a852f422a049011a0.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                178,
                89,
                942,
                303
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "好像是一个地址对应一个字节 "
                    }
                ]
            },
            "bbox": [
                176,
                315,
                413,
                331
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "CPU 在执行这些指令，读写的都是虚拟地址"
                    }
                ]
            },
            "bbox": [
                176,
                334,
                517,
                350
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "0x200af5(%rip)，得到的是虚拟地址，还要经过 MMU 转换成物理地址"
                    }
                ]
            },
            "bbox": [
                176,
                351,
                710,
                368
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "我就不需要考虑 4G/8G 等等内存大小"
                    }
                ]
            },
            "bbox": [
                176,
                370,
                465,
                387
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "进程独占一个虚拟地址空间"
                    }
                ]
            },
            "bbox": [
                176,
                388,
                394,
                405
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/540f8a0fe415c230d4e8c455a965d73de52c4fd19b6fed10b71b7cf9af225bf2.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                178,
                423,
                657,
                715
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "程序的装入和链接"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                763,
                369,
                787
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如何把逻辑地址转换为物理地址？"
                    }
                ]
            },
            "bbox": [
                176,
                829,
                438,
                845
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "1、绝对装入"
                    }
                ]
            },
            "bbox": [
                236,
                848,
                346,
                863
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "在编译时，编译程序将产生绝对地址的目标代码，装入程序按照装入模块中的地址"
                    }
                ]
            },
            "bbox": [
                265,
                866,
                848,
                901
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "2、静态重定位"
                    }
                ],
                "level": 1
            },
            "bbox": [
                236,
                93,
                359,
                108
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "把地址重定位放在装入模块到内存的适当位置时不能移动位置"
                    }
                ]
            },
            "bbox": [
                267,
                111,
                643,
                145
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "3、动态重定位"
                    }
                ],
                "level": 1
            },
            "bbox": [
                238,
                149,
                359,
                164
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "重定位寄存器"
                    }
                ]
            },
            "bbox": [
                268,
                167,
                378,
                181
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "真正执行指令时，再将指令本身那个或指令中操作数的逻辑地址转换为物理地址"
                    }
                ]
            },
            "bbox": [
                267,
                185,
                847,
                219
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "允许程序在内存中发生移动"
                    }
                ]
            },
            "bbox": [
                268,
                223,
                485,
                237
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "需要一个数据结构将虚拟地址和物理地址对应关系"
                    }
                ]
            },
            "bbox": [
                176,
                241,
                569,
                256
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页表，放在内存里，记录虚拟页和物理页的映射关系"
                    }
                ]
            },
            "bbox": [
                176,
                260,
                586,
                275
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "内存空间的分配与回收"
                    }
                ]
            },
            "bbox": [
                178,
                279,
                359,
                294
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "从逻辑上对内存空间进行扩充"
                    }
                ]
            },
            "bbox": [
                178,
                297,
                411,
                312
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "负责逻辑地址和物理地址转换——三种装入方式页式存储/段式存储 动态重定位"
                    }
                ]
            },
            "bbox": [
                176,
                315,
                793,
                331
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "内存保护 设置上下限寄存器2、重定位寄存器（基址寄存器）和界地址寄存器（限长寄存器）进行越界检查"
                    }
                ]
            },
            "bbox": [
                176,
                334,
                848,
                368
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "重定位寄存器存放到时进程的实际物理地址"
                    }
                ]
            },
            "bbox": [
                176,
                370,
                517,
                387
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "界地址寄存器中存放的是最大物理地址"
                    }
                ]
            },
            "bbox": [
                176,
                390,
                482,
                405
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "连续存储器管理方式"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                485,
                394,
                508
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "-单一连续分区"
                    }
                ]
            },
            "bbox": [
                156,
                565,
                273,
                579
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "－固定分区"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "-动态分区"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "-分页存储管理"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "-分段存储管理"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "－段页式存储管理"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "-请求调页"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "-请求调段"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "-请求段页式"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                159,
                582,
                290,
                709
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "提高内存利用率"
                    }
                ]
            },
            "bbox": [
                319,
                595,
                423,
                608
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "方便用户"
                    }
                ]
            },
            "bbox": [
                319,
                631,
                379,
                644
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "既提高内存利用率，又方便用户"
                    }
                ]
            },
            "bbox": [
                317,
                650,
                517,
                662
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "逻辑上扩充内存，实现虚拟存储器方便用户运行大程序"
                    }
                ]
            },
            "bbox": [
                315,
                665,
                524,
                688
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "提高内存作业道数，从而进一步提高资源利用率"
                    }
                ]
            },
            "bbox": [
                315,
                688,
                524,
                706
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "单一连续分区"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                743,
                292,
                762
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "内存被分为系统区和用户区，内存中只能有一道用户程序"
                    }
                ]
            },
            "bbox": [
                176,
                803,
                623,
                818
            ]
        }
    ],
    [
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/0669ce2db670f7fd40801eeb76a2d9af007f5f36047f4dc1ba8c63b5e3530caf.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                186,
                93,
                571,
                382
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "固定分区"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                432,
                247,
                451
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "分区大小相等、分区大小不等"
                    }
                ]
            },
            "bbox": [
                176,
                492,
                413,
                508
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每个分区只装入一道程序"
                    }
                ]
            },
            "bbox": [
                176,
                510,
                376,
                526
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                213,
                565,
                326,
                583
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                213,
                611,
                326,
                627
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                213,
                659,
                326,
                676
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                213,
                708,
                326,
                725
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                213,
                757,
                326,
                772
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                208,
                794,
                329,
                826
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                408,
                565,
                521,
                583
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                411,
                596,
                515,
                612
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                411,
                617,
                515,
                633
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                411,
                640,
                515,
                657
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                413,
                673,
                515,
                689
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                413,
                711,
                515,
                728
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                408,
                757,
                522,
                772
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                403,
                794,
                524,
                826
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "操作系统需要建立一个数据结构一一分区说明表，来实现各个分区的分配与回收。每个表项对应一个分区，通常按分区大小排列。每个表项包括对应分区的"
                    }
                ]
            },
            "bbox": [
                196,
                99,
                625,
                133
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/d8e056f28713ec3df253c68cdbafb5a2201e82b043e4b051bee3f8aab7f5c562.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td>分区号</td><td>大小（MB）</td><td>起始地址（M）</td><td>状态</td></tr><tr><td>1</td><td>2</td><td>8</td><td>未分配</td></tr><tr><td>2</td><td>2</td><td>10</td><td>未分配</td></tr><tr><td>3</td><td>4</td><td>12</td><td>已分配</td></tr><tr><td>……</td><td>……</td><td>……</td><td>……</td></tr></table>",
                "table_type": "simple_table",
                "table_nest_level": 1
            },
            "bbox": [
                196,
                137,
                515,
                211
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/65a61958d5600cd2f778b223dc4a6e0ed28a6291f0f774303618e4e34c156704.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td>用数据结构的数组（或链表）即可表示这个表</td></tr></table>",
                "table_type": "simple_table",
                "table_nest_level": 1
            },
            "bbox": [
                519,
                137,
                618,
                190
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/e317733e953b7471e4936aa2f6bf92512921a9de8d4657ebc1bbc4e9726da32c.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                663,
                99,
                751,
                250
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "无外部碎片"
                    }
                ]
            },
            "bbox": [
                176,
                297,
                268,
                312
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "会产生内部碎片"
                    }
                ]
            },
            "bbox": [
                178,
                316,
                304,
                331
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "外部碎片：系统进行分区后产生的碎片"
                    }
                ]
            },
            "bbox": [
                176,
                334,
                480,
                349
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "内部碎片：进程无法将系统分配的分区全部使用"
                    }
                ]
            },
            "bbox": [
                176,
                353,
                549,
                368
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "分区分配表和相对应的分配回收算法实现"
                    }
                ]
            },
            "bbox": [
                176,
                407,
                499,
                423
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "可变分区方式"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                451,
                292,
                470
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "内部碎片，分配给某进程的内存区域中，如果有些部分没有用上。外部碎片，是指内存中的某些空闲分区由于太小而难以利用。"
                    }
                ]
            },
            "bbox": [
                159,
                532,
                433,
                558
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如果内存中空闲空间的总和本来可以满足某进程的要求，但由于进程需要的是一整块连续的内存空间，因此这些“碎片”不能满足进程的需求。"
                    }
                ]
            },
            "bbox": [
                159,
                565,
                396,
                590
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/40688033a28ed1803665d1a90aef68c13c64c365f494178a2eabe82b61858dfd.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                416,
                569,
                477,
                587
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/a0ce2cac787e0c174f7ef2d2399409fdd756a9263813f3bf841d305700f0905d.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                490,
                531,
                583,
                639
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "没有内部碎片，但是有外部碎片"
                    }
                ]
            },
            "bbox": [
                176,
                659,
                426,
                675
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "不会预先划分内存分区，而是在进程装入内存时，根据进程的大小动态地建立分区空闲分区表"
                    }
                ]
            },
            "bbox": [
                176,
                678,
                816,
                711
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "空闲分区链"
                    }
                ]
            },
            "bbox": [
                178,
                715,
                270,
                730
            ]
        }
    ],
    [
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/7e566e13b2fae9ebf74a3bfd7d92b6f86f2c618a0df689f8431301382c7fda3c.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                181,
                86,
                836,
                262
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                189,
                278,
                729,
                313
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "分配算法"
                    }
                ],
                "level": 1
            },
            "bbox": [
                176,
                351,
                253,
                368
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "1、 首次适应算法"
                    }
                ],
                "level": 1
            },
            "bbox": [
                176,
                370,
                319,
                387
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "空闲分区以地址递增的次序排列，每次分配内存时顺序查找空闲分区链，从第一个空闲分区开始查找，找到第一个可以满足需求的分区就进行必要的划分和分配"
                    }
                ]
            },
            "bbox": [
                206,
                388,
                847,
                423
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/822d54b72caac2432dcbd874cf86ca44ccc5c35a4dd98f32c63b88d8cc5d3ed2.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                211,
                424,
                591,
                543
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "2、最佳适应算法"
                    }
                ],
                "level": 1
            },
            "bbox": [
                176,
                556,
                319,
                571
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "为了保证当“大进程”到来时能有连续的大片空间，可以尽可能多地流线大片空闲区"
                    }
                ]
            },
            "bbox": [
                206,
                574,
                847,
                608
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如何实现：空闲分区按容量递增次序链接。每次分配内存时顺序查找空闲分区链"
                    }
                ]
            },
            "bbox": [
                206,
                611,
                830,
                627
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/c1113d02f0eb3480a1f5aeabd64b1da93cb0a3948abbbc8d175583c38e190602.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                211,
                644,
                776,
                809
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "容易产生外部碎片"
                    }
                ]
            },
            "bbox": [
                206,
                815,
                351,
                831
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "3、最坏适应算法"
                    }
                ],
                "level": 1
            },
            "bbox": [
                176,
                834,
                319,
                848
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "根据分区链中根据分区查找与请求相差最大的分区"
                    }
                ]
            },
            "bbox": [
                216,
                852,
                613,
                868
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "按容量递减的次序，找到大小能满足要求的一个空闲分区"
                    }
                ]
            },
            "bbox": [
                216,
                871,
                662,
                887
            ]
        }
    ],
    [
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/74fd9318c4797cda1212c24a9d9c6559b4db9d1c5728a1d41756012cdf1c7573.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                218,
                87,
                608,
                204
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "大进程到达，就没有内存分区可用了"
                    }
                ]
            },
            "bbox": [
                216,
                223,
                502,
                237
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "4、邻近适应算法"
                    }
                ],
                "level": 1
            },
            "bbox": [
                144,
                241,
                285,
                255
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "首次适应算法很想，每次都从上次查找结束的位置开始检索"
                    }
                ]
            },
            "bbox": [
                181,
                260,
                645,
                275
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "构造一个循环链表，每次分配内存时从上次查找的结束位置开始查找"
                    }
                ]
            },
            "bbox": [
                181,
                279,
                715,
                293
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/c7fb6945def852352906c1acaaee4075e7ff50131e4564998ae1edd9515dee9f.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                178,
                294,
                771,
                388
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "邻近适应算法无论低地址和高地址部分的空闲分区的概率使用，也就导致了无大分区可用"
                    }
                ]
            },
            "bbox": [
                146,
                388,
                838,
                406
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "回收算法"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                432,
                247,
                451
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1、 上邻接"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2、 下邻接"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "3、上下邻接 "
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "4、 无邻接"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                176,
                493,
                280,
                563
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "非连续的分配方式"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                702,
                339,
                722
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "将内存的物理空间和程序逻辑空间划分为大小相等的块。划分为大小和数量都固定的基本分区"
                    }
                ]
            },
            "bbox": [
                144,
                799,
                847,
                832
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "基本地址变换机构（用于实现逻辑地址到物理地址转换的一组硬件机构）"
                    }
                ]
            },
            "bbox": [
                144,
                835,
                705,
                851
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "分页存储管理的基本原理"
                    }
                ]
            },
            "bbox": [
                146,
                854,
                346,
                869
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "将物理内存划分成一块块（页）大小为4KB，叫做页框-页帧 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\cdot"
                    },
                    {
                        "type": "text",
                        "content": "内存块 "
                    },
                    {
                        "type": "equation_inline",
                        "content": ": = 1"
                    },
                    {
                        "type": "text",
                        "content": "物理块 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\cdot"
                    },
                    {
                        "type": "text",
                        "content": "物理页面"
                    }
                ]
            },
            "bbox": [
                144,
                873,
                813,
                889
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每个页框有一个编号，即“页框号” （页帧号 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\cdot"
                    },
                    {
                        "type": "text",
                        "content": "内存块号 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\mathop { : = }"
                    },
                    {
                        "type": "text",
                        "content": "物理块号 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\underline { { \\cdot } } = :"
                    },
                    {
                        "type": "text",
                        "content": "物理页号）"
                    }
                ]
            },
            "bbox": [
                144,
                93,
                754,
                109
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页框号从 0 开始"
                    }
                ]
            },
            "bbox": [
                146,
                112,
                273,
                127
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "将进程的逻辑地址空间也分为页框大小相等的一个个部分"
                    }
                ]
            },
            "bbox": [
                144,
                130,
                591,
                145
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每个部分称为一个“页”（页面），每个页面也有一个编号，即页号，页号从 0 开始"
                    }
                ]
            },
            "bbox": [
                144,
                148,
                801,
                164
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "操作系统以页框为单位为各个进程分配内存空间，进程的每个页面分别放入一个页框中。"
                    }
                ]
            },
            "bbox": [
                144,
                167,
                828,
                183
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "也就是说，进程的页面与内存的页框有一一对应的关系。"
                    }
                ]
            },
            "bbox": [
                146,
                186,
                581,
                200
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "不必连续存放，也无前后次序要求，只要求足够容纳所有的物理块即可。"
                    }
                ]
            },
            "bbox": [
                144,
                204,
                705,
                219
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "将进程的逻辑地址空间"
                    }
                ]
            },
            "bbox": [
                146,
                223,
                327,
                237
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "将物理地址空间也划分成一页页"
                    }
                ]
            },
            "bbox": [
                146,
                241,
                398,
                256
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "通常大小和虚拟地址空间一样"
                    }
                ]
            },
            "bbox": [
                146,
                260,
                381,
                275
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "物理地址空间的每一页也叫做页框"
                    }
                ]
            },
            "bbox": [
                146,
                279,
                416,
                293
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "在物理地址空间已有的部分是已缓存的 cache 的"
                    }
                ]
            },
            "bbox": [
                146,
                297,
                517,
                312
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "只要确定了每个页面的大小，逻辑地址结构就确定了。因此，页式管理中地址是一维的"
                    }
                ]
            },
            "bbox": [
                144,
                315,
                821,
                331
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Uncache 的，在磁盘上，还没在物理地址空间"
                    }
                ]
            },
            "bbox": [
                146,
                334,
                499,
                349
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Unallocated，在磁盘上也没有"
                    }
                ]
            },
            "bbox": [
                146,
                353,
                376,
                367
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/1c792a64dcf167d232d6189e3d58ba1128143ad5c43ea4546ebe9f91700d53d4.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                179,
                369,
                707,
                592
            ]
        }
    ],
    [
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/708cd01ccecbc4be7e950bce5ab44c1a0656e4b88e35c7207beec8727c597030.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                179,
                90,
                475,
                342
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "PTE 页表项 "
                    }
                ]
            },
            "bbox": [
                176,
                353,
                265,
                367
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "PTED0 valid "
                    },
                    {
                        "type": "equation_inline",
                        "content": "^ { = 1 }"
                    },
                    {
                        "type": "text",
                        "content": "虚拟页 0 已经缓存在物理内存 address，根据 address 来在物理内存获取数据"
                    }
                ]
            },
            "bbox": [
                174,
                370,
                848,
                405
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "equation_inline",
                        "content": "^ { = 0 }"
                    },
                    {
                        "type": "text",
                        "content": "，不在物理内存中，发生了缺页，进行缺页处理程序，从磁盘上调到虚拟内存里来"
                    }
                ]
            },
            "bbox": [
                147,
                407,
                806,
                424
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "虚拟虚拟，其实并不存在，存在的是物理页"
                    }
                ]
            },
            "bbox": [
                146,
                463,
                487,
                479
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/f474fcf5b78900a98b007443a9f771c077f8d3e2ad69a4f651a7c6698de87211.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                797,
                636,
                1000
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "分页系统的逻辑地址空间分为两部分：页号P和页内地址d（又称为页内偏移量）"
                    }
                ]
            },
            "bbox": [
                144,
                130,
                769,
                145
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页面的大小决定页内地址的位数，页号位数决定了逻辑地址空间中页面的总数。"
                    }
                ]
            },
            "bbox": [
                144,
                148,
                759,
                164
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页表——为了直到每个页面在内存中存放到位置，要为每个进程创建一个页表"
                    }
                ]
            },
            "bbox": [
                144,
                204,
                751,
                219
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "通常在PCB中"
                    }
                ]
            },
            "bbox": [
                146,
                223,
                257,
                237
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每一个页面对应一个页表项"
                    }
                ]
            },
            "bbox": [
                144,
                241,
                364,
                256
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每个页表项由页号和块号组成"
                    }
                ]
            },
            "bbox": [
                144,
                260,
                381,
                275
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页表记录进程页面和实际存放的内存块之间的映射关系"
                    }
                ]
            },
            "bbox": [
                144,
                279,
                574,
                293
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页表存储在内存中,只存储物理块号，页号不占用存储空间（因为是按页号是按顺序排列的，只有块号）"
                    }
                ]
            },
            "bbox": [
                144,
                297,
                855,
                331
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "然后将页表的起始地址及长度保存在进程的 PCB 中，当以后调度进程到 CPU 上运行时，再"
                    }
                ]
            },
            "bbox": [
                144,
                334,
                848,
                350
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "将 PCB 保存到页表起始地址及长度写入 CPU 的页表寄存器中"
                    }
                ]
            },
            "bbox": [
                144,
                353,
                611,
                368
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "虽然进程的各个页面是离散存放的，但是页面内部是连续存放的"
                    }
                ]
            },
            "bbox": [
                144,
                370,
                645,
                387
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如果要访问逻辑地址A，则"
                    }
                ]
            },
            "bbox": [
                159,
                397,
                396,
                413
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "equation_inline",
                                "content": "\\textcircled{1}"
                            },
                            {
                                "type": "text",
                                "content": "确定逻辑地址A对应的“页号”P？"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "equation_inline",
                                "content": "\\textcircled{2}"
                            },
                            {
                                "type": "text",
                                "content": "找到P号页面在两存中的起始地址（需要查页表）"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "equation_inline",
                                "content": "\\textcircled{3}"
                            },
                            {
                                "type": "text",
                                "content": "确定逻辑地址A的“页内偏移量”W？"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                159,
                414,
                598,
                464
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "逻辑地址A对应的物理地址=P号页面在内存中的起始地址+页内偏移量W"
                    }
                ]
            },
            "bbox": [
                159,
                481,
                789,
                499
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如何计算："
                    }
                ]
            },
            "bbox": [
                166,
                533,
                272,
                552
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页号=逻辑地址/页面长度（取除法的整数部分）"
                    }
                ]
            },
            "bbox": [
                166,
                554,
                665,
                573
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页内偏移量 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\equiv"
                    },
                    {
                        "type": "text",
                        "content": "逻辑地址%页面长度（取除法的余数部分）"
                    }
                ]
            },
            "bbox": [
                166,
                574,
                737,
                593
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页号=110/50=2 "
                    }
                ]
            },
            "bbox": [
                166,
                613,
                352,
                631
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页内偏移量=110%50=10 "
                    }
                ]
            },
            "bbox": [
                166,
                633,
                440,
                651
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "逻辑地址可以拆分为（页号，页内偏移量）"
                    }
                ]
            },
            "bbox": [
                166,
                671,
                601,
                690
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页号=逻辑地址/页面长度（取除法的整数部分）"
                    }
                ]
            },
            "bbox": [
                173,
                734,
                490,
                746
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页内偏移量 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "="
                    },
                    {
                        "type": "text",
                        "content": "逻辑地址 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\%"
                    },
                    {
                        "type": "text",
                        "content": "页面长度（取除法的余数部分）"
                    }
                ]
            },
            "bbox": [
                173,
                747,
                534,
                759
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "在计算机内部，地址是用二进制表示的，如果页面大小刚好是2的整数幂，则计算机硬件可以很快速的把逻辑地址拆分成（页号，页内偏移量）"
                    }
                ]
            },
            "bbox": [
                581,
                719,
                836,
                768
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "假设某计算机用32个二进制位表示逻辑地址，页面大小为4KB=212B=4096B"
                    }
                ]
            },
            "bbox": [
                171,
                772,
                662,
                785
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "0号页的逻辑地址范围应该是 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "0 \\sim 4 0 9 5"
                    },
                    {
                        "type": "text",
                        "content": "，用二进制表示应该是："
                    }
                ]
            },
            "bbox": [
                171,
                796,
                557,
                809
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "00000000000000000000000000000000~00000000000000000000111111111111 "
                    }
                ]
            },
            "bbox": [
                173,
                810,
                662,
                822
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "1号页的逻辑地址范围应该是4096~8191，用二进制表示应该是："
                    }
                ]
            },
            "bbox": [
                171,
                834,
                579,
                846
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "00000000000000000001000000000000~000000000000000000011111111111 "
                    }
                ]
            },
            "bbox": [
                173,
                847,
                662,
                859
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "2号页的逻辑地址范围应该是8192~12287，用二进制表示应该是："
                    }
                ]
            },
            "bbox": [
                171,
                870,
                586,
                884
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "结论：如果每个页面大小为2B，用二进制数表示逻辑地址，则末尾K位即为页内偏移量，其余部分就是页号"
                    }
                ]
            },
            "bbox": [
                697,
                800,
                833,
                873
            ]
        }
    ],
    [
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "0号内存块的起始物理地址是00000000000000000000000000000000"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1号内存块的起始物理地址是00000000000000000001000000000000"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2号内存块的起始物理地址是00000000000000000010000000000000"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "3号内存块的起始物理地址是00000000000000011000000000000"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                173,
                101,
                840,
                177
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "根据页号可"
                    }
                ]
            },
            "bbox": [
                875,
                120,
                1000,
                137
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "只是内存块"
                    }
                ]
            },
            "bbox": [
                877,
                139,
                998,
                156
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                875,
                159,
                1000,
                177
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "假设通过查询页表得知1号页面存放的内存块号是9（1001），则"
                    }
                ]
            },
            "bbox": [
                169,
                197,
                821,
                217
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "9号内存块的起始地址=9*4096=00000000000000001001000000000000 "
                    }
                ]
            },
            "bbox": [
                174,
                219,
                880,
                235
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "则逻辑地址4097对应的物理地址 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\Bumpeq"
                    },
                    {
                        "type": "text",
                        "content": "页面在内存中存放的起始地址+页内偏移量"
                    }
                ]
            },
            "bbox": [
                174,
                236,
                954,
                255
            ]
        },
        {
            "type": "equation_interline",
            "content": {
                "math_content": "= (0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1)",
                "math_type": "latex",
                "image_source": {
                    "path": "images/1b4dca60aa60177368c744ad70d4dc8de47ef809b5c3b3b990089360880d7416.jpg"
                }
            },
            "bbox": [
                174,
                258,
                594,
                274
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/9488dc88fc8b493469d686ed8eaf52ffdbcb36e916fadae4ef5feaa84211bb6a.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td>31</td><td>......</td><td>12</td><td>11</td><td>......</td><td>0</td></tr><tr><td>页号P</td><td></td><td></td><td colspan=\"3\">页内偏移量W</td></tr></table>",
                "table_type": "complex_table",
                "table_nest_level": 1
            },
            "bbox": [
                173,
                318,
                594,
                349
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "地址结构包含两个部分：前一部分为页号，后一部分为页内偏移量W。在上图所示的例子中，地址长度为32位，其中0~11位为“页内偏移量”，或称“页内地址”； "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\pmb { 1 2 \\sim 3 1 }"
                    },
                    {
                        "type": "text",
                        "content": "位为“页号”"
                    }
                ]
            },
            "bbox": [
                171,
                354,
                685,
                376
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如果有K位表示“页内偏移量”，则说明该系统中一个页面的大小是2K个内存单元如果有M位表示“页号”，则说明在该系统中，一个进程最多允许有 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "2 ^ { M }"
                    },
                    {
                        "type": "text",
                        "content": "个页面 "
                    }
                ]
            },
            "bbox": [
                171,
                385,
                605,
                407
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "重要重要重要！！！"
                    }
                ]
            },
            "bbox": [
                571,
                413,
                727,
                445
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "→逻辑地址结构"
                    }
                ]
            },
            "bbox": [
                633,
                498,
                722,
                505
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Tips：有些奇葩题目中页面大小有可能不是2的整数次幂，这种情况还是得用最原始的方法计算页号=逻辑地址/页面长度（取除法的整数部分）页内偏移量=逻辑地址%页面长度（取除法的余数部分）"
                    }
                ]
            },
            "bbox": [
                181,
                523,
                734,
                558
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/46f240890524dd3498cfef4a2215200a1660bdf31c46f97a0975cd74b08d60b7.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                571,
                784,
                706
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "VP0:根据虚拟页大小4KB，长度为12位，页内地址 "
                    }
                ]
            },
            "bbox": [
                144,
                778,
                539,
                795
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "在一个页4kb中的起始位置"
                    }
                ]
            },
            "bbox": [
                147,
                797,
                359,
                812
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "虚拟页根据地址位数，32位， "
                    },
                    {
                        "type": "equation_inline",
                        "content": "3 2 - 1 2 = 2 0"
                    },
                    {
                        "type": "text",
                        "content": "位，虚拟页号20位，有 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "2 \\sim 2 0"
                    },
                    {
                        "type": "text",
                        "content": "个虚拟页。"
                    }
                ]
            },
            "bbox": [
                144,
                816,
                759,
                832
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "分页系统的逻辑地址空间是一维线性地址空间"
                    }
                ]
            },
            "bbox": [
                147,
                834,
                505,
                850
            ]
        },
        {
            "type": "page_header",
            "content": {
                "page_header_content": [
                    {
                        "type": "text",
                        "content": "假议物理地址也用z|二进制位衣小，则田了内行块的八小-贝面八小，四此："
                    }
                ]
            },
            "bbox": [
                173,
                87,
                952,
                99
            ]
        }
    ],
    [
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/e99b55c3875ed3086ad6fd2cddc782a0ffc65bf75ee83c6c2989e2ba98eb733a.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                89,
                794,
                319
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/e20d89493123eb894f1a342b85e81adb13ed0ddb2a6d7bfea940c764c69a6bc8.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                178,
                328,
                917,
                612
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "注意：页面大小是2的整数幂"
                    }
                ]
            },
            "bbox": [
                163,
                637,
                455,
                655
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "设页面大小为L，逻辑地址A到物理地址E的变换过程如下："
                    }
                ]
            },
            "bbox": [
                164,
                657,
                739,
                674
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "equation_inline",
                                "content": "\\textcircled{1}"
                            },
                            {
                                "type": "text",
                                "content": "计算页号P和页内偏移量W（如果用十进制数手算，则P=A/L，W=A%L；但是在运行时，逻辑地址结构是固定不变的，因此计算机硬件可以更快地得到二进制表示内偏移量）"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "equation_inline",
                                "content": "\\textcircled{2}"
                            },
                            {
                                "type": "text",
                                "content": "比较页号P和页表长度M，若P≥M，则产生越界中断，否则继续执行。（注意：页始的，而页表长度至少是1，因此P=M时也会越界）"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "equation_inline",
                                "content": "\\textcircled{3}"
                            },
                            {
                                "type": "text",
                                "content": "页表中页号P对应的页表项地址=页表起始地址F+页号P*页表项长度，取出该页即为内存块号。（注意区分页表项长度、页表长度、页面大小的区别。页表长度指表中总共有几个页表项，即总共有几个页；页表项长度指的是每个页表项占多大的页面大小指的是一个页面占多大的存储空间）"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "equation_inline",
                                "content": "\\textcircled{4}"
                            },
                            {
                                "type": "text",
                                "content": "计算E=b*L+W，用得到的物理地址E去访存。（如果内存块号、页面偏移量是示的，那么把二者拼接起来就是最终的物理地址了）"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                161,
                677,
                996,
                889
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "手验证：假设贝 L=1K访问的内存块号b=2，页内偏移量W=1023"
                    }
                ]
            },
            "bbox": [
                147,
                143,
                697,
                187
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": []
            },
            "bbox": [
                147,
                190,
                682,
                263
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "对比①②的结果是否一致"
                    }
                ]
            },
            "bbox": [
                149,
                266,
                473,
                286
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/b6493ff53111f4f2219db9b697061852e43762a1e4f672751e8f347e8c54f294.jpg"
                },
                "image_caption": [
                    {
                        "type": "text",
                        "content": "Eg：假设某系统物理内存大小为4GB，页面大小为4KB，则每个页表项至少应该为多少字节？"
                    }
                ],
                "image_footnote": []
            },
            "bbox": [
                181,
                293,
                682,
                405
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "内存块大小=页面大小=4KB=212B "
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "→4GB的内存总共会被分为 "
                            },
                            {
                                "type": "equation_inline",
                                "content": "2 ^ { 3 2 } / 2 ^ { 1 2 } = 2 ^ { 2 0 }"
                            },
                            {
                                "type": "text",
                                "content": "个内存块 "
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "→内存块号的范围应该是 "
                            },
                            {
                                "type": "equation_inline",
                                "content": "0 \\sim 2 ^ { 2 0 }"
                            },
                            {
                                "type": "text",
                                "content": "-1"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "→内存块号至少要用20bit来表示"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": ">至小票用2B来表元地号（2*8-24h*） "
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                147,
                432,
                394,
                478
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [],
                "level": 1
            },
            "bbox": [
                206,
                518,
                623,
                535
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Eg：假设某系统物理内存大小为4GB，页面大小为4KB，的内存总共会被分为 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "2 ^ { 3 2 }"
                    },
                    {
                        "type": "text",
                        "content": "/212=220个内存块，因此内存块号的范围应该是0~220-1"
                    }
                ]
            },
            "bbox": [
                203,
                552,
                910,
                583
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "因此至少要20个二进制位才能表示这么多的内存块号，因此至少要3个字节才够（每个字节8个二进制位，3个字节共24个二进制位）"
                    }
                ]
            },
            "bbox": [
                203,
                586,
                902,
                619
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/cd5dc82048ee76aa45140d307251ed0e594f19d815054df01efb60d9bd88b99e.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td>页号</td><td>块号</td></tr><tr><td>0</td><td>3字节</td></tr><tr><td>1</td><td>3字节</td></tr><tr><td>……</td><td>3字节</td></tr><tr><td>n</td><td>3字节</td></tr></table>",
                "table_type": "simple_table",
                "table_nest_level": 1
            },
            "bbox": [
                194,
                633,
                366,
                746
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "各页表项会按顺序连续地存放在内存中如果该页表在内存中存放的起始地址为X，则M号页对应的页表项是存放在内存地址为 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "x + 3 ^ { * } M"
                    }
                ]
            },
            "bbox": [
                408,
                634,
                840,
                684
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "一个页面为4KB，则每个页框可以存放4096/3=1365个页表项，但是这个页框会剩余4096%3=1B页内碎片因此，1365号页表项存放的地址为X+3*1365+1如果每个页表项占4字节，则每个页框刚好可存放1024个页表项 "
                    }
                ]
            },
            "bbox": [
                403,
                689,
                880,
                772
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页表项时连续地存放在内存中！"
                    }
                ]
            },
            "bbox": [
                144,
                852,
                388,
                868
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "理论上来说，3B即可表示内存块号的范围"
                    }
                ]
            },
            "bbox": [
                144,
                871,
                473,
                887
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "但是为了方便页表的查询，常常让每个页面恰好可以装得下整数个页表项"
                    }
                ]
            },
            "bbox": [
                144,
                889,
                715,
                904
            ]
        },
        {
            "type": "page_aside_text",
            "content": {
                "page_aside_text_content": [
                    {
                        "type": "text",
                        "content": "剩余1B "
                    }
                ]
            },
            "bbox": [
                897,
                683,
                964,
                700
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "物理内存大小为 4GB，页面大小为 4KB"
                    }
                ]
            },
            "bbox": [
                146,
                130,
                445,
                145
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "内存块大小 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\backprime ="
                    },
                    {
                        "type": "text",
                        "content": "页面大小 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\scriptstyle \\mathtt { \\backslash = 4 K B }"
                    }
                ]
            },
            "bbox": [
                147,
                149,
                356,
                162
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "内存一共有 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "2 \\sim 2 0"
                    },
                    {
                        "type": "text",
                        "content": "内存块"
                    }
                ]
            },
            "bbox": [
                147,
                168,
                334,
                181
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "由于以字节编址，24bit"
                    }
                ]
            },
            "bbox": [
                147,
                186,
                329,
                200
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "至少要用24位（3B）来表示块号"
                    }
                ]
            },
            "bbox": [
                147,
                205,
                405,
                219
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "虚拟页偏移量 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\cdot = :"
                    },
                    {
                        "type": "text",
                        "content": "物理页偏移量"
                    }
                ]
            },
            "bbox": [
                146,
                260,
                371,
                275
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如何快速找到页表？"
                    }
                ]
            },
            "bbox": [
                147,
                279,
                300,
                293
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页表基址寄存器"
                    }
                ]
            },
            "bbox": [
                147,
                297,
                275,
                312
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每个页表项大小相同，4B "
                    }
                ]
            },
            "bbox": [
                147,
                316,
                346,
                331
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页表项是顺序的，0-n"
                    }
                ]
            },
            "bbox": [
                147,
                335,
                315,
                349
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "假设虚拟地址32位"
                    }
                ]
            },
            "bbox": [
                147,
                353,
                299,
                367
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "虚拟页大小是 4KB（即页内偏移量为 12 位）"
                    }
                ]
            },
            "bbox": [
                147,
                370,
                478,
                386
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "有多少个虚拟页？ "
                    },
                    {
                        "type": "equation_inline",
                        "content": "2 { \\stackrel { \\wedge } { 3 } } 2 / 2 { \\stackrel { \\wedge } { \\sim } } 1 2 { = } 2 { \\stackrel { \\wedge } { 2 } } 0"
                    },
                    {
                        "type": "text",
                        "content": ",即 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "2 \\sim 2 0"
                    },
                    {
                        "type": "text",
                        "content": "个虚拟页"
                    }
                ]
            },
            "bbox": [
                147,
                390,
                549,
                404
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每一个虚拟页就有一个虚拟页号"
                    }
                ]
            },
            "bbox": [
                147,
                407,
                396,
                423
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "再假设每一个页表项4B"
                    }
                ]
            },
            "bbox": [
                147,
                426,
                332,
                441
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "那么就有 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "2 ^ { \\land } 2 0 { \\times } 4 \\mathsf { B }"
                    },
                    {
                        "type": "text",
                        "content": "即占4MB大小"
                    }
                ]
            },
            "bbox": [
                147,
                445,
                401,
                460
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每一个进程都有一个独立的页表（4MB）"
                    }
                ]
            },
            "bbox": [
                147,
                464,
                455,
                478
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页表占用了大量的内存空间 "
                    }
                ]
            },
            "bbox": [
                147,
                483,
                361,
                497
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/792d7b31e8f9a910bb7f2d00908e14abf865d4dd9946d6dacbc0bababa61194e.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                498,
                902,
                790
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                218,
                96,
                510,
                112
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "设页面大小为L，逻辑地址A到物理地址E的变换过程如下："
                    }
                ]
            },
            "bbox": [
                218,
                116,
                791,
                133
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "equation_inline",
                                "content": "\\textcircled{1}"
                            },
                            {
                                "type": "text",
                                "content": "计算页号P和页内偏移量W（如果用十进制数手算，则P=A/L，W=A%L；但运行时，逻辑地址结构是固定不变的，因此计算机硬件可以更快地得到二进制内偏移量）"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "②比较页号P和页表长度M，若P≥M，则产生越界中断，否则继续执行。（注始的，而页表长度至少是1，因此P=M时也会越界）"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "equation_inline",
                                "content": "\\textcircled{3}"
                            },
                            {
                                "type": "text",
                                "content": "页表中页号P对应的页表项地址 "
                            },
                            {
                                "type": "equation_inline",
                                "content": "\\mathbf { \\varepsilon } = \\mathbf { \\varepsilon }"
                            },
                            {
                                "type": "text",
                                "content": "页表起始地址F+页号P*页表项长度，取即为内存块号。（注意区分页表项长度、页表长度、页面大小的区别。页表长表中总共有几个页表项，即总共有几个页；页表项长度指的是每个页表项占多页面大小指的是一个页面占多大的存储空间）"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "equation_inline",
                                "content": "\\textcircled{4}"
                            },
                            {
                                "type": "text",
                                "content": "计算E=b*L+W，用得到的物理地址E去访存。（如果内存块号、页面偏移示的，那么把二者拼接起来就是最终的物理地址了）"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                216,
                135,
                1000,
                350
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "快表 TLB"
                    }
                ],
                "level": 1
            },
            "bbox": [
                144,
                370,
                216,
                386
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "不是内存，是一种高速缓存"
                    }
                ]
            },
            "bbox": [
                144,
                388,
                364,
                405
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "与此对应，内存中的页表常称为慢表"
                    }
                ]
            },
            "bbox": [
                146,
                407,
                433,
                424
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "用来存放最近访问的页表项的副本"
                    }
                ]
            },
            "bbox": [
                146,
                426,
                416,
                442
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/67a846eab25a2bfd9a264119147a3dfe6c3f53c4162c27ac69fa1448ef352b8c.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                152,
                443,
                751,
                697
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "equation_inline",
                                "content": "\\textcircled{1}"
                            },
                            {
                                "type": "text",
                                "content": "CPU给出逻辑地址，由某个硬件算得页号、页内偏移量，将页号与快表中的所有页号进行比较。"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "equation_inline",
                                "content": "\\textcircled{2}"
                            },
                            {
                                "type": "text",
                                "content": "如果找到匹配的页号，说明要访问的页表项在快表中有副本，则直接从中取出该页对应的内存块号，再将内存块号与页内偏移量拼接形成物理地址，最后，访问该物理地址对应的内存单元。因此，若快表命中，则访问某个逻辑地址仅需一次访存即可。"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "equation_inline",
                                "content": "\\textcircled{3}"
                            },
                            {
                                "type": "text",
                                "content": "如果没有找到匹配的页号，则需要访问内存中的页表，找到对应页表项，得到页面存放的内存块号，再将内存块号与页内偏移量拼接形成物理地址，最后，访问该物理地址对应的内存单元。因此，若快表未命中，则访问某个逻辑地址需要两次访存（注意：在找到页表项后，应同时将其存入快表，以便后面可能的再次访问。但若快表已满，则必须按照一定的算法对旧的页表项进行替换）"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                152,
                703,
                764,
                801
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "由于查询快表的速度比查询页表的速度快很多，因此只要快表命中，就可以节省很多时间。"
                    }
                ]
            },
            "bbox": [
                154,
                810,
                710,
                824
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                156,
                824,
                519,
                831
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "equation_inline",
                        "content": "\\mathbf { \\equiv } ="
                    },
                    {
                        "type": "text",
                        "content": "SOUna "
                    }
                ]
            },
            "bbox": [
                152,
                105,
                557,
                118
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                154,
                118,
                208,
                129
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "血密长回时返本期该（J+JO0）*0+（JO0+J0）*0"
                    }
                ]
            },
            "bbox": [
                154,
                131,
                769,
                143
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "（J+JOO)*O'a+（J+JOO+JOO）*OJ=JJJn2"
                    }
                ]
            },
            "bbox": [
                154,
                143,
                411,
                155
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                154,
                155,
                742,
                164
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "问一次内存耗时100us。若快表的命中率为 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "90 \\%"
                    },
                    {
                        "type": "text",
                        "content": "，那么访问一个逻辑地址的平均耒"
                    }
                ]
            },
            "bbox": [
                189,
                166,
                1000,
                184
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "（1+100）*0.9+（1+100+100）*0.1=111us"
                    }
                ]
            },
            "bbox": [
                189,
                187,
                594,
                206
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "局部性原理"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                241,
                240,
                256
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "局部性原理"
                    }
                ],
                "level": 1
            },
            "bbox": [
                436,
                263,
                522,
                275
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "equation_inline",
                        "content": "\\dot { 1 } = 0"
                    },
                    {
                        "type": "text",
                        "content": "；"
                    }
                ]
            },
            "bbox": [
                242,
                288,
                317,
                299
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "int a[100];"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "while "
                            },
                            {
                                "type": "equation_inline",
                                "content": "\\dot { \\mathrm { ~ \\scriptsize ~ 1 ~ } } < \\mathrm { ~ \\scriptsize ~ 1 0 0 ~ }"
                            },
                            {
                                "type": "text",
                                "content": "）{"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "a[i] "
                            },
                            {
                                "type": "equation_inline",
                                "content": "\\mathbf { \\mu } = \\mathbf { \\mu } _ { \\mathrm { ~ i ~ } }"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "i++; "
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                243,
                300,
                369,
                349
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "这个程序执行时，"
                    }
                ]
            },
            "bbox": [
                415,
                300,
                505,
                312
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "会很频繁地访问10"
                    }
                ]
            },
            "bbox": [
                416,
                313,
                515,
                322
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "号页面、23号页面"
                    }
                ]
            },
            "bbox": [
                416,
                323,
                512,
                332
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "时间局部性：如果执行了程序中的某条指令，那么不久后这条指令很有可能再次执行：如果某个数据被访问过不久之后该数据很可能再次被访问。 (因为程序中存在大量的循环）"
                    }
                ]
            },
            "bbox": [
                243,
                368,
                600,
                398
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "空间局部性：一旦程序访问了某个存储单元，在不久之后，其附近的存储单元也很有可能被访问。（因为很多数据在内存中都是连续存放的）"
                    }
                ]
            },
            "bbox": [
                243,
                399,
                600,
                429
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                633,
                325,
                707,
                335
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                650,
                336,
                689,
                344
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                633,
                382,
                705,
                392
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                647,
                393,
                695,
                401
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "10号页面"
                    }
                ]
            },
            "bbox": [
                717,
                315,
                768,
                326
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                705,
                326,
                717,
                336
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                714,
                337,
                719,
                344
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "23号页面"
                    }
                ]
            },
            "bbox": [
                717,
                374,
                766,
                384
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "内存"
                    }
                ]
            },
            "bbox": [
                655,
                448,
                682,
                458
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "因此我们要建立多级页表，减少内存存储页表的空间"
                    }
                ]
            },
            "bbox": [
                144,
                463,
                556,
                478
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "多级页表"
                    }
                ]
            },
            "bbox": [
                146,
                482,
                221,
                497
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "采用两级页表的形式"
                    }
                ]
            },
            "bbox": [
                146,
                501,
                310,
                516
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页表是连续存放在进程当中"
                    }
                ]
            },
            "bbox": [
                146,
                519,
                361,
                535
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                191,
                544,
                989,
                563
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "问题二：没有必要让整个页表常驻内存，因为进程在一段时间内可能只需要访问"
                    }
                ]
            },
            "bbox": [
                194,
                565,
                1000,
                583
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "因此，我们可以参照进程在内存中必须连续存储的问题，我们通过了页号 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "^ +"
                    },
                    {
                        "type": "text",
                        "content": "页内偏移量+页表的机制"
                    }
                ]
            },
            "bbox": [
                144,
                629,
                848,
                664
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "同样的可以解决页表必须连续存放的问题，把必须连续存放的页表再分页"
                    }
                ]
            },
            "bbox": [
                144,
                667,
                717,
                683
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "如页面大小4KB，每个表项4B，每个页面可以存放 1K个页表项，因此每1K个连续的页表"
                    }
                ]
            },
            "bbox": [
                144,
                686,
                847,
                702
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "项为一组，每组刚好占一个内存块，再将各组离散地存放到各个内存块中"
                    }
                ]
            },
            "bbox": [
                144,
                705,
                715,
                720
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "要为离散分配的页表再建立一张页表，称为页目录表，或称外层页表、顶层页表"
                    }
                ]
            },
            "bbox": [
                144,
                722,
                769,
                739
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/877c67addde41f1beb57c9ffe1f2b6f7c4c82a1420b83fb9f09363a7f4d337a2.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td>页目录号</td><td>页号</td><td>页偏移量</td></tr><tr><td>10</td><td>10</td><td>12</td></tr></table>",
                "table_type": "simple_table",
                "table_nest_level": 1
            },
            "bbox": [
                149,
                756,
                667,
                834
            ]
        }
    ],
    [
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/1781acdb448947c188a6a96822ad6da1b9ffc36a91df4ba21a268a902afec981.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                176,
                99,
                821,
                395
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/718a2bde7c40064cac64d193bd0ebace8566aed38d90311dcd2976b0c382647c.jpg"
                },
                "image_caption": [
                    {
                        "type": "text",
                        "content": "一个页面可以存放 1024 个页表"
                    },
                    {
                        "type": "text",
                        "content": "就要为这些小页表再建立一个表，叫做页目录表"
                    }
                ],
                "image_footnote": []
            },
            "bbox": [
                157,
                443,
                937,
                714
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "10 位一级页号表示一共有多少个页面来存放每个小页表项（ "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\scriptstyle \\left( 2 \\land 2 2 \\mathsf { B } / 2 \\land 1 2 \\mathsf { B } = 1 0 2 4 \\right)"
                    }
                ]
            },
            "bbox": [
                144,
                778,
                761,
                795
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "10 位二级页号表示每个页面（4KB）可以存放多少个页表项（ "
                    },
                    {
                        "type": "equation_inline",
                        "content": "( 4 \\mathsf { K B } / 4 \\mathsf { B } = 1 0 2 4 )"
                    },
                    {
                        "type": "text",
                        "content": "）"
                    }
                ]
            },
            "bbox": [
                146,
                797,
                729,
                813
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "一共加起来20位表示一共可以有多少个页表"
                    }
                ]
            },
            "bbox": [
                146,
                816,
                494,
                831
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "小页表叫做二级页表"
                    }
                ]
            },
            "bbox": [
                146,
                834,
                310,
                848
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页目录号：表示 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "0 { - } 2 ^ { \\wedge } 1 0 { - } 1"
                    }
                ]
            },
            "bbox": [
                146,
                853,
                342,
                868
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页目录号对应页目录项（页表项的一种）"
                    }
                ]
            },
            "bbox": [
                146,
                871,
                457,
                887
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每一个页目录号可以寻址一个二级的页表"
                    }
                ]
            },
            "bbox": [
                146,
                890,
                468,
                904
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "0-2^10-1 个 "
                    }
                ]
            },
            "bbox": [
                144,
                93,
                236,
                108
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每一页是 4KB(页偏移量 12 位)，一个页表项最多有 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "2 { \\sim } 1 0"
                    },
                    {
                        "type": "text",
                        "content": "个，即最多占用的物理内存为 4MB"
                    }
                ]
            },
            "bbox": [
                144,
                111,
                845,
                128
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/b32f807a608b1d2fdbe6f4a3595f123cb97f2c21355da9a304e48ea798197da4.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                130,
                675,
                368
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/35664f02c0b9223ecfe42c7af170d5a65c180ff0f0eba55769e14150894b7804.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                193,
                370,
                897,
                436
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "两级页"
                    }
                ]
            },
            "bbox": [
                909,
                392,
                1000,
                426
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "例：将逻辑地址（0000000000,0000000001,111111111111)转换为物理地址（用十进制表示）。"
                    }
                ]
            },
            "bbox": [
                200,
                441,
                1000,
                458
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/d02a03dcfedfa00bad157ca817e9c012d7c493283fce3f9fbe98d6b34bbcc038.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                169,
                489,
                905,
                724
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "而一共有 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "2 { \\sim } 1 0"
                    },
                    {
                        "type": "text",
                        "content": "个页目录项，共有 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "4 \\mathsf { M B } \\times 2 \\sp { \\wedge } 1 0 { = } 4 \\mathsf { G B }"
                    },
                    {
                        "type": "text",
                        "content": "则可以通过来记录整个虚拟内存4GB的映射关系。"
                    }
                ]
            },
            "bbox": [
                144,
                741,
                529,
                776
            ]
        }
    ],
    [
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/c38d804a0a0ab7925b28e0310516f15ad4653dc32b3b899f6d4c91f384fbaca2.jpg"
                },
                "image_caption": [
                    {
                        "type": "text",
                        "content": "48位的虚拟地址"
                    }
                ],
                "image_footnote": []
            },
            "bbox": [
                147,
                90,
                816,
                318
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "对于问题二，可以在需要访问页面时才把也秒调入内存（虚拟存储技术）"
                    }
                ]
            },
            "bbox": [
                144,
                370,
                705,
                387
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "属于内中断"
                    }
                ]
            },
            "bbox": [
                147,
                388,
                240,
                405
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                166,
                407,
                1000,
                426
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                287,
                445,
                863,
                481
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/ba3a9181a77f5d94e321e63c0281105aa74389120b245109a687f0d7554da17d.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                159,
                495,
                386,
                636
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/925e430df51712ffaefba5039a607ba49015a37cb21fba5117375b06bc545244.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                502,
                497,
                719,
                629
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                248,
                642,
                529,
                693
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "可以在页表项中增加一个标志位，表示该页面是否已经调入内存"
                    }
                ]
            },
            "bbox": [
                146,
                703,
                645,
                720
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "7. 没有快表时访问一个数据需要访问内存的次数"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                722,
                524,
                739
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "– 1 次（连续分配）"
                    }
                ]
            },
            "bbox": [
                147,
                741,
                290,
                758
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "HDU 编程营：936217564"
                    }
                ]
            },
            "bbox": [
                147,
                760,
                339,
                776
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "6/16/21 "
                    }
                ]
            },
            "bbox": [
                147,
                778,
                211,
                793
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "万物皆有裂痕，那是光进来的地方。"
                    }
                ]
            },
            "bbox": [
                146,
                797,
                423,
                813
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "8– 2 次（一级分页存储管理、分段存储管理）"
                    }
                ]
            },
            "bbox": [
                146,
                816,
                492,
                832
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "– 3 次（二级分页存储管理、段页式存储管理）"
                    }
                ]
            },
            "bbox": [
                147,
                834,
                500,
                850
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "8. 动态分区分配"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                853,
                275,
                868
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "– 首次适应算法（空闲区按起始地址递增的次序拉链）"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "– 最佳适应算法（空闲区按分区大小递增的次序拉链）"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                146,
                871,
                559,
                904
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/c91a66bf47059babbb2adfc53e4b7af3883bb28bb8c166ea68de651172fd4e8c.jpg"
                },
                "image_caption": [
                    {
                        "type": "text",
                        "content": "内存"
                    }
                ],
                "image_footnote": []
            },
            "bbox": [
                858,
                495,
                1000,
                678
            ]
        }
    ],
    [
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "– 回收时要进行分区的合并（具体有前后都没有空闲分区、只是前面有空闲区、只是后面有空闲区、前后都是空闲区这四种情况）"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "– 碎片问题可采用紧凑技术加以解决 "
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "– 采用紧凑技术后的动态分区分配方式也叫可重定位分区分配方式（因为它需要得到动态重定位技术的支持）"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                144,
                93,
                798,
                181
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "9. 对换"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                186,
                205,
                200
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "– 所谓“对换”，是指把内存中暂时不能运行的进程或暂时不用的程序或数据，调出到外存上，以便腾出足够的内存空间，再把具备运行条件的进程或进程所需要的程序和数据，调入内存。"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "– 整体对换：以进程为单位的对换。（但进程的 PCB 常驻内存不应该被换出；进程的程序段如果正在被其他进程共享，也不应该被换出内存）"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "– 部分对换：以“页”或“段”为单位的对换"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                144,
                204,
                800,
                312
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "请求调页"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                334,
                221,
                350
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "一种选择，在程序执行时将整个程序加载到物理内存问题是，最初可能不需要整个程序都处于内存"
                    }
                ]
            },
            "bbox": [
                193,
                357,
                709,
                401
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "仅在需要时才加载页面，这种技术被称为请求调页对于请求调页的虚拟内存，页面只有在程序执行期间被请求时才被加载。因此，从未访问的页从不加载到物理内存中。"
                    }
                ]
            },
            "bbox": [
                188,
                442,
                769,
                514
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/f10d24ee80056437e203037e848a0e6346e7b963abcc099320e9cdbaf85d99e8.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                554,
                863,
                758
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "1、 各级页表的大小不能超过一个页面（4KB）"
                    }
                ]
            },
            "bbox": [
                147,
                778,
                499,
                795
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "表对应页号应为10位。总共28位的页号至少要分为三级"
                    }
                ]
            },
            "bbox": [
                168,
                93,
                724,
                112
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "逻辑地址："
                    }
                ]
            },
            "bbox": [
                168,
                131,
                273,
                151
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                549,
                131,
                658,
                149
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                897,
                131,
                1000,
                149
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "逻辑地址："
                    }
                ]
            },
            "bbox": [
                168,
                178,
                272,
                197
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                322,
                175,
                458,
                193
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                500,
                175,
                647,
                193
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                685,
                175,
                831,
                193
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                880,
                175,
                1000,
                193
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "2、 时间上的增多"
                    }
                ],
                "level": 1
            },
            "bbox": [
                144,
                315,
                287,
                331
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "分段存储管理"
                    }
                ]
            },
            "bbox": [
                146,
                334,
                258,
                349
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "与分页最大的区别就是分配的地址空间不同"
                    }
                ]
            },
            "bbox": [
                146,
                351,
                485,
                368
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "例如一个进程可以分为一个主程序段、子程序段、数据段等等"
                    }
                ]
            },
            "bbox": [
                146,
                370,
                626,
                387
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/df99080ebec00322d491304b60714ac19231c97500b56bb012e3268eda91488a.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                164,
                404,
                299,
                593
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/de29650cb43db5e10b6515935e0feeba5301cbe36fba9c1acfa6679230180129.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                416,
                403,
                744,
                608
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "由于是按逻辑功能模块划分，用户编程更方便，程序的可读性更高"
                    }
                ]
            },
            "bbox": [
                142,
                623,
                816,
                643
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "OAD1,[D]|<A>；"
                    }
                ]
            },
            "bbox": [
                147,
                643,
                312,
                661
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "//将分段D中A单元内的值读入寄存器1 "
                    }
                ]
            },
            "bbox": [
                411,
                643,
                816,
                661
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "TORE1,[X]|<B>; "
                    }
                ]
            },
            "bbox": [
                147,
                664,
                317,
                682
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "//将寄存器1的内容存入X分段的B单元中"
                    }
                ]
            },
            "bbox": [
                411,
                662,
                816,
                681
            ]
        },
        {
            "type": "page_aside_text",
            "content": {
                "page_aside_text_content": [
                    {
                        "type": "text",
                        "content": "2号段(6KB)"
                    }
                ]
            },
            "bbox": [
                885,
                458,
                949,
                497
            ]
        },
        {
            "type": "page_aside_text",
            "content": {
                "page_aside_text_content": [
                    {
                        "type": "text",
                        "content": "0号段(7KB) "
                    }
                ]
            },
            "bbox": [
                885,
                535,
                947,
                575
            ]
        },
        {
            "type": "page_aside_text",
            "content": {
                "page_aside_text_content": [
                    {
                        "type": "text",
                        "content": "1号段(3KB)"
                    }
                ]
            },
            "bbox": [
                887,
                612,
                947,
                649
            ]
        },
        {
            "type": "page_aside_text",
            "content": {
                "page_aside_text_content": [
                    {
                        "type": "text",
                        "content": "内存"
                    }
                ]
            },
            "bbox": [
                900,
                678,
                949,
                697
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "分段系统的逻辑地址结构由段号（段名）和段内地址（段内偏移量）所组成。如："
                    }
                ]
            },
            "bbox": [
                191,
                103,
                645,
                116
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/d626c1d400e2ce196b92740d701d49d5371dcd2378815991a43ebee11ea9babb.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                157,
                118,
                759,
                319
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "段表"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                351,
                188,
                368
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "段号、段长和段基址"
                    }
                ],
                "level": 1
            },
            "bbox": [
                144,
                370,
                312,
                387
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每个段对应一个段表项。因为在分页式管理当中，每个页面大小是相同的 4KB"
                    }
                ]
            },
            "bbox": [
                144,
                388,
                746,
                406
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每个段表项的长度相同 "
                    }
                ]
            },
            "bbox": [
                146,
                407,
                327,
                424
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "所以要对段内偏移量进行检查"
                    }
                ],
                "level": 1
            },
            "bbox": [
                144,
                445,
                381,
                460
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "这里不同的是，基址为整个物理地址（32位）"
                    }
                ]
            },
            "bbox": [
                144,
                463,
                497,
                479
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "问题：程序分多个段，各段离散地装入内存，为了保证程序能正常运行，就必须能从物理内存中找到各个逻辑段的存放位置。为此，需为每个进程建立一张段映射表，简称“段表”。"
                    }
                ]
            },
            "bbox": [
                176,
                483,
                863,
                513
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/2b507b891281a2ffa40cabec02564514c04f087c3854f3655fc3c5514686bfaf.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                181,
                524,
                860,
                758
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页是信息的物理单位。分页的主要目的是为了实现离散分配，提高内存利用率。分页仅仅是系统管理上的需要，完全是系统行为，对用户是不可见的。"
                    }
                ]
            },
            "bbox": [
                200,
                92,
                759,
                114
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "段是信息的逻辑单位。分段的主要目的是更好地满足用户需求。一个段通常包含着一组属于一个逻辑模块的信息。分段对用户是可见的，用户编程时需要显式地给出段名。"
                    }
                ]
            },
            "bbox": [
                200,
                115,
                759,
                137
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页的大小固定且由系统决定。段的长度却不固定，决定于用户编写的程序。"
                    }
                ]
            },
            "bbox": [
                200,
                140,
                621,
                153
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "分页的用户进程地址空间是一维的，程序员只需给出一个记忆符即可表示一个地址。"
                    }
                ]
            },
            "bbox": [
                200,
                155,
                670,
                167
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "分段的用户进程地址空间是二维的，程序员在标识一个地址时，既要给出段名，也要给出段内地址。"
                    }
                ]
            },
            "bbox": [
                200,
                167,
                761,
                179
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/e26df102aa9ea7b27e447a594c60dc0a2487f87be17a4f27b9c491d5b6e03f5d.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                193,
                183,
                811,
                307
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/d2cfdea41dc9b410c19d224233a5736c8defa2cf509888990e61c615f7aa10f6.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                335,
                816,
                609
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [],
                "level": 1
            },
            "bbox": [
                346,
                646,
                507,
                661
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                527,
                646,
                630,
                656
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "只是简单的输出"
                    }
                ]
            },
            "bbox": [
                531,
                657,
                613,
                665
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "“HelloWorld！” "
                    }
                ]
            },
            "bbox": [
                531,
                665,
                613,
                674
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                193,
                670,
                400,
                680
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "不能被修改的代码称为纯代码或可重入代码（不属于临界资源），这样的代码是可以共享的。可修改的代码是不能共享的（比如，有一个代码段中有很多变量，各进程并发地同时访问可能造成数据不一致）"
                    }
                ]
            },
            "bbox": [
                193,
                681,
                667,
                708
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/3367ee37273d79ecc26738703546ed8df5d4206573630f08b34768686bbc5014.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                163,
                708,
                665,
                854
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页是信息的物理单位。分页的主要目的是为了实现离散分配，提高内存利用率。分页仅仅是系统管理上的需要，完全是系统行为，对用户是不可见的。"
                    }
                ]
            },
            "bbox": [
                174,
                93,
                759,
                115
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "段是信息的逻辑单位。分页的主要目的是更好地满足用户需求。一个段通常包含着一组属于一个逻辑模块的信息。分段对用户是可见的，用户编程时需要显式地给出段名。"
                    }
                ]
            },
            "bbox": [
                174,
                116,
                759,
                139
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页的大小固定且由系统决定。段的长度却不固定，决定于用户编写的程序。"
                    }
                ]
            },
            "bbox": [
                174,
                143,
                616,
                155
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "分页的用户进程地址空间是一维的，程序员只需给出一个记忆符即可表示一个地址。"
                    }
                ]
            },
            "bbox": [
                174,
                159,
                670,
                170
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "分段的用户进程地址空间是二维的，程序员在标识一个地址时，既要给出段名，也要给出段内地址。"
                    }
                ]
            },
            "bbox": [
                174,
                171,
                764,
                183
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "分段比分页更容易实现信息的共享和保护。不能被修改的代码称为纯代码或可重入代码（不属于临界资源），这样的代码是可以共享的。可修改的代码是不能共享的"
                    }
                ]
            },
            "bbox": [
                174,
                192,
                759,
                215
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "访问一个逻辑地址需要几次访存？"
                    }
                ]
            },
            "bbox": [
                174,
                223,
                376,
                235
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "分页（单级页表）：第一次访存一一查内存中的页表，第二次访存一一访问目标内存单元。总共两次"
                    }
                ]
            },
            "bbox": [
                174,
                236,
                769,
                258
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "分段：第一次访存一一查内存中的段表，第二次访存一一访问目标内存单元。总共两次访存"
                    }
                ]
            },
            "bbox": [
                174,
                259,
                715,
                269
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "与分页系统类似，分段系统中也可以引入快表机构，将近期访问过的段表项放到快表中，这样可以少一次访问，加快地址变换速度。 "
                    }
                ]
            },
            "bbox": [
                174,
                271,
                759,
                293
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "段页式"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                316,
                203,
                330
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/45184f5da1d6a9808b8a8f40f2ba9e2e66d6df96b1a58b0731dcfa33724a13dd.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                161,
                331,
                847,
                580
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/ad5a87aaf317c8e4c2d076e788f09fa5145f10c9263d7ea1093f47e32c604cb5.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                176,
                624,
                838,
                879
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "分段系统的逻辑地址结构由段号和段内地址（段内偏移量）组成。如："
                    }
                ]
            },
            "bbox": [
                151,
                95,
                626,
                109
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/52aa4ec0a49d59286208a45850ee7883cd9d6e492f6085f047053d1b1ef7ea52.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td>31</td><td>......</td><td>16</td><td>15</td><td>......</td><td>0</td></tr><tr><td>段号</td><td></td><td></td><td>段内地址</td><td></td><td></td></tr></table>",
                "table_type": "simple_table",
                "table_nest_level": 1
            },
            "bbox": [
                149,
                115,
                702,
                153
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "段页式系统的逻辑地址结构由段号、页号、页内地址（页内偏移量）组成。如："
                    }
                ]
            },
            "bbox": [
                151,
                167,
                687,
                181
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/8d43df07f6add33cbe9e72dfecb3a8b35a2677fbcb96ba6c7cef649837453b6a.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                186,
                848,
                340
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/9fb476674daa2f29df3baab85be908e8a3265fdb1050045f3e86f0cef9575186.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                152,
                353,
                803,
                609
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "与此对应，段页式的段表存储的是段号（隐藏）、页表长度、页表存放块号组成"
                    }
                ]
            },
            "bbox": [
                144,
                630,
                771,
                646
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每个段表项长度相等 "
                    }
                ]
            },
            "bbox": [
                147,
                649,
                312,
                665
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每个页面对应一个页表项，每个页表项由页号（隐含）、页面存放的内存块号组成，每个页表项长度相等"
                    }
                ]
            },
            "bbox": [
                144,
                667,
                848,
                702
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "虚拟存储系统"
                    }
                ]
            },
            "bbox": [
                147,
                705,
                258,
                720
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "虚拟存储系统的基本概念"
                    }
                ]
            },
            "bbox": [
                146,
                722,
                347,
                739
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "将进程装入的一次性或者整体性改为多次性：改变进程必须全部装入内存才能开始运行的方式1、作业很大时，并不能全部装入内存，导致大作业无法运行。"
                    }
                ]
            },
            "bbox": [
                144,
                741,
                848,
                776
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "当大量作业要求运行时，会只有少量作业能运行，导致多道程序并发度下降"
                    }
                ]
            },
            "bbox": [
                146,
                778,
                734,
                794
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "将进程的驻留性改为置换性：当作业被装入内存，就会一直驻留在内存中。那么在需要时将暂时不用的部分换出到外存储器。"
                    }
                ]
            },
            "bbox": [
                144,
                797,
                848,
                832
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "就可以让程序开始执行。"
                    }
                ]
            },
            "bbox": [
                189,
                114,
                653,
                162
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                189,
                164,
                648,
                212
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                189,
                214,
                648,
                246
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                189,
                247,
                648,
                280
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                522,
                282,
                668,
                386
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "多次性："
                    }
                ]
            },
            "bbox": [
                144,
                482,
                213,
                498
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "对换性："
                    }
                ]
            },
            "bbox": [
                147,
                500,
                213,
                516
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "驻留性："
                    }
                ]
            },
            "bbox": [
                147,
                519,
                213,
                535
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "多次性：无需在作业运行时一次性全部装入内存，而是允许被分成多次调入内存。"
                    }
                ]
            },
            "bbox": [
                174,
                556,
                897,
                605
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                174,
                606,
                897,
                625
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "储管理"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                87,
                228,
                105
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "存储管理"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                130,
                252,
                149
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                393,
                118,
                559,
                175
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                169,
                177,
                273,
                195
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                169,
                197,
                586,
                253
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "若内存空间不够，由操作系统负责将内存"
                    }
                ]
            },
            "bbox": [
                169,
                255,
                586,
                292
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                225,
                304,
                458,
                342
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "局部性原理：时间局部性：数据可能再次被访问"
                    }
                ]
            },
            "bbox": [
                144,
                370,
                521,
                387
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "空间局部性：邻近的存储单元也有可能被访问到"
                    }
                ]
            },
            "bbox": [
                147,
                388,
                521,
                405
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "请求分页存储管理方式"
                    }
                ]
            },
            "bbox": [
                146,
                426,
                327,
                442
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页面置换 "
                    }
                ]
            },
            "bbox": [
                146,
                482,
                221,
                498
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "页面置换策略"
                    }
                ]
            },
            "bbox": [
                147,
                501,
                257,
                516
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/0f527ba7ba2844cf6742aa16209b12b9e06a09db2ec5029c2603849b08b67232.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                255,
                531,
                1000,
                777
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "缺页中断机构 "
                    }
                ]
            },
            "bbox": [
                146,
                815,
                257,
                831
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [],
                "level": 1
            },
            "bbox": [
                576,
                128,
                779,
                155
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/fc63a9fabc88d67ff9a36e5b7b6187c0cd408ba473fa3c4a2467e1b086b4d593.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td>页号</td><td>内存块号</td><td>状态位</td><td>访问字段</td><td>修改位</td><td>外存地址</td></tr><tr><td>0</td><td>c</td><td>1</td><td>0</td><td>0</td><td>x</td></tr><tr><td>1</td><td>b</td><td>1</td><td>10</td><td>0</td><td>y</td></tr><tr><td>2</td><td>无</td><td>0</td><td>0</td><td>0</td><td>z</td></tr></table>",
                "table_type": "simple_table",
                "table_nest_level": 1
            },
            "bbox": [
                189,
                191,
                858,
                297
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                184,
                332,
                800,
                351
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                184,
                363,
                969,
                401
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                184,
                403,
                978,
                422
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "改页表中相应的页表项。"
                    }
                ]
            },
            "bbox": [
                184,
                442,
                971,
                478
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                184,
                481,
                969,
                520
            ]
        }
    ],
    [
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/400fb73ec49eb9f39fe4a2543a92ab529de1188b40d5a8ca683cee439aa7d348.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                152,
                143,
                868,
                533
            ]
        },
        {
            "type": "page_header",
            "content": {
                "page_header_content": []
            },
            "bbox": [
                164,
                99,
                243,
                115
            ]
        },
        {
            "type": "page_header",
            "content": {
                "page_header_content": []
            },
            "bbox": [
                310,
                99,
                389,
                115
            ]
        },
        {
            "type": "page_header",
            "content": {
                "page_header_content": []
            },
            "bbox": [
                458,
                99,
                700,
                116
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                186,
                108,
                289,
                124
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "equation_inline",
                                "content": "\\textcircled{1}"
                            },
                            {
                                "type": "text",
                                "content": "需修改快表中的数据，只有要将快表项删除时才需要写回内存中的慢表。这样可以减少访存次数。"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "②和普通的中断处理一样，缺页中断处理依然需要保留CPU现场。"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "③需要用某种“页面置换算法”"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "equation_inline",
                                "content": "\\textcircled{4}"
                            },
                            {
                                "type": "text",
                                "content": "换入/换出页面都需要启动慢速的I/O操作，可见，如果换入/换出太频繁，会有很大的开销。"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "③页面调入内存后，需要修改慢表，同时也需要将表项复制到快"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                184,
                128,
                522,
                495
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1、请求调页"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2、页面置换"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "3、修改数据"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                147,
                538,
                248,
                589
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "页面置换算法"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                612,
                258,
                627
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "1、最佳置换算法OPT"
                    }
                ]
            },
            "bbox": [
                147,
                631,
                319,
                645
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "将来不在访问的页面或者长时间内不会访问的页面"
                    }
                ]
            },
            "bbox": [
                176,
                649,
                569,
                664
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "2、先进先出置换算法FIFO"
                    }
                ]
            },
            "bbox": [
                146,
                668,
                359,
                682
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "最先调入内存的页面，或者在也内存中驻留时间最久的页面算法"
                    }
                ]
            },
            "bbox": [
                176,
                686,
                673,
                701
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "3、 最近最久未使用置换算法 LRU"
                    }
                ]
            },
            "bbox": [
                147,
                705,
                406,
                719
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "最近一段时间内最长没有被访问的页面"
                    }
                ]
            },
            "bbox": [
                176,
                722,
                480,
                738
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "4、最近最少使用置换算法LFU"
                    }
                ]
            },
            "bbox": [
                147,
                741,
                389,
                756
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "被访问的频次而不是LRU中的事件"
                    }
                ]
            },
            "bbox": [
                176,
                760,
                445,
                775
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "淘汰过去一段话时间里访问次数最少的页面"
                    }
                ]
            },
            "bbox": [
                176,
                778,
                515,
                793
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "5、 时钟置换算法（CLOCK）"
                    }
                ]
            },
            "bbox": [
                147,
                797,
                357,
                812
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "简单的时钟置换算法"
                    }
                ]
            },
            "bbox": [
                176,
                816,
                339,
                831
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "简单的CLOCK算法实现方法：为每个页面设置一个访问位，再将内存中的页面都通过链接指一个循环队列。当某页被访问时，其访问位置为1。当需要淘汰一个页面时，只需检查页的如果是0，就选择该页换出：如果是1，则将它置为0，暂不换出，继续检查下一个页面，若描中所有页面都是1，则将这些页面的访问位依次置为0后，再进行第二轮扫描（第二轮扫描"
                    }
                ]
            },
            "bbox": [
                211,
                87,
                1000,
                173
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/fcf636923e500cc700596c00e999d933b2176565f136e95acd8bf04082cd0471.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                201,
                218,
                882,
                305
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "例：假设系统为某进程分配了五个内存块，并考虑到有以下页面号引用串："
                    }
                ]
            },
            "bbox": [
                203,
                313,
                584,
                353
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "1,3,4,2,5,6,3,47 "
                    }
                ]
            },
            "bbox": [
                206,
                353,
                431,
                373
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "改进型"
                    }
                ]
            },
            "bbox": [
                176,
                463,
                236,
                479
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "文件系统"
                    }
                ],
                "level": 1
            },
            "bbox": [
                144,
                504,
                262,
                526
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "文件命名"
                    }
                ],
                "level": 1
            },
            "bbox": [
                144,
                576,
                258,
                599
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/5ce368bbcdef9c3333d67953d18f72e6ae718c3ef2e0dbabf25400bf364e2393.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td>扩展名</td><td>含 义</td></tr><tr><td>file.bak</td><td>备份文件</td></tr><tr><td>file.c</td><td>C源程序文件</td></tr><tr><td>file.gif</td><td>符合图形交换格式的图像文件</td></tr><tr><td>file.hlp</td><td>帮助文件</td></tr><tr><td>file.html</td><td>WWW超文本标记语言文档</td></tr><tr><td>file.jpg</td><td>符合JPEG编码标准的静态图片</td></tr><tr><td>file.mp3</td><td>符合MP3音频编码格式的音乐文件</td></tr><tr><td>file.mpg</td><td>符合MPEG编码标准的电影</td></tr><tr><td>file.o</td><td>目标文件(编译器输出格式,尚未连接)</td></tr><tr><td>file.pdf</td><td>pdf格式的文件</td></tr><tr><td>file.ps</td><td>PostScript文件</td></tr><tr><td>file.tex</td><td>为TEX格式化程序准备的输入文件</td></tr><tr><td>file.txt</td><td>一般正文文件</td></tr><tr><td>file.zip</td><td>压缩文件</td></tr></table>",
                "table_type": "simple_table",
                "table_nest_level": 1
            },
            "bbox": [
                154,
                642,
                618,
                883
            ]
        },
        {
            "type": "page_aside_text",
            "content": {
                "page_aside_text_content": [
                    {
                        "type": "text",
                        "content": "5号页（ "
                    }
                ]
            },
            "bbox": [
                922,
                309,
                1000,
                332
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "文件结构："
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                99,
                268,
                122
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "字节序列、记录序列、树 "
                    }
                ]
            },
            "bbox": [
                146,
                165,
                344,
                181
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "1、无结构的字节序列"
                    }
                ]
            },
            "bbox": [
                147,
                184,
                319,
                200
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/b464b4362a2fe89910a9e4b68027cab3ad7ea56317c34a52fb3c0cbe2fcb1a58.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                206,
                219,
                771,
                416
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "3、记录序列 有固定格式 基于"
                    }
                ]
            },
            "bbox": [
                206,
                425,
                443,
                441
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "树形结构"
                    }
                ]
            },
            "bbox": [
                208,
                443,
                282,
                458
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "由一棵记录树构成"
                    }
                ]
            },
            "bbox": [
                208,
                462,
                352,
                478
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "文件类型"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                502,
                258,
                524
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                184,
                585,
                295,
                605
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "ASCII文件、二进制文件"
                    }
                ]
            },
            "bbox": [
                201,
                612,
                428,
                629
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                184,
                643,
                297,
                661
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                186,
                684,
                302,
                703
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "字符特殊文件、块设备特殊文件"
                    }
                ]
            },
            "bbox": [
                206,
                718,
                505,
                734
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "特殊文件：前者鼠标键盘后者磁盘"
                    }
                ]
            },
            "bbox": [
                144,
                772,
                416,
                788
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Gcc -o hello hello.c 可执行的文件就是二进制文件 ELF 格式"
                    }
                ]
            },
            "bbox": [
                146,
                791,
                589,
                806
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "目录文件~文件夹"
                    }
                ]
            },
            "bbox": [
                147,
                809,
                284,
                825
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "文件访问"
                    }
                ]
            },
            "bbox": [
                147,
                828,
                221,
                843
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "顺序访问 "
                    }
                ]
            },
            "bbox": [
                147,
                846,
                221,
                862
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "从文件开始按顺序读取文件的全部字节或记录，不能跳过某一些内容"
                    }
                ]
            },
            "bbox": [
                146,
                865,
                678,
                881
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "随机访问 "
                    }
                ]
            },
            "bbox": [
                147,
                883,
                221,
                898
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "能够以任何次序读取其中字节或记录的文件称为随机访问文件文件属性（元数据）"
                    }
                ]
            },
            "bbox": [
                146,
                93,
                626,
                127
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/e96711a7474c733c45f6d54fc95270011e08f2d5f18514519664a4e858983e0a.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td>属性</td><td>含义</td></tr><tr><td>保护</td><td>谁可以存取文件,以什么方式存取文件</td></tr><tr><td>口令</td><td>存取文件需要的口令</td></tr><tr><td>创建者</td><td>创建文件者的ID</td></tr><tr><td>所有者</td><td>当前所有者</td></tr><tr><td>只读标志</td><td>0表示读/写;1表示只读</td></tr><tr><td>隐藏标志</td><td>0表示正常;1表示不在列表中显示</td></tr><tr><td>系统标志</td><td>0表示普通文件;1表示系统文件</td></tr><tr><td>存档标志</td><td>0表示已经备份;1表示需要备份</td></tr><tr><td>ASCII/二进制标志</td><td>0表示ASCII码文件;1表示二进制文件</td></tr><tr><td>随机存取标志</td><td>0表示只允许顺序存取;1表示随机存取</td></tr><tr><td>临时标志</td><td>0表示正常;1表示进程退出时删除该文件</td></tr><tr><td>加锁标志</td><td>0表示未加锁;非零表示加锁</td></tr><tr><td>记录长度</td><td>一个记录中的字节数</td></tr><tr><td>键的位置</td><td>每个记录中键的偏移量</td></tr><tr><td>键的长度</td><td>键字段的字节数</td></tr><tr><td>创建时间</td><td>文件创建的日期和时间</td></tr><tr><td>最后一次存取时间</td><td>文件上一次存取的日期和时间</td></tr><tr><td>最后一次修改时间</td><td>文件上一次修改的日期和时间</td></tr><tr><td>当前大小</td><td>文件的字节数</td></tr><tr><td>最大长度</td><td>文件可能增长到的字节数</td></tr></table>",
                "table_type": "simple_table",
                "table_nest_level": 1
            },
            "bbox": [
                189,
                147,
                583,
                404
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1、 文件名：由创建文件的用户决定文件名"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2、标识符:标识符是操作系统用于区分各个文件的一种内部名称"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "3、类型：文件的类型"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "4、位置：存放的路径"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                146,
                426,
                643,
                497
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "无结构文件：由一些二进制或字符流组成，又称“流式文件“"
                    }
                ]
            },
            "bbox": [
                144,
                500,
                626,
                516
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "有结构文件：由一个个记录组成"
                    }
                ]
            },
            "bbox": [
                146,
                519,
                398,
                533
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "文件之间应该怎样组织起来？"
                    }
                ]
            },
            "bbox": [
                146,
                538,
                371,
                552
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/b29ddbda9ea126aae0c65b85504a9505a1c1c2ed618fcce250405b7a859aaced.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                169,
                564,
                855,
                762
            ]
        }
    ],
    [
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/3573b1798d26f523c9c1c39f4a7b799f23f33edde7d0558cdf4835c56be969a2.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                152,
                87,
                707,
                291
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/92c082502f8465a1cc06b1fdb338aa9adac8172fbfaa16df7b8d730ed91cd6c0.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                146,
                321,
                490,
                533
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/973251a710ef2f8b351c93744ddff129a1fb12960078814506f313c8a8245fa8.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                595,
                737,
                829
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "文件的逻辑结构"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                99,
                339,
                122
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "逻辑上可以相邻，物理结构可以不相邻"
                    }
                ]
            },
            "bbox": [
                144,
                184,
                453,
                200
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "无结构文件"
                    }
                ]
            },
            "bbox": [
                146,
                221,
                238,
                237
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "文件的物理结构"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                262,
                339,
                284
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "文件最后时存储在磁盘上，要读到内存里"
                    }
                ]
            },
            "bbox": [
                144,
                382,
                468,
                399
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "磁盘分配空间"
                    }
                ]
            },
            "bbox": [
                146,
                401,
                257,
                417
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "连续分配"
                    }
                ]
            },
            "bbox": [
                146,
                420,
                221,
                435
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "链接分配"
                    }
                ]
            },
            "bbox": [
                147,
                439,
                221,
                453
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "索引分配"
                    }
                ]
            },
            "bbox": [
                147,
                458,
                221,
                472
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "连续分配"
                    }
                ]
            },
            "bbox": [
                147,
                476,
                221,
                491
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "连续文件又称为顺序文件，它把逻辑文件中的信息顺序地存放到一组相邻接的磁盘块内存与外存以块位单位传递数据"
                    }
                ]
            },
            "bbox": [
                144,
                494,
                805,
                527
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/221571589ca3c06544fd3a9b7448e9fb6c292fd1d7b9ce40ce811cc084fcf1fc.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                530,
                732,
                758
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "文件的逻辑地址也可以表示为（逻辑块号，块内地址）的形式"
                    }
                ]
            },
            "bbox": [
                146,
                772,
                628,
                788
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "连续分配"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                815,
                245,
                834
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "要实现逻辑地址到物理地址的映射"
                    }
                ]
            },
            "bbox": [
                147,
                875,
                415,
                891
            ]
        }
    ],
    [
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/3006f13db25abdf16b60ea993a03b02ac91798731b4eff30e6b37a75ace186b3.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                92,
                263,
                288
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/21fe7e26835c77cc107ceb08ae2d0464d4ce8ecbe30a66270a0e06ab6c121e1e.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                381,
                90,
                416,
                112
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/f55df14d2b6431be7658334bfd953833083da8566e63f89e0c089bd0e54e751a.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                289,
                112,
                416,
                187
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "扇区：磁盘访问的最小单位"
                    }
                ]
            },
            "bbox": [
                426,
                87,
                673,
                110
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "簇(cluster)：由多个扇区组成也称为磁盘块"
                    }
                ]
            },
            "bbox": [
                426,
                118,
                704,
                159
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                426,
                175,
                712,
                216
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                426,
                235,
                732,
                275
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/82b7c873ed58dfb1f99d818c77feb3ac3ce0df2738a2ec718885825417f284b6.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                194,
                313,
                789,
                541
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/778f8ee4435e66659769fc483c2cbfd3999d1f96ceb484cf2070246cc698cfa0.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td>文件名</td><td>......</td><td>起始块号</td><td>长度</td></tr><tr><td>aaa</td><td>...</td><td>4</td><td>3</td></tr><tr><td>bbb</td><td>...</td><td>10</td><td>4</td></tr><tr><td>......</td><td>...</td><td>...</td><td>...</td></tr></table>",
                "table_type": "simple_table",
                "table_nest_level": 1
            },
            "bbox": [
                189,
                543,
                547,
                636
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                568,
                561,
                749,
                611
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "CD-ROM "
                    }
                ]
            },
            "bbox": [
                146,
                649,
                213,
                662
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "扇区：512B"
                    }
                ]
            },
            "bbox": [
                147,
                668,
                240,
                683
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "链式分配"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                99,
                247,
                120
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/d76cdf841fc51cd71e1e65a6e890e4d95125937f42959111c8137c2089026605.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                184,
                186,
                510,
                419
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "索引分配"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                444,
                247,
                464
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "隐式链接 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                512,
                247,
                532
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/0eb7cca7f37f86fa2d710ee80c01d8e0876e05525acc9cc7a61bd0292bba9dcd.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                161,
                571,
                413,
                728
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "索引分配：将所有指针放在一起"
                    }
                ]
            },
            "bbox": [
                415,
                574,
                653,
                612
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                416,
                625,
                653,
                640
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                418,
                653,
                589,
                669
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                420,
                678,
                584,
                695
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "显式链接 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                782,
                247,
                802
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "把物理块的指针显示地存放在一张表中，即文件分配表"
                    }
                ]
            },
            "bbox": [
                146,
                841,
                576,
                859
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "一个磁盘仅设置一张FAT，常驻内存"
                    }
                ]
            },
            "bbox": [
                147,
                879,
                426,
                895
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "支持随机访问"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                93,
                257,
                108
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "不需要访问磁盘"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                112,
                275,
                127
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/c56ead3f2a5b091034517a12c4803a53e71ae2cc2209fa07aeb1cdad7863f989.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                169,
                134,
                709,
                324
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "的映射关系）。索引表存放的磁盘块称为索引块。文件数据存放的磁盘块称为数据块。"
                    }
                ]
            },
            "bbox": [
                169,
                330,
                668,
                360
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/331cf78a06752c6a929f5d56d7c4a48df2790d01c0cd19f508cfa670f32b0be8.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                152,
                361,
                670,
                512
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "指针：磁盘块地址"
                    }
                ]
            },
            "bbox": [
                146,
                519,
                294,
                535
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "解决方案：1链接方案：如果索引表太大，那么可以将多个索引块链接起来存放2、"
                    }
                ]
            },
            "bbox": [
                144,
                538,
                764,
                571
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "多级索引"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                596,
                258,
                619
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/e280a383db867ccc97eee2b5202599212473573c6d528aa9dd58f9e993d71add.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                154,
                659,
                805,
                879
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "建立多层索引，类似于多级页表，使第一层索引块指向第二层的索引块。"
                    }
                ]
            },
            "bbox": [
                146,
                93,
                705,
                108
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "文件大小的要求再建立第三层、第四层索引块。"
                    }
                ]
            },
            "bbox": [
                223,
                110,
                505,
                124
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/fc08a8388773bdc2a81ddd06eb258ebed0de11948d88f9cf2a2a900d1f0d0d18.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                169,
                130,
                515,
                326
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "假设磁盘块大小为1KB，一个索引表项占4B，则一个磁盘块只能存放256个索引项。"
                    }
                ]
            },
            "bbox": [
                532,
                126,
                845,
                151
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "256*256*1KB=65,536KB=64MB "
                    }
                ]
            },
            "bbox": [
                532,
                161,
                850,
                184
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "可根据逻辑块号算出应该查找索引表中的哪个表项。如：要访问1026号逻辑块，则"
                    }
                ]
            },
            "bbox": [
                532,
                185,
                840,
                209
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "1026/256=4，1026%256=2"
                    }
                ]
            },
            "bbox": [
                532,
                209,
                702,
                219
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "因此可以先将一级索引表调入内存，查询4号表项，将其对应的二级索引表调入内存，再查询二级索引表的2号表项即可知道1026号逻辑块存放的磁盘块号了。"
                    }
                ]
            },
            "bbox": [
                532,
                219,
                855,
                266
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "混合索引"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                374,
                258,
                397
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/c51396610d11cd4829091a4eb11ce03671bd4cc3687292231b44292b2090fcb6.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                157,
                453,
                875,
                675
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/400072df8da19987149265a7a11a1d905eebeaf12e7302b10a5376e852aa341e.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                157,
                699,
                633,
                887
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "成组链接法"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                93,
                240,
                108
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/3ac5a4da438dc4652322377ae219cc6c94a0073a32ccc34bd0c7f9c8037bc76d.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                111,
                571,
                329
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "文件"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                334,
                186,
                349
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "九曲闲"
                    }
                ]
            },
            "bbox": [
                147,
                350,
                615,
                381
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/c340e7d0e17bfff1f393c49f123348edeeb66527cd16927c864cef59cf893946.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                201,
                386,
                600,
                499
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "链接计数、存取时间"
                    }
                ]
            },
            "bbox": [
                196,
                513,
                591,
                541
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "文件控制块FCB"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                575,
                270,
                590
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [],
                "level": 1
            },
            "bbox": [
                147,
                595,
                357,
                615
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "九曲阑干"
                    }
                ],
                "level": 1
            },
            "bbox": [
                537,
                594,
                628,
                615
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "文件和文件控制块一一对应，文件控制块的有序集合称为文件目录有的书中提到一个文件控制块是一个文件目录项"
                    }
                ]
            },
            "bbox": [
                149,
                626,
                630,
                665
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "FCB通常包括以下三类信息："
                    }
                ]
            },
            "bbox": [
                154,
                673,
                366,
                688
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "·基本信息，例如文件名、文件的物理位置等"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "·存取控制信息，指的是文件的存取权限"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "·使用信息，例如文件的建立时间、修改时间等"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                152,
                696,
                497,
                766
            ]
        }
    ],
    [
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/beb79d86c95619c9efb114613c661d2669cea30cd98108afd462b6a4a3073429.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                89,
                830,
                409
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "FCB 的有序集合称为文件目录（目录文件），一个 FCB 就是一个文件目录项"
                    }
                ]
            },
            "bbox": [
                144,
                426,
                731,
                444
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "目录文件中的一条记录就是一个 FCB"
                    }
                ]
            },
            "bbox": [
                146,
                444,
                431,
                461
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "也叫做文件控制块"
                    }
                ]
            },
            "bbox": [
                147,
                462,
                294,
                480
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "单级目录结构 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                504,
                314,
                526
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/6269c7f47662629eef60421179541bd062e53e3f74a0a0fe4d5f5f6aa0ccb4e2.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                218,
                590,
                605,
                843
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                707,
                614,
                1000,
                636
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "在创建一个文件时，需要先文件，确定不重名后才能允对应的目录项插入目录表中。"
                    }
                ]
            },
            "bbox": [
                707,
                655,
                1000,
                713
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                709,
                731,
                1000,
                752
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "两级目录结构 "
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                99,
                312,
                122
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "MFD 主文件目录"
                    }
                ]
            },
            "bbox": [
                147,
                166,
                277,
                181
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "UFD 用户文件目录"
                    }
                ]
            },
            "bbox": [
                147,
                185,
                290,
                199
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/946d22b9086a04f7acb2900659ce77455de57a8a18708e85754a9353486f4fdb.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                152,
                199,
                769,
                392
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "多级目录，又称树形目录"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                428,
                445,
                450
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "要访问某个文件时要用文件路径名标识文件，文件路径名是个字符串无环图目录结构"
                    }
                ]
            },
            "bbox": [
                146,
                494,
                680,
                527
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/8665ab96752d9ac70ef91a5c98199e200d9ebac92a360b58f55148478560532f.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                527,
                810,
                705
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "点的请求时，只是删除该用户的FCB、并使共享计数器减1，并不会直接删除共享结点。"
                    }
                ]
            },
            "bbox": [
                181,
                708,
                776,
                776
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "王道考研/CSKAOYAN.COM"
                    }
                ]
            },
            "bbox": [
                653,
                774,
                801,
                785
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "索引节点"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                99,
                258,
                122
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [],
                "level": 1
            },
            "bbox": [
                181,
                174,
                482,
                196
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "加曲闲干"
                    }
                ],
                "level": 1
            },
            "bbox": [
                593,
                173,
                687,
                197
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "文件目录也是一种文件，需要存放在磁盘上"
                    }
                ]
            },
            "bbox": [
                181,
                208,
                517,
                225
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "当文件很多时，文件目录要占用大量的盘块"
                    }
                ]
            },
            "bbox": [
                184,
                233,
                517,
                249
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "在检索目录文件的时候，需要将目录调入内存，然后比较文件名"
                    }
                ]
            },
            "bbox": [
                184,
                258,
                672,
                274
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "但是只是用到文件名，而不需要其他的文件信息"
                    }
                ]
            },
            "bbox": [
                184,
                281,
                552,
                296
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "文件名和文件信息分来，将文件描述信息单独存放在索引节点中"
                    }
                ]
            },
            "bbox": [
                184,
                305,
                670,
                319
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "FCB "
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\underline { { \\underline { { \\mathbf { \\delta \\pi } } } } }"
                    },
                    {
                        "type": "text",
                        "content": "文件名 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "^ +"
                    }
                ]
            },
            "bbox": [
                184,
                331,
                389,
                346
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/84c33a35183e6e6408781373416a6c445c81959a112184cb176fe1ae852997bc.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                370,
                174,
                390
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [],
                "level": 1
            },
            "bbox": [
                181,
                375,
                223,
                386
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [],
                "level": 1
            },
            "bbox": [
                357,
                373,
                534,
                388
            ]
        },
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/beac0f9fe5b81c7121ae85ea4a99eebf9838f6bdfc83ae56358f958901b99632.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td>文件名</td><td>索引结点指针</td></tr><tr><td>qianlong</td><td></td></tr><tr><td>QMDownLoad</td><td></td></tr><tr><td>......</td><td></td></tr><tr><td>照片</td><td></td></tr><tr><td>......</td><td></td></tr><tr><td>对账单4.txt</td><td></td></tr></table>",
                "table_type": "simple_table",
                "table_nest_level": 1
            },
            "bbox": [
                179,
                409,
                357,
                508
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                405,
                418,
                515,
                453
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "思考有何好处？"
                    }
                ]
            },
            "bbox": [
                571,
                388,
                650,
                400
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "假设一个FCB是64B，磁盘块的大"
                    }
                ]
            },
            "bbox": [
                569,
                401,
                747,
                412
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "小为1KB，则每个盘块中只能存放"
                    }
                ]
            },
            "bbox": [
                571,
                413,
                747,
                423
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "16个FCB。若一个文件目录中共有"
                    }
                ]
            },
            "bbox": [
                571,
                423,
                747,
                434
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "640个目录项，则共需要占用"
                    }
                ]
            },
            "bbox": [
                571,
                434,
                722,
                443
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "640/16=40个盘块。因此按照某"
                    }
                ]
            },
            "bbox": [
                571,
                443,
                742,
                453
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "文件名检索该目录，平均需要查"
                    }
                ]
            },
            "bbox": [
                571,
                453,
                742,
                463
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                571,
                463,
                749,
                473
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                571,
                473,
                749,
                483
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "若使用索引结点机制，文件名占14B，索引结点指针站2B，则每个盘块可存放64个目录项，那么按文件名检索目录平均只需要"
                    }
                ]
            },
            "bbox": [
                403,
                486,
                739,
                507
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "读入320/64 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "= 5"
                    }
                ]
            },
            "bbox": [
                405,
                508,
                734,
                518
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "文件在外存中的存放位置，根据“存放位置”即可找到文件。"
                    }
                ]
            },
            "bbox": [
                186,
                527,
                732,
                548
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "文件操作"
                    }
                ],
                "level": 1
            },
            "bbox": [
                156,
                101,
                280,
                124
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "九曲阑干"
                    }
                ],
                "level": 1
            },
            "bbox": [
                591,
                101,
                687,
                124
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "设备"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                159,
                131,
                663,
                299
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "创建文件"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                351,
                221,
                367
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "创建文件 四闲1"
                    }
                ]
            },
            "bbox": [
                173,
                367,
                675,
                382
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "创建一个文件，可以通过系统调用open实现Creat"
                    }
                ]
            },
            "bbox": [
                173,
                384,
                638,
                418
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "equation_inline",
                        "content": "="
                    }
                ]
            },
            "bbox": [
                173,
                420,
                660,
                437
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "系统调用open返回值"
                    }
                ]
            },
            "bbox": [
                173,
                445,
                662,
                463
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "·文件描述符是一个整数，是每个进程私有的"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "·文件描述符可以理解为一种权限，允许执行某些操作"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "·将文件描述符看成指向文件类型对象的指针"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "·每一个进程通过一个文件描述符表记录打开的文件"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                173,
                476,
                583,
                555
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "对文件的读写通过文件描述符来访问"
                    }
                ],
                "level": 1
            },
            "bbox": [
                173,
                592,
                561,
                613
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                173,
                625,
                747,
                643
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                173,
                658,
                665,
                675
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                173,
                689,
                747,
                709
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                174,
                724,
                386,
                739
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "关闭后，该文件描述符从文件描述符表中删除"
                    }
                ]
            },
            "bbox": [
                174,
                753,
                613,
                772
            ]
        },
        {
            "type": "page_header",
            "content": {
                "page_header_content": []
            },
            "bbox": [
                495,
                87,
                650,
                101
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "目录文件—— 文件夹，目录文件的位置"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                99,
                608,
                122
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "文件系统通常使用目录(文件夹）记录文件的位置每个文件名称为目录项，每个名字到inode的映射称为链接"
                    }
                ]
            },
            "bbox": [
                159,
                208,
                721,
                284
            ]
        },
        {
            "type": "code",
            "content": {
                "code_caption": [],
                "code_content": [
                    {
                        "type": "text",
                        "content": "struct dirent {\n    ino_t d_ino; /* inode number */\n    char d_name[256]; /* Filename */\n}; "
                    }
                ],
                "code_language": "c"
            },
            "bbox": [
                193,
                300,
                631,
                369
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "指向一个索引节点"
                    },
                    {
                        "type": "equation_inline",
                        "content": "\\mathsf { F C B } ="
                    },
                    {
                        "type": "text",
                        "content": "文件名 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "^ +"
                    },
                    {
                        "type": "text",
                        "content": "索引编号文件目录结构"
                    }
                ]
            },
            "bbox": [
                144,
                425,
                319,
                476
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/487ea92a3b1e8c07d01c474dca56fc312f5678cdde08fc2a5d29068bd3694f5e.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                479,
                951,
                726
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": []
            },
            "bbox": [
                159,
                743,
                342,
                850
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                179,
                862,
                252,
                877
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                398,
                758,
                598,
                809
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "目录中每个名字到索引节点的映射称为链接"
                    }
                ]
            },
            "bbox": [
                144,
                96,
                534,
                116
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "链接的本质就是目录中一个指向索引节点(inode)的名字"
                    }
                ]
            },
            "bbox": [
                144,
                126,
                648,
                143
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "所有的链接中，没有一个链接是“原始”或者“初始”状态"
                    }
                ]
            },
            "bbox": [
                144,
                155,
                675,
                174
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [],
                "level": 1
            },
            "bbox": [
                149,
                185,
                215,
                200
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                147,
                214,
                391,
                227
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                149,
                242,
                643,
                256
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "知识回顾：索引结点，是一种文件目录瘦身策略。由于检索文件时只需用到文件名，因此可以将除了文件名之外的其他信息放到索引结点中。这样目录项就只需要包含文件名、索引结点指针。"
                    }
                ]
            },
            "bbox": [
                152,
                287,
                678,
                309
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/166de816abc717e1a52d850f68a1396621d596fc9dff96aad483b019fb5d90f6.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                147,
                321,
                384,
                419
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/40703cd8300a3524f7a7b50221a5a394c5eadd4eca0df4815032768fa53466c4.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                458,
                318,
                675,
                376
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "索引结点中设置一个链接计数变量count，用于表示链接到本索引结点上的用户目录项数。"
                    }
                ]
            },
            "bbox": [
                144,
                426,
                620,
                437
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "若count "
                    },
                    {
                        "type": "equation_inline",
                        "content": "= 2"
                    },
                    {
                        "type": "text",
                        "content": "，说明此时有两个用户目录项链接到该索引结点上，或者说是有两个用户在共享此文件。若某个用户决定“删除”该文件，则只是要把用户目录中与该文件对应的目录项删除，且索引结点的count值减1。"
                    }
                ]
            },
            "bbox": [
                144,
                437,
                678,
                467
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "若count>0，说明还有别的用户要使用该文件，暂时不能把文件数据删除，否则会导致指针悬空。"
                    }
                ]
            },
            "bbox": [
                144,
                467,
                657,
                479
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "当count=0时系统负责删除文件。"
                    }
                ]
            },
            "bbox": [
                144,
                479,
                327,
                489
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                579,
                485,
                717,
                492
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "同一个索引节点"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                501,
                275,
                516
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "共享文件"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                558,
                258,
                581
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Copy和硬链接的区别？"
                    }
                ]
            },
            "bbox": [
                144,
                626,
                322,
                640
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Copy 是两份"
                    }
                ]
            },
            "bbox": [
                144,
                645,
                243,
                659
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "硬链接只有一份，映射了同一索引节点"
                    }
                ]
            },
            "bbox": [
                144,
                663,
                450,
                678
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "软链接（符号链接）"
                    }
                ]
            },
            "bbox": [
                144,
                681,
                300,
                696
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                144,
                699,
                502,
                730
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/fd946b48f5b1efee862c2bf42bb729c604c262ecb473632611822ec92631fbfb.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                608,
                701,
                638,
                730
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                144,
                749,
                589,
                771
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                144,
                787,
                532,
                809
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "快捷方式"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                829,
                221,
                845
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "当前工作日求"
                    }
                ],
                "level": 1
            },
            "bbox": [
                157,
                87,
                322,
                104
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "每个进程都有一个当前目录一般是创建时从父进程继承的"
                    }
                ]
            },
            "bbox": [
                156,
                117,
                662,
                136
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "内核解析相对路径时，会把当前工作目录作为起点"
                    }
                ]
            },
            "bbox": [
                157,
                143,
                584,
                161
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "获得当前工作目录使用系统调用getcwd"
                    }
                ]
            },
            "bbox": [
                157,
                168,
                489,
                186
            ]
        },
        {
            "type": "code",
            "content": {
                "code_caption": [],
                "code_content": [
                    {
                        "type": "text",
                        "content": "char *getcwd(char *buf, size_t size); "
                    }
                ],
                "code_language": "txt"
            },
            "bbox": [
                156,
                196,
                502,
                210
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "当前工作目录也可以修改"
                    }
                ]
            },
            "bbox": [
                157,
                222,
                369,
                237
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/cd074b8c1b12f950507859590f3d24e850eb4026d208c9a5470bdea6a6b1a95a.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                164,
                294,
                751,
                481
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "当User3访问“ccc”时，操作系统判断文件“ccc”属于Link类型文件，于是会根据其中记录的路径层层查找目录，最终找到User1的目录表中的“aaa”表项，于是就找到了文件1的索引结点。"
                    }
                ]
            },
            "bbox": [
                169,
                492,
                752,
                518
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                642,
                521,
                788,
                531
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "存储空间管理"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                558,
                314,
                582
            ]
        },
        {
            "type": "page_header",
            "content": {
                "page_header_content": []
            },
            "bbox": [
                568,
                87,
                662,
                104
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "为了追踪空闲的磁盘空间，系统需要维护一个空闲空间链表空闲空间链表记录了所有的空闲磁盘空间，也就是没有分配给文件和目录的空间"
                    }
                ]
            },
            "bbox": [
                188,
                146,
                845,
                223
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": []
            },
            "bbox": [
                193,
                236,
                339,
                351
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "设备管理"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                411,
                262,
                434
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "设备的分类"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                517,
                285,
                539
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "1、按数据传输速率"
                    }
                ]
            },
            "bbox": [
                147,
                583,
                305,
                599
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "低速：鼠标、键盘 "
                    }
                ]
            },
            "bbox": [
                176,
                602,
                322,
                617
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "中速：打印机、扫描仪"
                    }
                ]
            },
            "bbox": [
                176,
                621,
                357,
                636
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "高速：磁盘"
                    }
                ]
            },
            "bbox": [
                176,
                640,
                268,
                655
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "2、按信息交换单位"
                    }
                ]
            },
            "bbox": [
                146,
                677,
                305,
                690
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "块设备：磁盘 可寻址"
                    }
                ]
            },
            "bbox": [
                176,
                695,
                344,
                709
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "字符设备：不可寻址 中断驱动 交互式终端"
                    }
                ]
            },
            "bbox": [
                176,
                714,
                507,
                728
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "3、按设备共享属性"
                    }
                ]
            },
            "bbox": [
                146,
                732,
                305,
                747
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "4、按工作特性"
                    }
                ]
            },
            "bbox": [
                146,
                751,
                268,
                766
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "存储设备"
                    }
                ]
            },
            "bbox": [
                176,
                770,
                250,
                784
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "I/O 设备 "
                    }
                ]
            },
            "bbox": [
                181,
                789,
                247,
                803
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "网络通信设备"
                    }
                ]
            },
            "bbox": [
                176,
                807,
                285,
                822
            ]
        },
        {
            "type": "page_header",
            "content": {
                "page_header_content": []
            },
            "bbox": [
                149,
                89,
                191,
                99
            ]
        },
        {
            "type": "page_header",
            "content": {
                "page_header_content": [
                    {
                        "type": "text",
                        "content": "文伴长"
                    }
                ]
            },
            "bbox": [
                189,
                99,
                549,
                137
            ]
        },
        {
            "type": "page_header",
            "content": {
                "page_header_content": [
                    {
                        "type": "text",
                        "content": "九曲阑干"
                    }
                ]
            },
            "bbox": [
                719,
                99,
                842,
                129
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "I/O 控制器/设备控制器"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                99,
                420,
                122
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "接受和识别命令"
                    }
                ]
            },
            "bbox": [
                176,
                165,
                304,
                181
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "数据交换"
                    }
                ]
            },
            "bbox": [
                178,
                184,
                252,
                199
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "地址识别"
                    }
                ]
            },
            "bbox": [
                178,
                203,
                250,
                218
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "数据缓冲"
                    }
                ]
            },
            "bbox": [
                178,
                221,
                250,
                236
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "识别和报告设备状态"
                    }
                ]
            },
            "bbox": [
                178,
                239,
                339,
                255
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "差错控制"
                    }
                ]
            },
            "bbox": [
                179,
                259,
                250,
                273
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/143ee3de398a9c2cbf0e7359815a65f1b8465f14a6e9d6b43f848bffbf3df9c7.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                176,
                275,
                858,
                558
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "1、 一个 I/O 控制器可能会对应多个设备"
                    }
                ],
                "level": 1
            },
            "bbox": [
                178,
                592,
                487,
                607
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "2、内存映像I/O/寄存器独立编址"
                    }
                ],
                "level": 1
            },
            "bbox": [
                178,
                611,
                438,
                625
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/603ee7df80b4fe2bbccba8ff7c5b22bb3472cde0f1dc580a0c8726893375bae3.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                163,
                626,
                608,
                791
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "I/O 控制方式"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                99,
                302,
                122
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1、直接控制方式"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2、中断驱动控制方式"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "3、 直接存储器存取"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                146,
                165,
                324,
                218
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "直接控制"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                244,
                245,
                265
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/4ba93ea783051ba8e6becb9c517d5547b3e00256583bfc811a334011333c9e91.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                152,
                321,
                816,
                579
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "1、先经过 CPU，再到内存"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "2、CPU干预的频率"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "3、每次读写一个字"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "4、缺点：CPU/I/O 设备只能串行工作，CPU 一直处于轮询状态"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                146,
                583,
                626,
                655
            ]
        }
    ],
    [
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/6b3faf37064d03f0743ea93ab83e3f5cd3479e9c0a30d4e23c0f81f99fcffd03.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                149,
                86,
                694,
                281
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "中断驱动方式"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                357,
                292,
                378
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "由于I/O设备速度很慢，可将I/O等待的进程阻塞，现金切换到别的进程执行"
                    }
                ]
            },
            "bbox": [
                147,
                437,
                739,
                454
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/33ebe83923091a8e5117bb3871f33e3af6ac5602834ca1824fc972b1943ce379.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                166,
                456,
                652,
                646
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "DMA 方式"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                101,
                258,
                120
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "与“中断驱动方式”相比，DMA方式（DirectMemoryAccess，直接存储器存取。主要用于块设备的1/O控制）有这样几个改进："
                    }
                ]
            },
            "bbox": [
                164,
                164,
                746,
                187
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "②数据的流向是从设备直接放入内存，或者从内存直接到设备。不再需要CPU作为“快递小哥”。"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "③仅在传送一个或多个数据块的开始和结束时，才需要CPU干预。"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                164,
                187,
                727,
                222
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/097b9269cac00b912c89d878a106a8c979d61463dc902609bb9b85f3faa60750.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                173,
                235,
                724,
                375
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "读取的时候是按字读取，然后放入内存以块为单位仅在数据传送开始和结束时 caixuCPU 干预"
                    }
                ]
            },
            "bbox": [
                146,
                401,
                539,
                436
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/d325b155f9dacbee21ecbb21b7dae752983351d221280f6e107bd2cea60ed8bc.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                166,
                455,
                544,
                561
            ]
        },
        {
            "type": "list",
            "content": {
                "list_type": "text_list",
                "list_items": [
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "DR（DataBegister，数据寄存器）：暂存从设备到内存，或从内存到设备的数据"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "MAB（MemoryAddressBeeister，内存地址寄存器）：在输入时，MAR表示数据应放到内存中的什么"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "位置：输出时MAR表示要输出的数据放在内存中的什么位置。"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "DC（DataCounter，数据计数器）：表示剩余要读/写的字节数。"
                            }
                        ]
                    },
                    {
                        "item_type": "text",
                        "item_content": [
                            {
                                "type": "text",
                                "content": "CR（CommandRegister，命令/状态寄存器）：用于存放CPU发来的I/O命令，或设备的状态信息。"
                            }
                        ]
                    }
                ]
            },
            "bbox": [
                174,
                565,
                547,
                602
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                470,
                604,
                564,
                609
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "缺点：只能处理离散的"
                    }
                ]
            },
            "bbox": [
                146,
                661,
                327,
                676
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "通道控制方式："
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                722,
                302,
                741
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "一种硬件，识别并执行一系列通道指令"
                    }
                ]
            },
            "bbox": [
                147,
                782,
                453,
                799
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                250,
                110,
                994,
                131
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                169,
                141,
                826,
                184
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/d3a89001a2c91c4fbf60f097c101261bb546def2400791c4e377a66741a13ca7.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                169,
                191,
                1000,
                467
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "通道与CPU共享内存"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                538,
                312,
                554
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                186,
                598,
                621,
                609
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "1.完成一次读/写操作的流程(见右图)"
                    }
                ]
            },
            "bbox": [
                179,
                624,
                369,
                634
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "与CPU相比，通道可以执行的指令很单一，并且通道程"
                    }
                ]
            },
            "bbox": [
                389,
                613,
                655,
                633
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "2.CPU干预的频率 "
                    }
                ]
            },
            "bbox": [
                179,
                643,
                268,
                652
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "极低，通道会根据CPU的指示执行相应的通道程序，只有完成一组数据块的读/写后才需要发出中断信号，请求CPU于预。"
                    }
                ]
            },
            "bbox": [
                179,
                653,
                532,
                671
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/d4ead7abf439e8d160a05031880a63db63dc2b53e50e191546a4bbe505c8281d.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                546,
                643,
                694,
                740
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "3.数据传送的单位"
                    }
                ]
            },
            "bbox": [
                179,
                681,
                270,
                690
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                179,
                690,
                285,
                700
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                179,
                709,
                364,
                718
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "读操作（数据输入）：I/O设备→内存"
                    }
                ]
            },
            "bbox": [
                179,
                718,
                361,
                727
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "写操作（数据输出）：内存→I/O设备"
                    }
                ]
            },
            "bbox": [
                179,
                728,
                361,
                737
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "5.主要缺点和主要优点"
                    }
                ]
            },
            "bbox": [
                179,
                746,
                292,
                755
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "缺点：实现复杂，需要专门的通道硬件支持"
                    }
                ]
            },
            "bbox": [
                179,
                756,
                391,
                765
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                179,
                765,
                462,
                775
            ]
        }
    ],
    [
        {
            "type": "table",
            "content": {
                "image_source": {
                    "path": "images/9551d3a9b4a68fc1b9bff1853759f8df261486fe284d40cdd15b2e6719a9e6ee.jpg"
                },
                "table_caption": [],
                "table_footnote": [],
                "html": "<table><tr><td></td><td>完成一次读/写的过程</td><td>CPU干预频率</td><td>每次I/O的数据传输单位</td><td>数据流向</td><td>优缺点</td></tr><tr><td>程序直接控制方式</td><td>CPU发出I/O命令后需要不断轮询</td><td>极高</td><td>字</td><td>设备→CPU→内存内存→CPU→设备</td><td rowspan=\"4\">每一个阶段的优点都是解决了上一阶段的最大缺点。总体来说，整个发展过程就是要尽量减少CPU对I/O过程的干预，把CPU从繁杂的I/O控制事务中解脱出来，以便更多地去完成数据处理任务。</td></tr><tr><td>中断驱动方式</td><td>CPU发出I/O命令后可以做其他事，本次I/O完成后设备控制器发出中断信号</td><td>高</td><td>字</td><td>设备→CPU→内存内存→CPU→设备</td></tr><tr><td>DMA方式</td><td>CPU发出I/O命令后可以做其他事，本次I/O完成后DMA控制器发出中断信号</td><td>中</td><td>块</td><td>设备→内存内存→设备</td></tr><tr><td>通道控制方式</td><td>CPU发出I/O命令后可以做其他事。通道会执行通道程序以完成I/O，完成后通道向CPU发出中断信号</td><td>低</td><td>一组块</td><td>设备→内存内存→设备</td></tr></table>",
                "table_type": "complex_table",
                "table_nest_level": 1
            },
            "bbox": [
                157,
                90,
                724,
                275
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "磁盘调度算法"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                374,
                314,
                395
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "FCFS "
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                521,
                205,
                537
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "根循进程请求访问磁盈的光后顺序进仃调度。"
                    }
                ]
            },
            "bbox": [
                157,
                593,
                391,
                602
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "假设磁头的初始位置是100号磁道，有多个进程先后陆续地请求访间55、58、39、18、90、160、"
                    }
                ]
            },
            "bbox": [
                157,
                609,
                657,
                621
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "150、38、184号磁道"
                    }
                ]
            },
            "bbox": [
                159,
                621,
                272,
                631
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "按照FCFS的规则，按照请求到达的顺序，磁头需要依次移动到55、58、39、18、90、160、150、"
                    }
                ]
            },
            "bbox": [
                159,
                632,
                658,
                642
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "38、184号磁道"
                    }
                ]
            },
            "bbox": [
                159,
                642,
                242,
                652
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/6715f8f83cf458bbc7ddd4001a87f4129740b242242103a801fc59efd71aef9d.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                179,
                653,
                581,
                734
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "磁头总共移动了45+3+19+21+72+70+10+112+146=498个磁道"
                    }
                ]
            },
            "bbox": [
                171,
                737,
                495,
                747
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "响应一个请求平均需要移动498/9=55.3个磁道（平均寻找长度）"
                    }
                ]
            },
            "bbox": [
                171,
                747,
                507,
                758
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "优点：公平：如果请求访问的磁道比较集中的话，算法性能还算过的去"
                    }
                ]
            },
            "bbox": [
                173,
                758,
                542,
                768
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "缺点：如果有大量进程竞争使用磁盘，请求访问的磁道很分散，则FCFS在性能上很差，寻道时间长。"
                    }
                ]
            },
            "bbox": [
                173,
                768,
                685,
                778
            ]
        }
    ],
    [
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "SSTF算法会优先处理的磁道是与当前磁头最近的磁道。可以保证每次的寻道时间最短，但是并不能保证总的寻道时间最短。（其实就是贪心算法的思想，只是选择眼前最优，但是总体未必最优）"
                    }
                ]
            },
            "bbox": [
                152,
                89,
                608,
                110
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "假设磁头的初始位置是100号磁道，有多个进程先后陆续地请求访问55、58、39、18、90、160、150、38、184号磁道"
                    }
                ]
            },
            "bbox": [
                152,
                114,
                596,
                134
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/034efb01da8fe3382c42fb5418b56b2b04347c6621586962b3b364e200fd6a42.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                174,
                142,
                532,
                189
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "磁头总共移动了（100-18）+（184-18）=248个磁道"
                    }
                ]
            },
            "bbox": [
                164,
                190,
                389,
                199
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "响应一个请求平均需要移动248/9=27.5个磁道（平均寻找长度）"
                    }
                ]
            },
            "bbox": [
                164,
                199,
                463,
                209
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "优点：性能较好，平均寻道时间短"
                    }
                ]
            },
            "bbox": [
                166,
                209,
                326,
                218
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                166,
                218,
                305,
                227
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "Eg：本例中，如果在处理18号磁道的访问请求时又来了一个38号磁道的访问请求，处理38号磁道的访问请求时又来了一个18号磁道的访问请求。如果有源源不断的18号、38号磁道的访问请求"
                    }
                ]
            },
            "bbox": [
                164,
                227,
                610,
                246
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "到来的话，150、160、184号磁道的访问请求就永远得不到满足，从而产生“饥饿”现象。"
                    }
                ]
            },
            "bbox": [
                166,
                246,
                579,
                254
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [],
                "level": 1
            },
            "bbox": [
                378,
                310,
                529,
                322
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "SSTF算法会产生饥饿的原因在于：磁头有可能在一个小区域内来回来去地移动。为了防止这个问题，"
                    }
                ]
            },
            "bbox": [
                181,
                335,
                756,
                370
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "假设某磁盘的磁道为0~200号，磁头的初始位置是100号磁道，且此时磁头正在往磁道号增大的方向移动，有多个进程先后陆续地请求访问55、58、39、18、90、160、150、38、184号磁道"
                    }
                ]
            },
            "bbox": [
                181,
                374,
                754,
                398
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/022e70459533ed272df11792e4a197c8e65b09c84f920b183ddbc090d9cfa844.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                181,
                406,
                769,
                468
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "磁头总共移动了（200-100）+（200-18）=282个磁道 "
                    }
                ]
            },
            "bbox": [
                184,
                467,
                470,
                476
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "响应一个请求平均需要移动282/9=31.3个磁道（平均寻找长度）"
                    }
                ]
            },
            "bbox": [
                184,
                476,
                554,
                487
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": []
            },
            "bbox": [
                184,
                488,
                514,
                499
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "缺点：①只有到达最边上的磁道时才能改变磁头移动方向，事实上，处理了184号磁道的访问请求之后就不需要再往右移动磁头了。"
                    }
                ]
            },
            "bbox": [
                184,
                499,
                729,
                521
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "②SCAN算法对于各个位置磁道的响应频率不平均（如：假设此时磁头正在往右移动，且刚处理过90号磁道，那么下次处理90号磁道的请求就需要等磁头移动很长一段距离：而响应了184号磁道的请后组可以更次响应10A磁道的请了"
                    }
                ]
            },
            "bbox": [
                184,
                521,
                739,
                552
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "注意接下来的LOOK调度算法才是教材里的SCAN算法"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                593,
                561,
                609
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "扫描算法（SCAN）中，只有到达最边上的磁道时才能改变磁头移动方向，事实上，处理了184号磁道的访问请求之后就不需要再往右移动磁头了。LOOK调度算法就是为了解决这个问题，如果在磁"
                    }
                ]
            },
            "bbox": [
                156,
                617,
                665,
                649
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "假设某磁盘的磁道为0~200号，磁头的初始位置是100号磁道，且此时磁头正在往磁道号增大的方向移动，有多个进程先后陆续地请求访问55、58、39、18、90、160、150、38、184号磁道"
                    }
                ]
            },
            "bbox": [
                156,
                655,
                668,
                677
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/b817c2c6022ab989fc9c805b054a0788978f98f45bb9e43e3201d0ffaea1b0a5.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                159,
                684,
                680,
                743
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "磁头总共移动了（184-100)+（184-18)=250个磁道"
                    }
                ]
            },
            "bbox": [
                157,
                760,
                415,
                770
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "响应一个请求平均需要移动 "
                    },
                    {
                        "type": "equation_inline",
                        "content": "2 5 0 / 9 = 2 7 . 5"
                    },
                    {
                        "type": "text",
                        "content": "个磁道（平均寻找长度）"
                    }
                ]
            },
            "bbox": [
                159,
                771,
                490,
                780
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "优点：比起SCAN算法来，不需要每次都移动到最外侧或最内侧才改变磁头方向，使寻道时间进"
                    }
                ]
            },
            "bbox": [
                159,
                781,
                650,
                801
            ]
        }
    ],
    [
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "CSCAN 算法"
                    }
                ],
                "level": 1
            },
            "bbox": [
                147,
                99,
                282,
                120
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "SCAN算法对于各个位置磁道的响应频率不平均，而C-SCAN算法就是为了解决这个问题。规定"
                    }
                ]
            },
            "bbox": [
                194,
                198,
                1000,
                249
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "假设某磁盘的磁道为0~200号，磁头的初始位置是100号磁道，且此时磁头正在往磁道号增大移动，有多个进程先后陆续地请求访问55、58、39、18、90、160、150、38、184号磁道"
                    }
                ]
            },
            "bbox": [
                194,
                256,
                1000,
                292
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/226f8f9efbde596ee2f5c1dd964218887404c7901b3ffd49dfc5692c5427c9bb.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                206,
                304,
                1000,
                399
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "磁头总共移动了（200-100)+（200-0)+（90-0)=390个磁道响应一个请求平均需要移动390/9=43.3个磁道（平均寻找长度）优点：比起SCAN来，对于各个位置磁道的响应频率很平均。"
                    }
                ]
            },
            "bbox": [
                196,
                405,
                756,
                456
            ]
        },
        {
            "type": "title",
            "content": {
                "title_content": [
                    {
                        "type": "text",
                        "content": "注意接下来的C-LOOK调度算法才是我们教材中的的CSCAN算法"
                    }
                ],
                "level": 1
            },
            "bbox": [
                146,
                512,
                640,
                527
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "C-SCAN算法的主要缺点是只有到达最边上的磁道时才能改变磁头移动方向，并且磁头返回时不一定需要返回到最边缘的磁道上。C-LOOK算法就是为了解决这个问题。如果磁头移动的方向上已经没有磁道访问请求了，就可以立即让磁头返回，并且磁头只需要返回到有磁道访问请求的位置即可。"
                    }
                ]
            },
            "bbox": [
                179,
                531,
                791,
                569
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "移动，有多个进程先后陆续地请求访间55、58、39、18、90、160、150、38、184号磁道"
                    }
                ]
            },
            "bbox": [
                181,
                575,
                791,
                600
            ]
        },
        {
            "type": "image",
            "content": {
                "image_source": {
                    "path": "images/0dfc46361cf1b6017a26cbbc71da325cdbe3b8dc68d72048025b36b1f71a3602.jpg"
                },
                "image_caption": [],
                "image_footnote": []
            },
            "bbox": [
                188,
                607,
                836,
                706
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "假脱机技术：用ru"
                    }
                ]
            },
            "bbox": [
                144,
                734,
                294,
                751
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "脱离主机的控制进行的输入/输出操作"
                    }
                ]
            },
            "bbox": [
                147,
                753,
                440,
                769
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "在磁盘上开辟两个存储区域——输入井和输出井"
                    }
                ]
            },
            "bbox": [
                147,
                772,
                522,
                788
            ]
        },
        {
            "type": "paragraph",
            "content": {
                "paragraph_content": [
                    {
                        "type": "text",
                        "content": "外围控制机"
                    }
                ]
            },
            "bbox": [
                147,
                791,
                240,
                806
            ]
        }
    ]
]