没有合适的资源?快使用搜索试试~ 我知道了~
操作系统实验报告
资源推荐
资源详情
资源评论
学校
珠海科技学院
班级
软工 3 班
科目
操作系统
学院
计算机学院
姓名
张炳权
日期
2023.5.20
专业
软件工程
学号
04211513
实验名称
实验七 页面置
换 FIFO
实验内容
第 1 题
编写一个程序,用 rand()生成一个随机的页访问序列,该序列长度为 320;采用 FIFO 的页面置
换策略,计算当页数为 32,帧数为 4~32 时的页面访问命中率。(命中率=1-页面失效次数/页
面访问序列长度。)
代码或命令
#include <stdio.h>
#include<unistd.h>
#include<time.h>
#include<stdlib.h>
struct pl_type
{
int pn,pfn,time;
};
struct pfc_struct
{
int pn,pfn;
struct pfc_struct * next;
};
int s[320];
struct pl_type pl[32];
struct pfc_struct pfc[32];
struct pfc_struct * freepf_head;
void initial(int pf);
void lru(int pf);
int main()
{
int i,total_pf;
srand(getpid());
for(i=0;i<320;i++)
{
s[i]=rand()%32;
}
for(total_pf=4;total_pf<=32;total_pf++)
{
initial(total_pf);
lru(total_pf);
资源评论
小柒_02
- 粉丝: 752
- 资源: 20
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功