首页 > 系统相关 >COMP SCI 3004操作系统的虚拟内存模拟

COMP SCI 3004操作系统的虚拟内存模拟

时间:2023-09-01 20:11:53浏览次数:43  
标签:SCI trace simulator COMP each your memory page 虚拟内存

SCI 3004
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.

 

标签:SCI,trace,simulator,COMP,each,your,memory,page,虚拟内存
From: https://www.cnblogs.com/goodnewss/p/17672754.html

相关文章

  • COMP 636 BRMM模型算法
    COMP636:PythonAssessmentDue:5pmMonday28August2023Worth40%ofCOMP636gradeSubmitviaAkoraka|LearnIntroductionTheBankside-RakaiaMotorkhanaMavens(BRMM)carclubhasaskedforasystemtohelpmanageitsAugust‘Have-a-goFunMotorkhana’ev......
  • COMP3610编程技巧几点看法
    COMP3610/6361PrinciplesofProgrammingLanguagesAssignment1ver1.1SubmissionGuidelinesDuetime:Aug31,2023,11am(CanberraTime)SubmitapdfviaWattle.Scansofhand-writtentextarefine,aslongastheyarereadableandneat.Pleasereadandsign......
  • COMP8711数据库建模与信息管理
    FlindersUniversity2023S2COMP8711DatabaseModellingandInformationManagementAssignment1Duedate:10September2023Thisassessmentisanindividualassessment.Theassignmentisworth25%ofthetotalassessment.Itwillbemarkedoutof25.GeneralSpe......
  • COMP123 2D图形算法难点讨论
    COMP123Primitive2DDrawingAssignmentSpecificationInthisassignment,youwillberequiredtoimplementsomeofthealgorithmsthatwehavediscussedinlectures.Youwillneedtowriteagenericframebufferclassthatisabletorepresentimagesandd......
  • Further reading: Theory of computation
    找了些:https://en.wikipedia.org/wiki/Theory_of_computation提到的书籍:Textbooksaimedatcomputerscientists(Therearemanytextbooksinthisarea;thislistisbynecessityincomplete.)Hopcroft,JohnE.,and JeffreyD.Ullman (2006). IntroductiontoAut......
  • AtCoder Beginner Contest 292 D - Unicyclic Components
    D-UnicyclicComponents原题链接题意:判断一个连通块的边和点个数是否相同思路:对它使用并查集吧点击查看代码#include<bits/stdc++.h>usingnamespacestd;constintN=200010,M=N<<1;//维护连通图中点和边的个数intsd[N],se[N],p[N];boolf[N];//谁是祖宗int......
  • Beyond Compare使用小技巧
    有时候我们需要比较文件夹内容是否相同,这个时候,可以使用BeyondCompare比较小技巧:可以设置Rule来进行比较规则的设置,这个地方我忽略了时间戳 ......
  • AQS的enq方法中的compareAndSetTail
      (1)比较和替换的都是地址,比较expect和tailoffset的内容(地址)是否相等,相等后让tailoffset存储update(地址)的内容,而不是将tailoffset指向的内容,替换为update指向的内容。(2)大部分时候如果true即tailoffset和expect是相等的,但忽略了他们只是内容(此处指向的对象相同),以前我经常当成......
  • OGG_Linux_x64_BigData启动ggsci时报错:error while loading shared libraries: libjvm
    问题描述:[root@hadoop03ggs]$./ggsci./ggsci:errorwhileloadingsharedlibraries:libjvm.so:cannotopensharedobjectfile:Nosuchfileordirectory 解决办法:1.查看缺少那些.so文件[root@hadoop03/]# lddggsci 2.查libjvm.so库文件的路径[root@hadoop0......
  • centos 安装 docker-compose 的快速简单办法
    直接使用yuminstalldocker-compose 会返回nothingtodo,可以使用pip3来安装安装DockerCompose(1)执行如下命令安装 pip3:yum-yinstallpython3-pippip3install--upgradepip-ihttps://pypi.tuna.tsinghua.edu.cn/simple (2)执行如下命令安装 docker-compose:......