1 |
- (window.webpackJsonp=window.webpackJsonp||[]).push([[58],{347:function(t,s,a){"use strict";a.r(s);var n=a(14),r=Object(n.a)({},(function(){var t=this,s=t._self._c;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"实验三-进程调度"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#实验三-进程调度"}},[t._v("#")]),t._v(" 实验三 - 进程调度")]),t._v(" "),s("h2",{attrs:{id:"前言"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#前言"}},[t._v("#")]),t._v(" 前言")]),t._v(" "),s("p",[t._v("(1)为什么要引入进程调度?")]),t._v(" "),s("p",[t._v("(2)主要针对单核处理机的调度算法做研究")]),t._v(" "),s("p",[t._v("(3)历史发展脉络")]),t._v(" "),s("p",[t._v("(4)进程调度的性能指标是什么")]),t._v(" "),s("p",[t._v("(5)进程切换")]),t._v(" "),s("p",[t._v("(6)进程调度的实现")]),t._v(" "),s("h2",{attrs:{id:"一、实验目的"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#一、实验目的"}},[t._v("#")]),t._v(" 一、实验目的")]),t._v(" "),s("p",[t._v("\t操作系统的内核中实现的调度器比较复杂,其本质组成就是3大模块:就绪队列、调度器、分配器。")]),t._v(" "),s("p",[t._v("\t在本次实验中,三者之中的就绪队列将会作为参数提供给你,你需要实现的是调度器,然后由系统本身实现的分配器调用你事先的调度器,以检验算法的正确性。")]),t._v(" "),s("p",[t._v("\t实现调度器的最困难的地方在于实现调度算法(抛开提高性能、降低耦合性等事实不谈),请你结合实验教程完成调度算法的实现,并按照规范实现程序接口,以保证整个系统能够运行。")]),t._v(" "),s("h2",{attrs:{id:"二、实验步骤"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#二、实验步骤"}},[t._v("#")]),t._v(" 二、实验步骤")]),t._v(" "),s("h3",{attrs:{id:"_1-进程控制块-pcb-结构"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_1-进程控制块-pcb-结构"}},[t._v("#")]),t._v(" 1. 进程控制块(PCB)结构")]),t._v(" "),s("p",[t._v("\t进程控制块(PCB)是操作系统中用于管理和描述进程的数据结构。它存储了一个进程的相关信息,包括进程状态、程序计数器、寄存器值、内存分配信息、打开的文件列表等。")]),t._v(" "),s("p",[t._v("\t在本次实验中,我们已经帮你设计好了PCB,你需要理解PCB中的每个变量的作用以及意义,在此基础上实现调度算法,并通过实验数据测试。")]),t._v(" "),s("p",[t._v("\t下面是我们规定的PCB结构体:")]),t._v(" "),s("div",{staticClass:"language-cpp extra-class"},[s("pre",{pre:!0,attrs:{class:"language-cpp"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("struct")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("PCB")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" pid"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 进程ID")]),t._v("\n string name"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 进程名称")]),t._v("\n string state"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 进程状态 (一般来说 就绪队列里面的进程都是Ready状态)")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" priority"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 进程优先级")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" burst_time"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 进程的执行时间")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" remain_time"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 剩余执行时间")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" arrive_time"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 进程到达时间")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])]),s("p",[t._v("\t该结构体具有上述变量。对于不同的编程语言,变量名称都与上面的代码一致。")]),t._v(" "),s("h3",{attrs:{id:"_2-调度策略"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#_2-调度策略"}},[t._v("#")]),t._v(" 2. 调度策略")]),t._v(" "),s("p",[t._v("\t在这一步,你需要根据不同的调度策略设计响应的调度算法,调度策略有以下几种:")]),t._v(" "),s("ul",[s("li",[s("p",[t._v("FCFS(First Come First Serve)")])]),t._v(" "),s("li",[s("p",[t._v("RR(Round-Robin,轮转调度)")])]),t._v(" "),s("li",[s("p",[t._v("SJF(Shortest Job First,最短作业优先)")])]),t._v(" "),s("li",[s("p",[t._v("MLFQ(多级反馈队列调度)")])]),t._v(" "),s("li",[s("p",[t._v("CFS(Completely Fair Scheduler,完全公平调度器)")])])]),t._v(" "),s("p",[t._v("\t请跳转到响应的实验教程中继续完成实验。")]),t._v(" "),s("h2",{attrs:{id:"课外资料"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#课外资料"}},[t._v("#")]),t._v(" 课外资料")])])}),[],!1,null,null,null);s.default=r.exports}}]);
|