![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
操作系统
苏青歆
这个作者很懒,什么都没留下…
展开
-
电梯调度算法
假设要求从系统中输入N个需访问的柱面号,当前磁头的移动方向由键盘输入(1代表磁头从外往内移动,-1代表磁头由内往外移动),当前磁头刚完成访问序号为M的柱面,请编程输出采用电梯调度算法得到的柱面访问序列号,同时输出读/写磁头总共移动的距离(用柱面数表示) #include<cstdio> #include<algorithm> using namespace std; const int maxn = 1e5 + 5; int t[maxn]; int pre, now, dir原创 2021-12-25 23:33:44 · 498 阅读 · 0 评论 -
优先调度算法
优先数调度算法来模拟实现处理器调度过程。 //利用C/C++模拟进程调度,运用优先调度算法 #include<stdio.h> #include<stdlib.h> #include<algorithm> using namespace std; enum process_status{READY, RUN, FINISH}; //进程的三种状态 typedef struct pcb //定义进程数据结构 { struct原创 2021-12-25 23:32:47 · 562 阅读 · 0 评论 -
请求分页式存储管理的页面置换
在分页式虚拟存储管理中,要求通过键盘输入分配给一个作业的物理块数和作业依次访问的10个页面号,采用先进先出(FIFO)页面置换后,顺序输出缺页中断时所淘汰的页面号,并计算缺页中断率。 #include<cstdio> using namespace std; const int maxn = 1e5 + 5; int page_now; int page_num, space_num; int flag[maxn], space_array[maxn]; int main() {原创 2021-12-25 23:31:49 · 915 阅读 · 0 评论 -
响应比高优先调度算法
#include<cstdio> #include<algorithm> using namespace std; const int maxn = 1e4 + 5; int flag[maxn]; struct { char name[maxn]; int arrive, time_sum; }JOB1[maxn]; struct { char name[maxn]; int arrive, time_sum, start_time, en原创 2021-12-25 23:30:32 · 719 阅读 · 0 评论 -
可变分区存储管理的空间分配与去配
#include <stdio.h> #include <stdlib.h> #include <string.h> #define JOB_MAX 10 struct { int id, length, address; }used_table[JOB_MAX]; struct f_table { int length, address; }free_table[JOB_MAX + 1]; int free_num = 1; int used_n原创 2021-12-25 23:29:27 · 564 阅读 · 0 评论 -
银行家算法
#include<cstdio> using namespace std; #define true 1 #define false 0 #define MAXINT 9999 //typedef int bool; bool Finish[100]; int request[100]; int processNum = 5; int resourceNum = 3; int available[100] = {3, 3, 2}; int safeSeries[100] = {MAXIN原创 2021-12-25 23:28:00 · 275 阅读 · 0 评论