COMP SCI 3004/7064 Operating Systems
Practical 2 – Virtual Memory Simulation
Aim
By doing this practical work, you will learn how to implement page replacement algorithms, gain
experience in creating and evaluating a simple simulator, and develop your skills in scientific
writing.
You should work in groups of size 2 or 3. Each group will submit one simulator and one report.
Deadlines: Code is due Tuesday 5th September 2023.
Report due end of week 8 - Friday 15th September.
Introduction
In chapter 22, we explore a variety of page replacement algorithms for managing virtual memory.
The choice of a page replacement algorithm is actually quite a complex matter. To make the
proper choice, we must know something about real applications. How do they access memory? Do
they generate many page accesses in order? Do they skip around memory randomly? The only
way to answer these questions is to see what real applications do.
In this practical, you will evaluate how real applications respond to a variety of page replacement
algorithms. Of course, modifying a real operating system to use different page replacement
algorithms is quite difficult, so we will simulate it instead. You will write a program that emulates
the behaviour of a memory system using a variety of page replacement algorithms.
Then, you will use memory traces from real applications to evaluate your algorithms properly. A
main outcome of your work will be a report. The report itself counts for 60% of this assignment.
Memory Traces
We provide you with four memory traces to use with your simulator. Each trace is a real recording
of a running program, taken from the SPEC benchmarks. Real traces are enormously big: billions
and billions of memory accesses. However, a relatively small trace will be more than enough to
capture their memory access patterns. Each trace consists of only one million memory accesses
taken from the beginning of each program.
Each trace is a series of lines, each listing a hexadecimal memory address followed by R or W to
indicate a read or a write. For example, gcc.trace trace starts like this:
0041f7a0 R
13f5e2c0 R
05e78900 R
004758a0 R
31348900 W
Each trace is compressed with gzip, so you will have to download each trace and then uncompress
it with a command like this:
> gunzip –d gcc.trace.gz
Simulator Requirements
Your job is to build a simulator that reads a memory trace and simulates the action of a virtual
memory system with a single level page table. The current simulator fixes the pages and page
frames size to 4 KB (4096 bytes). Your program should keep track of what pages are loaded into
memory. The simulator accepts 4 arguments as follows:
• the name of the memory trace file to use.
• the number of page frames in the simulated memory.
• the page replacement algorithm to use: rand/lru/esc
• the mode to run: quiet/debug
If the mode is "debug", the simulator prints out messages displaying the details of each event in
the trace. The output from “debug” it is simply there to help you develop and test your code. If the mode is "quiet", then the simulator should run silently with no output until the very end, at which
point it prints out a summary of disk accesses and the page fault rate.
As it processes each memory event from the trace, the simulator checks to see if the corresponding
page is loaded. If not, it should choose a page to remove from memory. Of course, if the page to
be replaced is dirty, it must be saved to disk. Finally, the new page is to be loaded into memory
from disk, and the page table is updated. As this is just a simulation of the page table, we do not
actually need to read and write data from disk. When a simulated disk read or disk write must
occur, we simply increment a counter to keep track of disk reads and writes, respectively.
Most of the input (reading a trace), simulation counters and output messages has already being
implemented in the skeleton files provided for you.
The skeleton reads the parameters, processes the trace files and for each access it generates a page
read or write request. Your job is to complete the simulation of the memory management unit for
each replacement policy:
• rand replaces a page chosen completely at random,
• lru always replaces the least recently used page
• clock performs the replacement algorithm described in the textbook section 22.8.
You should start thinking how you can keep track of what pages are loaded, how to find if the
page is resident or not, and how to allocate frames to pages. Some short traces (trace1, trace2 and
trace3) will be used in the testing script and are provided to facilitate local testing of your code.
Report
An important component of this practical is a report describing and evaluating the replacement
algorithms. Your goal is run the simulator to learn as much as you can about the four memory
traces (swim, bzip, gcc and sixpack). For example,
How much memory does each traced program actually need?
Which page replacement algorithm works best when having a low number of frames?
Does one algorithm work best in all situations?
Think carefully about how to run your simulator. Do not choose random input values. Instead,
explore the space of memory sizes intelligently to learn as much as you can about the nature of
each memory trace.
Your group report should have the following sections:
• Introduction: A brief section that describes using your own words the essential problem of
page replacement you are trying to investigate. Do not copy and paste text from this
project description.
• Methods: A description of the set of experiments that you performed. As it is impossible to
run your simulator with all possible inputs, so you must think carefully about what
measurements you need. Make sure to run your simulator with an excess of memory, a
shortage of memory, and memory sizes close to what each process actually needs.
• Results: A description of the results obtained by running your experiments. Present the
results using graphs that show the performance of each algorithm on each memory trace
over a range of available memory sizes (alike figures 22.6 to 22.9 in the textbook). For
each graph, explain the results and point out any interesting or unusual data points.
• Conclusions: Summarize what you have learned from the results.
The group report must be concise, well structured and free of typos and errors. For reference, a
typical report length should be around 4 to 6 pages, roughly one page for the introduction and
methods, half to one page per trace (graph and analysis of its results) and half to one page for
conclusions.
相关推荐
Android 13 Hotseat定制化修改——001 hotseat布局方向
一.背景由于需求是需要自定义修改Hotseat,所以此篇文章是记录如何自定义修改hotseat的,应该可以覆盖大部分场景,修改点有修改hotseat布局方向,hotseat图标数量,hotseat图标大小,hotseat布局位置,hotseat图标禁止形成文件夹,hotseat图标禁止移动到Launcher...
COMP SCI 3004/7064 Operating Systems Practical 2 – Virtual Memory SimulationR
only0041f7a0 R13f5e2c0 R05e78900 R004758a0 R31348900 Wsingleleveljustasimulationbrief。
最终篇——SWAT模型的建立
同理,Soil Data也是同样的方法导入,在Soil Database Options的选项中,选择UserSiol,用同样的方法导入土壤类型,进行重分类。打开窗口后,只定义HRU Thresholdes,其余两个不用设置,设定各数据单元的计算率,这里的10%的意思是计算精度,即分成级HRU计算单元太小,小于平均计算单元的10%,我们就不对这HRU单元进行计算(也就是说太破碎的计算单元不进行计算),若选择0%意味着全部进行计算,需要耗费大量的内存和时间,对计算机要求较高,不建议。
InnoDB 内存结构总览:Change Buffer、AHI 与 Log Buffer
本文系统梳理InnoDB内存结构中的ChangeBuffer、Adaptive Hash Index(AHI)与LogBuffer。ChangeBuffer缓存二级索引页不在内存时的变更,减少随机IO,仅在页加载时合并;聚簇索引修改立即执行,因数据本身不可延后。AHI基于高频等值查询自动构建哈希索引,加速定位,仅支持等值操作。LogBuffer为redo log内存缓冲,配合磁盘日志实现崩溃恢复。三者均服务于性能优化,其中ChangeBuffer与AHI共享BufferPool空间,而LogBuffer独立
【Boost5】Boost变换器的输入电容
节点的电流有3个,一个是来自电源输入的,由于我们把Vin看成理想电源以及线路的电感的存在,它可以近似看作是恒定的电流源Iin,一个是流向输入电容Cin的电流Icin,另外一个节点是电感L电流IL。电容电流波形在整个开关周期内的平均值为0,充电和放电在一个周期中各占1/2,在图中充电部分面积和放电部分面积相等,那么在充电或放电的电荷量Q=I*t,从图中可以看出,在一个周期内电容电流变化量是ΔIL,那在电容在充电1/2T周期中电流的变化量是1/2ΔIL。输入电容上的ESR也会随着电流变化,影响输入电压的变化。
[亚信线上教学] AX58100: EtherCAT从站设备仿真功能设计教学
什么情况需要开启EtherCAT从站设备仿真功能呢? 一般来说, 当EtherCAT从站产品,不需要使用额外的微控制器介入,或使用不具备EtherCAT从站通讯协议栈的微控制器一同协作的情况下,就必须开启EtherCAT从站设备仿真功能,这样EtherCAT主站才能够正常设置从站设备的工作状态. 亚信AX58100 EtherCAT从站控制芯片的优点 AX58100 EtherCAT从站控制器, 集成2个百兆以太网Phis, 并支持一些额外的控制接口, 例如脉冲宽度调变, 增量, 霍尔编码器, .
信创环境下PageOffice文档控件适配与实践
信创适配做到文档控件这一层,拼的已经不是"有没有国产版本",而是同一个功能在两类终端上是否真的等价。等价的标准很具体:同一次点击能得到同样的结果,同一份公文能得到同样的版式,同一个项目不需要维护两套代码。这背后是三件并不轻松的工作:服务端用一套接口同时支撑两类终端,客户端把两种系统与四种芯片的安装包分发清楚,文档内核层由产品侧跟着 WPS 的版本走。浏览器这一层的压力,则被收进了产品自己的窗口里——升级节奏由产品掌握,不再交给运气。
数据分享:中国历年省、市、县行政区划shp(1949~2023年共计75年)
中华人民共和国县级以上行政区沿革》(三册,1949-1983年)“The Atlas of Changes of Administrative Regions of China”;《中华人民共和国行政区划沿革地图集》The yearly publications of “The Administrative Regions”, 1985-2014;每年的出版行政区划简册(1985-2014年)行政区划网:www.xzqh.org。行政区划网:www.xzqh.org。
第三篇 第 6 课
前置:第三篇第 1 课(stdx 引入),第二篇第 1 课(std.regex)。环境:仓颉 SDK 1.2.0。本文所有代码与输出均逐行实测。
1、VMware vSphere 全面指南:从入门到精通
本文全面介绍了VMware vSphere从入门到精通的完整知识体系,涵盖基础概念、环境适配、部署规划、安装配置、网络与存储准备、虚拟机创建与管理、资源组织、事件监控、巡检流程、主机配置文件管理、资源池优化、高可用性与容错应用,以及故障排除方法。结合实用工具和部署技巧,帮助读者系统掌握vSphere的核心功能与运维实践,提升虚拟化环境的稳定性与管理效率。
【DEIM创新改进】独家下采样创新改进篇 | ECCV 2026 | DEIM 引入FSD-Down频域-空间动态下采样,在下采样过程中保留小目标的高频信息、助力小目标检测、遥感小目标检测有效涨点
🔥本文提出了一种名为FSD-Down的频域-空间动态下采样模块,用于改进DEIM网络模型在小目标检测中的性能。FSD-Down通过小波分解显式保留低频语义和高频细节,结合分组卷积、动态通道权重和可学习缩放因子,自适应强化目标边缘与纹理特征。该模块能有效减轻传统下采样造成的频率混叠和细节丢失,提升对小目标、密集目标和低对比度目标的检测能力。实验表明,FSD-Down计算开销可控,在保持实时性的同时显著提升检测精度,特别是在VisDrone和AITODv2数据集上对小目标的检测性能提升显著。
【从零理解 Spring AI · 12】MCP 的两种角色:做客户端还是做服务端
上一篇讲了 MCP 的概念:标准协议、三大角色、M+N 替代 M×N。
推荐系统中召回率Recall计算方式附代码
Recall(召回率)是指在所有实际有交互的用户 - 物品对中,推荐系统成功预测出的比例。具体来说,设所有有交互的用户 - 物品对为S,推荐系统预测出的用户 - 物品对为T,则Recall的计算公式为:
pcl2启动器下载(Minecraft PCL2 启动器 最新版 安装与使用说明)
摘要:PCL2(Plain Craft Launcher 2)是一款面向 Minecraft 的第三方启动器,支持正式版与快照版本管理、模组与整合包安装、Java 运行时自动匹配,绿色免安装、双击即可运行。适合在 Windows 上玩单机整合包、需要多版本共存或离线启动的用户使用
efm32 入门.pdf
本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。
Probability and Statistics - 4th edition
Probability and Statistics - 4th edition
spring boot 4集成SQLLite,及其SQLLite的建库
spring boot 4集成SQLLite,及其SQLLite的建库
老版QQ原生表情gif动态
这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。
Java 集合容器高频面试题全解:HashMap 树化阈值、1.7 死循环与 ConcurrentHashMap 演进(2026 招聘 JD 真题复盘)
HashMap 树化阈值 8 的泊松分布依据、退化阈值 6 的防抖设计、JDK 1.7 头插成环死循环的排查与修复、1.8 尾插后为何仍线程不安全、ConcurrentHashMap 放弃分段锁的原因与 ForwardingNode 协作扩容、computeIfAbsent 死锁陷阱、大集合找重复的场景题选型,附三层追问链自测。题目来源为 38 期公开招聘 JD 样本与字节、拼多多、建行、美团、快手公开面经。
精雕软件(JDpaint) 5.5 绿色版
精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版
spdlog 同步日志库使用详解
spdlog是一个轻量级 C++ 日志库,支持同步日志、异步日志、多线程日志、日志文件轮转和自定义日志格式。对于嵌入式 Linux 应用开发,我建议先使用。它可以帮我们完成:日志级别过滤。时间戳和线程 ID 输出。日志格式化。终端和文件输出。多线程安全写入。日志文件按大小或时间轮转。我们不需要自己实现互斥锁、文件写入、日志格式化和轮转等底层功能。
JavaSE通关手册:数据类型与变量
代码无需额外处理,编译时编译器自动完成转换。
IDEA 简介:从零认识 IntelliJ IDEA
IDEA 全称,是由 JetBrains 公司开发的一款主流 Java 集成开发环境(IDE)。它集代码编辑、编译、调试、测试、版本控制、构建管理等功能于一体,被大量 Java 开发者视为日常开发的首选工具。所谓 IDE(Integrated Development Environment,集成开发环境),就是把写代码所需的各类工具整合到同一个界面中。相比只用文本编辑器加命令行编译,IDE 能显著减少重复操作,让开发者把精力集中在业务逻辑上。
Docker部署linkding:HTTPS与数据备份
部署私人书签库,除了让页面能够打开,还需要考虑几个实际问题:重建容器后数据是否保留、登录和保存是否正常、升级前怎样备份,以及出现 502 或 CSRF 错误时从哪里检查。本文使用 Docker Compose 部署 linkding,采用默认 SQLite 数据库,通过 Caddy 提供 HTTPS,并完成账户创建、数据持久化验证和备份。如果重建后账户或书签消失,应先检查是否换了项目目录、改了挂载路径,或者启动了另一套实例,不要急着重新初始化。遇到权限问题,应根据日志确认具体目录和运行用户,再调整权限。
动态代理两大流派:JDK 代理与子类代理
业务类想加日志,最直白的写法是侵入式修改: 问题很明显:每个方法都要改一遍,改一个业务要动十处。代理模式的解法是:调用方不直接依赖 ,而是依赖一个代理对象。代理对象长得跟目标一模一样,调用它 → 代理先执行增强逻辑 → 再转调真实对象。 关键在于:代理对象的类型是哪来的?这就是"动态"二字的含义:代理类在运行时才诞生。两个角色: 承载增强逻辑, 负责生成代理类。 组装代理并调用: 输出: 业务代码 一行没动,增强逻辑全在 里。这就是 AOP 的味道。 内部四步: 第 2 步 内部:先查 (同一个接口
C++20协程怎么运行?原理与三大核心组件深度剖析
C++20协程是轻量级的无栈状态机,通过co_await、co_yield、co_return实现挂起与恢复,由Promise、协程句柄和Awaitable三大组件协同工作。协程与线程互补,适用于高效管理大量并发I/O任务,显著降低上下文切换开销。其核心在于编译器生成的状态机机制,需配合库(如cppcoro)使用。掌握Promise控制逻辑、句柄生命周期管理及Awaitable语义,是构建高性能异步程序的基础。
c++ explicit关键字详解
explicit。
TRingBuffer两端都能增删(快递站版)
TRingBuffer 是一个支持两端增删、下标访问且容量动态增长的环形双端队列。它通过无符号索引的永不归零设计,利用减法自动模运算实现空满判断与元素计数,避免了传统环形缓冲浪费格子的问题。内部以票号(索引)标记首尾,扩容时重排元素为连续存储,保证 O(1) 操作与高缓存效率。虽不线程安全,但其高效性使其成为游戏开发中事件队列、命令缓冲等场景的理想选择。
Teamcenter Java SOA 开发:连接、查询与保存
本文介绍如何通过 Java 调用 Teamcenter SOA 接口实现外部系统对接,涵盖连接登录、查询保存等核心操作。以最小闭环示例展示 Connection、Service、ModelObject 等关键组件的使用,强调错误处理与事务管理要点。梳理了 DataManagement、Query、File Management 等 API 模块分工,并结合“工作移交WebService”案例,说明幂等性设计与流程状态返回的重要性。适用于 Web 门户、ERP 集成等场景,建议批量操作用 bulk 接口优化性
Java 项目实战:交友项目后台系统——网关统一鉴权与 B 端管理后台
本次改造通过引入SpringCloud Gateway实现网关统一鉴权与路由,新建mf-admin管理端复用C端域服务(Dubbo调用),实现管理员登录与用户管理四件查询。核心套路:网关白名单+双体系JWT(同工具不同payload)、管理端零直连业务库、分页形态区分(MySQL自动count/Mongo手动count)、浏览器端独立聚合。踩坑12条,附自检清单与后续改造方向,可复用于多角色后台系统。
1104



被折叠的 条评论
为什么被折叠?



