91精品国产91久久久久久_国产精品二区一区二区aⅴ污介绍_一本久久a久久精品vr综合_亚洲视频一区二区三区

合肥生活安徽新聞合肥交通合肥房產生活服務合肥教育合肥招聘合肥旅游文化藝術合肥美食合肥地圖合肥社保合肥醫院企業服務合肥法律

代寫 COMP 310、代做 java/Python 程序
代寫 COMP 310、代做 java/Python 程序

時間:2025-04-14  來源:合肥網hfw.cc  作者:hfw.cc 我要糾錯



Operating Systems COMP 310 – ECSE 427 McGill University Project Part #3: Memory Management
Due: April 4, 2025 at 23:59
1. Assignment Description
This is the final assignment. After implementing the memory manager, you will have built a simple, simulated OS. So far, our simulated OS supports simple Shell commands and is capable to do process management according to different scheduling techniques. The assumption in the second assignment was that processes fully fit in the Shell memory (like what we saw in the Virtual Memory lecture). In this assignment, we will extend the simulation with demand paging.
1.1 Starter files description:
You have two options:
• [Recommended] Use your solution to Assignment 2 as starter code for this assignment. If your solution passes the public unit tests it is solid enough to use as a basis for the third assignment.
• Use the official solution to Assignment 2 provided by the OS team as starter code.
1.2 Your tasks:
Your tasks for this assignment are as follows:
• Add scaffolding for paging.
• Design and implement demand paging.
• Implement the LRU replacement policy in demand paging.
On a high level, in this assignment we will allow programs larger than the shell memory size to be run by our OS. We will split the program into pages; only the necessary pages will be loaded into memory and old pages will be switched out when the shell memory gets full. Programs executed through both the source and the exec commands need to use paging. In addition, we will further relax the assumptions of exec by allowing the same program to be executed multiple times by exec (remember that in Assignment 2 the programs run by exec needed to be different).
For simplicity, in our tests for this assignment we will
However, the paging mechanism will work with the other scheduling policies as well, if it is implemented
correctly. The API for exec does not change, so you still need to specifically pass the RR argument. More details on the behavior of your memory manager follow in the rest of this section. Even though we
will make some recommendations, you have full freedom for the implementation. In particular:
• Unless we explicitly mention how to handle a corner case in the assignment, you are free to handle corner cases as you wish, without getting penalized by the TAs.
• You are free to craft your own error messages (please keep it polite).
Balmau, Kopinsky Assignment #3 Page 1 of 7
  Similar to Project Part 2, this assignment is larger than Part 1 and MP.
 Plan your time wisely and don’t hesitate to ask questions on Discord if you get stuck.
   only consider the RR (round robin) policy, with a
 time slice of 2 instructions, with no multithreading and no background execution (the # parameter).

Operating Systems COMP 310 – ECSE 427 McGill University
• Just make sure that your output is the same as the expected output we provide in the test cases in Section 2.
• Formatting issues in the output such as tabs instead of spaces, new lines, etc. will not be penalized.
Let’s start programming!☺
1.2.1. Implement the paging infrastructure
We will start by building the basic paging infrastructure. For this intermediate step, you will modify the source and exec commands to use paging. Note that, even if this step is completed successfully, you will see no difference in output compared to the source/exec commands in Assignment 2. However, this step is crucial, as it sets up the scaffolding for demand paging in the following section.
As a reminder from Assignment 1, the source API is:
source SCRIPT Executes the commands in the file SCRIPT
source assumes that a file exists with the provided file name, in the current directory. It opens that text file and then sends each line one at a time to the interpreter. The interpreter treats each line of text as a command. At the end of the script, the file is closed, and the command line prompt is displayed.
The exec API is: exec prog1 prog2 prog3 POLICY
• As in Assignment 2, we will not be testing recursive exec calls.
• Unlike Assignment 2, exec now supports running the same script (i.e., exec can take identical
arguments so exec prog1 prog1 is a legal instruction).
You will need to do the following to implement the paging infrastructure.
1. Set up process sharing.
o Whenexecispassedthesamescriptnametwice,wewillwanttosharememorybetween them. Modify your existing code loading setup from A2 so that two scripts with the same name can share their loaded code. If you loaded code contiguously, you have something like base+bounds virtual memory. Allow multiple processes with the same name to use the same base and bounds.
2. Partitioning the Shell memory. The shell memory will be split into two parts:
o Frame store. A part that is reserved to load pages into the shell memory. The number of lines in the frame store should be a multiple of the size of one frame. In this assignment, each page consists of 3 lines of code. Therefore, each frame in the frame store has 3 lines. If you implemented code memory separately from variable memory in A2, then there’s
probably very little to do here.
o The frame size of 3 is an unfortunate complication (a power of two would
usually make more sense). We have set it up this way so that we can test interesting cases of demand paging without having you implement more scheduling policies. For address translation, you can will probably want to use the / and % operators to separate the page number and offset respectively.
o Variable store. A part that is reserved to store variables.
Balmau, Kopinsky Assignment #3 Page 2 of 7

Operating Systems COMP 310 – ECSE 427 McGill University
You are free to implement these two memory parts as you wish. For instance, you can opt to maintain two different data structures, one for loading pages and one for keeping track of variables. Alternatively, you can keep track of everything (pages + variables) in one data structure and keep track of the separation via the OS memory indices (e.g., you can have a convention that the last X lines of the memory are used for tracking variables). We think maintaining separate data structures is easier.
For now, the sizes of the frame store and variable store can be static. We will dynamically set their sizes at compile time in the next section.
3. Code loading. The shell will load script(s) into the frame memory as follows.
o The given script files are used to load program pages into the frame store. If exec receives the
same filename more than once, it is only loaded once.
o At this point, you will load all the pages into the frame store for each program. This will change
in the next section. Unlike Assignment 2, where you were encouraged to load the scripts contiguously into the Shell memory, in this assignment the pages will not be contiguously loaded. For example, you can load into memory as follows for 2 programs that each have 2 pages (i.e., 6 lines of code per program). Experiment with different orders to check that your paging implementation is working.
Frame store
                                       0
                                       1
                                       2
                                       3
                                       4
                                       5
                                       6
                                       7
                                       8
                                       9
                                      10
                                      11
                                      12
o However, for grading purposes, when a page is loaded into the frame store, it must be placed in the first free spot (i.e., the first available hole).
4. Creating the page table. For each script, a page table needs to be added to its PCB to keep track of the loaded pages and their corresponding frames in memory. You are free to implement the page table however you wish. A possible implementation is adding a page table array, where the values stored in each cell of the array represent the frame number in the frame store. For instance, in the example above, the page tables would be:
Prog 1:
pagetable[0] = 1 //frame 1 starts at line 3 in the frame store
pagetable[1] = 3 //frame 3 starts at line 9 in the frame store Prog 2:
pagetable[0] = 0 //frame 0 starts at line 0 in the frame store
Balmau, Kopinsky Assignment #3 Page 3 of 7
  prog2-page0
  prog2-page0
  prog2-page0
  prog1-page0
  prog1-page0
  prog1-page0
  prog2-page1
  prog2-page1
  prog2-page1
  prog1-page1
  prog1-page1
  prog1-page1
  
Operating Systems COMP 310 – ECSE 427 McGill University
pagetable[1] = 2 //frame 2 starts at line 6 in the frame store
You may want to also keep validity information separately, or you could use an unreasonable
frame number like -1 to indicate that an entry is invalid.
Note that you will also need to modify the program counter to be able to navigate through the frames correctly. For instance, to execute prog 1, the PC needs to make the transitions between the 2 frames correctly, accessing lines: 3,4,5,9,10,11.
Assumptions (for now):
o The frame store is large enough to hold all the pages for all the programs.
o The variable store has at least 10 entries.
o An exec/run command will not allocate more variables than the size of the variable store.
o Each command (i.e., line) in the scripts will not be larger than a shell memory line (i.e., 100
characters in the reference implementation). o A one-liner is considered as one command
If everything is correct so far, your source/exec commands should have the same behavior as in Assignment 2. You can use the existing unit tests from Assignment 2 to make sure your code works correctly.
1.2.2. Extend the OS Shell with demand paging
We are now ready to add demand paging to our shell. In Section 1.2.1, we assumed the all the pages of all the programs fit in the shell memory. Now, we will get rid of this assumption.
1. Setting shell memory size at compile time. First, you need to add two compilation flags to adjust the frame store size and variable store size at compile time as follows.
o In gcc, you will need to use the -D compilation option, which replaces a macro by a value -D
<macro>=<value>.
o In make, you can pass the value of the variable from the command line.
Example:
At the command line: make xval=42
In the Makefile: gcc -D XVAL=$(xval) -c test.c In test.c: int x=XVAL;
o Using the technique described above, your shell will be compiled by running
make mysh framesize=X varmemsize=Y
where X and Y represent the number of lines in the frame store and in the variable store. You can assume that X will always be a multiple of 3 in our tests and that X will be large enough to hold at least 2 frames for each script in the test. The name of the executable remains mysh.
o Print the following message at shell startup, instead of the version message: ”Frame Store Size = X; Variable Store Size = Y”
Where X and Y are the values passed to make from the command line.
o To reiterate: this is printed instead of the version message.
Balmau, Kopinsky Assignment #3 Page 4 of 7

Operating Systems COMP 310 – ECSE 427 McGill University
Please make sure your program compiles this way and that the memory sizes are adjusted.
2. Code loading. Unlike the previous Section, in this section the code pages will be loaded into the shell memory dynamically, as they become necessary.
o In the beginning of the source/exec commands, only the first two pages of each program
are loaded into the frame store. A page consists of 3 lines of code. In case the program is smaller than 3 lines of code, only one page is loaded into the frame store. Each page is loaded in the first available hole.
o The programs start executing, according to the selected scheduling policy (in our case, RR with time slice of 2 lines of code).
3. Handling page faults. When a program needs to execute the next line of code that resides in a page which is not yet in memory, a page fault is triggered. Upon a page fault:
o The current process P is interrupted and placed at the back of the ready queue, even if it may
still have code lines left in its “time slice”. The scheduler selects the next process to run from the ready queue.
o If you want your A3 solution to work with policies other than RR, you might not want to always place P at the back of the ready queue. Again, such implementation details are up to you!
o The missing page for process P is brought into the frame store from the file. P’s page table needs to be updated accordingly. The new page is loaded into the first free slot in the frame store if a free slot exists in the frame store.
o If the frame store is full, we need to pick a victim frame to evict from the frame store. For now, pick a random frame in the frame store and evict it. We will adjust this policy in Section 1.2.3. Do not forget to update P’s page table. You also need to update any page tables that were using the frame you evicted! To accomplish this, you will need a mapping from frames to the page table(s) that use them. Make sure you keep this bookkeeping structure up-to- date whenever you modify the contents of frames!
Upon eviction, print the following to the terminal:
”Page fault!
Victim page contents:”
<the contents of the page, line by line> ”End of victim page contents.”
Upon page faults when the frame store is not full, print the following:
      ”Page fault!”
o P will resume running whenever it comes next in the ready queue, according to the scheduling policy.
o When a process terminates, you should not clean up its corresponding pages in the frame store.
Note that, because the scripting language is very simple the pages can be loaded in order into the shell memory (i.e., for a program, you can assume that you will first load page 1, then pages 2, 3, 4 etc.). This greatly simplifies the implementation, but be aware that real paging systems also account for loops, jumps in the code etc. Also, our pages are always read-only, so you never have
 Balmau, Kopinsky Assignment #3 Page 5 of 7

Operating Systems COMP 310 – ECSE 427 McGill University
to worry about backtracking in the backing files to overwrite updated data. Obviously, real paging systems have to account for that as well.
Also note that if the next page is already loaded in memory, there is no page fault. The execution simply continues with the instruction from the next page, if the current process still has remaining lines in its “time slice”. This will happen when the same program is used by multiple processes.
If you are especially astute and thinking very hard, you might notice that it’s possible for one process to load some pages of a program, and then another process running the same program uses them so much later that they have been evicted. This would require backtracking in the backing file. This is very difficult to implement correctly, since our pages do not have a fixed number of bytes, and so the tests will not cause this to happen. You can simply pretend that it will not happen. If you do choose to try and handle it, beware.
1.2.3. Adding Page Replacement Policy
The final piece is adjusting the page replacement policy to Least Recently Used (LRU). As seen in class, you will need to keep track of the least recently used frame in the entire frame store and evict it. You must implement accurate LRU, not an approximation. Note that, with this policy, a page fault generated by process P1 may still cause the eviction of a page belonging to process P2, so all of the same bookkeeping is necessary.
2. TESTCASES
We provide 5 testcases and expected outputs in the starter code repository. These are the public tests. There may be hidden tests for this assignment. We have not decided yet. Please run the testcases to ensure your code runs as expected, and make sure you get similar results in the automatic tests. You are strongly encouraged to add more of your own tests as well. If there are hidden tests, it will be highly unlikely that you fail any hidden tests if you are passing all the public ones.
As with A2, you need to run the given test cases from the A3/test-cases/ directory, and your code for the assignment should remain in the project/src directory as with the other project parts.
IMPORTANT: The grading infrastructure uses batch mode, so make sure your program produces the expected outputs when testcases run in batch mode. You can assume that the grading infrastructure will run one test at a time in batch mode, and that there is a fresh recompilation between two testcases.
3. WHAT TO HAND IN
The assignment is due on April 4, 2025 at 23:59.
The project must compile on the our server by running make clean; make mysh framesize=X varmemsize=Y
   Your final grade will be determined by running the code in the GitLab repository that is crawled by our
 grading infrastructure. We will take into account the most recent commit that happened before the
 deadline, taking any requested late days into account, on the main branch of your fork.
Balmau, Kopinsky Assignment #3 Page 6 of 7

Operating Systems COMP 310 – ECSE 427 McGill University
The project must run in batch mode, i.e. ./mysh < testfile.txt
Feel free to modify the Makefile to add more structure to your code, but make sure that the project
compiles and runs using the commands above.
Note: You must submit your own work. You can speak to each other for help but copied code will be handled as to McGill regulations. Submissions are automatically checked via plagiarism detection tools.
4. HOW IT WILL BE GRADED
Your program must compile and run on our server to be graded. If the code does not compile/run using the commands in Section 3, in our grading infrastructure you will receive 0 points for the entire assignment. If you think your code is correct and there is an issue with the grading infrastructure, contact the instructor.
Your assignment is graded out of 20 points. You were provided 5 testcases, with expected outputs. If your code matches the expected output, you will receive 2 points for each testcase. There might be an additional 5 hidden test cases, in which case there will be 2 points per hidden testcase. (If we decide not to have hidden tests, you will receive 4 points for each of the given test cases.) You will receive 0 points for each testcase where your output does not match the expected output. Differences in whitespace in the output, such as tabs instead of spaces, new lines, etc. will not be penalized. The TA will look at your source code only if the program runs (correctly or not). The TA looks at your code to verify that you implemented the requirement as requested. Specifically:
• Hardcoded solutions will receive 0 points for the hardcoded testcase, even if the output is correct.
• You must write this assignment in the C Programming language, otherwise the assignment will
receive 0 points.
  Congratulations! If you made it this far, you have implemented a
 simple simulated Operating System☺
Balmau, Kopinsky Assignment #3 Page 7 of 7

請加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp





 

掃一掃在手機打開當前頁
  • 上一篇:多多應急全國客服電話-多多應急24小時人工服務熱線
  • 下一篇:關于無憂分期強制下款及客服電話投訴高額利息1
  • 無相關信息
    合肥生活資訊

    合肥圖文信息
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    出評 開團工具
    出評 開團工具
    挖掘機濾芯提升發動機性能
    挖掘機濾芯提升發動機性能
    海信羅馬假日洗衣機亮相AWE  復古美學與現代科技完美結合
    海信羅馬假日洗衣機亮相AWE 復古美學與現代
    合肥機場巴士4號線
    合肥機場巴士4號線
    合肥機場巴士3號線
    合肥機場巴士3號線
    合肥機場巴士2號線
    合肥機場巴士2號線
    合肥機場巴士1號線
    合肥機場巴士1號線
  • 短信驗證碼 豆包 幣安下載 AI生圖 目錄網

    關于我們 | 打賞支持 | 廣告服務 | 聯系我們 | 網站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網 版權所有
    ICP備06013414號-3 公安備 42010502001045

    91精品国产91久久久久久_国产精品二区一区二区aⅴ污介绍_一本久久a久久精品vr综合_亚洲视频一区二区三区
    精品国产亚洲在线| 欧美成人aa大片| 99视频一区二区| 99国产欧美另类久久久精品| 日本高清免费不卡视频| 久久色在线观看| 亚洲国产精品久久人人爱蜜臀| 美女在线视频一区| 在线视频你懂得一区二区三区| 欧美精品一区二区三区在线| 亚洲一二三区视频在线观看| 国产精品99久久久久久久女警| 欧美日韩在线免费视频| 自拍偷拍亚洲综合| 国产大陆a不卡| 欧美大片一区二区| 日本不卡一二三区黄网| 国产呦萝稀缺另类资源| 日韩一区二区三区在线视频| 亚洲视频综合在线| 99久久久国产精品| 亚洲嫩草精品久久| 日本久久电影网| 同产精品九九九| 在线成人高清不卡| 亚洲精选在线视频| 91免费精品国自产拍在线不卡| 精品女同一区二区| 成人va在线观看| 亚洲国产日产av| 欧美精品一区二区高清在线观看 | 欧美片网站yy| 久久日韩粉嫩一区二区三区| 国产精品自在在线| 亚洲日穴在线视频| 91精品国产综合久久小美女| 国产毛片精品一区| 日精品一区二区三区| 精品久久久久一区二区国产| av在线这里只有精品| 亚洲国产人成综合网站| 国产日产欧产精品推荐色 | 成人爱爱电影网址| 国产精品看片你懂得| 99re6这里只有精品视频在线观看| 日韩欧美国产系列| 国内精品国产三级国产a久久| 国产精品乱码久久久久久| 欧美日韩国产小视频| 99精品国产99久久久久久白柏 | 91在线观看污| 东方欧美亚洲色图在线| 日本aⅴ亚洲精品中文乱码| 国产精品美女www爽爽爽| 欧美精品一区二区三区在线播放| av电影在线观看一区| 大白屁股一区二区视频| 国产乱理伦片在线观看夜一区| 日韩精品一二三四| 午夜视频一区二区| 日韩电影在线免费看| 国产麻豆精品95视频| 欧美系列日韩一区| 91一区二区三区在线观看| 国产mv日韩mv欧美| 国产高清一区日本| 国产成人在线视频网站| 成人18精品视频| 在线综合视频播放| 欧美激情一区二区三区蜜桃视频| 欧美中文字幕不卡| 国产精品嫩草影院com| 国产一区二三区好的| 欧美日韩和欧美的一区二区| 国产精品毛片a∨一区二区三区| 久久成人18免费观看| 91麻豆精品国产91久久久久久| 亚洲一线二线三线视频| 色中色一区二区| 亚洲九九爱视频| 7799精品视频| 国产精品正在播放| 国产精品人人做人人爽人人添| 国产91丝袜在线观看| 亚洲欧美aⅴ...| 欧美老人xxxx18| 国产精品一区二区久久精品爱涩| 久久亚洲精品国产精品紫薇| 国产成人在线观看| 亚洲精品成人在线| 欧美一区二区视频观看视频| 视频一区在线播放| 欧美激情一区二区| 在线中文字幕不卡| 激情久久久久久久久久久久久久久久| 欧美精品一区二区三区蜜臀 | 国产精品视频你懂的| 成人aaaa免费全部观看| 午夜av一区二区三区| 国产无人区一区二区三区| 色一区在线观看| 国产精品99久久久久久有的能看| 亚洲美女屁股眼交| 中文字幕高清不卡| 欧美美女bb生活片| 欧美在线你懂的| 96av麻豆蜜桃一区二区| 国产麻豆精品theporn| 日韩精品免费视频人成| 亚洲午夜激情av| 一区二区三区波多野结衣在线观看 | 国产亚洲欧美在线| 欧美精品久久99久久在免费线| 91网址在线看| 91香蕉视频黄| 91免费国产视频网站| 色婷婷香蕉在线一区二区| 97成人超碰视| 欧美高清一级片在线| 欧美日高清视频| 欧美一区二区免费视频| 日韩一区二区在线免费观看| 欧美日韩精品高清| 日韩女优制服丝袜电影| 久久这里只有精品首页| 国产精品国产三级国产三级人妇| 国产精品久久一级| 亚洲国产va精品久久久不卡综合| 亚洲午夜久久久久久久久久久| 一区二区在线观看视频| 日本不卡一二三| 国产99久久久国产精品潘金| 91污在线观看| 欧美精品一区二区精品网| 中文字幕日韩av资源站| 91福利在线免费观看| 日韩精品一区二区三区在线| 中文无字幕一区二区三区| 亚洲精品成a人| 国产盗摄女厕一区二区三区 | 秋霞午夜av一区二区三区| 国产精品一二一区| 欧美福利电影网| 亚洲日本欧美天堂| 国产成人精品亚洲午夜麻豆| 欧美亚洲综合网| 中文字幕av资源一区| 青青草精品视频| 欧美日韩一二三| 中文字幕字幕中文在线中不卡视频| 麻豆精品国产91久久久久久| 欧美精品日韩精品| 男人操女人的视频在线观看欧美 | 色哟哟亚洲精品| 亚洲欧洲日韩女同| 成人h动漫精品一区二| 久久精品免视看| a亚洲天堂av| 午夜精品福利久久久| 91精品中文字幕一区二区三区| 亚欧色一区w666天堂| 欧美一区二区三区免费在线看 | 麻豆免费看一区二区三区| 欧美日韩另类一区| 免费高清成人在线| 国产亚洲福利社区一区| av在线播放成人| 天堂av在线一区| 国产日韩欧美激情| 欧美性感一区二区三区| 狠狠色丁香婷婷综合久久片| 国产日韩欧美a| 5566中文字幕一区二区电影| 国产91精品一区二区麻豆网站| 亚洲情趣在线观看| 久久网站最新地址| 欧美日韩视频第一区| 处破女av一区二区| 日一区二区三区| 最新中文字幕一区二区三区| 日韩一区二区免费视频| 在线观看日韩精品| 成人18视频日本| 丁香六月综合激情| 国产精品系列在线播放| 美国十次了思思久久精品导航| 亚洲激情男女视频| 亚洲精品国产视频| 日韩美女视频19| 一区二区三区四区激情| 亚洲欧美日韩国产综合在线| 国产情人综合久久777777| 久久久久亚洲综合| 久久久综合激的五月天| 中文字幕免费不卡| 亚洲免费av观看| 亚洲第一激情av| 麻豆成人免费电影| 成人在线视频一区| 色999日韩国产欧美一区二区|