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

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

代做159.342 、代寫Operating Systems 編程設計
代做159.342 、代寫Operating Systems 編程設計

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



159.342 - Operating Systems and Networks
Assignment #3 (due on 6/Jun)
Memory Management Using the Buddy System Strategy
OBJECTIVE:
The main objective in this assignment is to implement the Buddy System memory management 
strategy by writing two functions that implement the same functionalities as the C Standard library’s 
malloc() and free(). You should apply your knowledge of memory management concepts, so the 
functions are as efficient as possible. The buddy system will be characterised and compared against 
the existing C Standard library functions based on ACTUAL RUNNING TIME and MEMORY USAGE. 
Given a large block of contiguous memory to manage, your functions should be able to fulfil a series 
of memory allocation and deallocation requests. In your implementation, you are not allowed to 
use the built-in malloc, free, new, delete or any other memory allocators that come from other 
third-party libraries. 
START-UP CODES:
The start-up codes provide a test routine that makes successive calls for memory allocations and 
deallocations, involving a replaceable implementation of MALLOC and FREE. Functions for 
measuring the actual running time and total memory usage of the memory management strategy
are also provided.
///////////////////////////////
// TEST ROUTINE
///////////////////////////////
#ifdef RUN_COMPLETE_TEST 
 cout << "\n\n executing " << NO_OF_ITERATIONS << " rounds of combinations of memory allocation and deallocation..." <<
endl;
 
 for(i=0;i<NO_OF_ITERATIONS;i++) {
 k=myrand() % NO_OF_POINTERS; // pick a pointer
 if(n[k]) { // if it was allocated then free it
 // check that the stuff we wrote has not changed
 if ( (n[k][0]) != (unsigned char) k)//(n[k]+s[k]+k) )
 printf("Error when checking first byte! in block %d \n",k);
 if(s[k]>1 && (n[k][s[k]-1])!=(unsigned char) k )//(n[k]-s[k]-k))
 printf("Error when checking last byte! in block %d \n",k);
 FREE(n[k]); 
 }
 size=randomsize(); // pick a random size
 #ifdef DEBUG_MODE
 cout << "\tPick random size to allocate: " << size << endl;
 #endif
 
 n[k]=(unsigned char *)MALLOC(size); // do the allocation
 if(n[k] != NULL){
 #ifdef DEBUG_MODE
 cout << "\tallocated memory of size: " << size << endl; 
 #endif 
 s[k]=size; // remember the size
 n[k][0]=(unsigned char) k; // put some data in the first and 
 if(s[k]>1) n[k][s[k]-1]=(unsigned char) k; // last byte
 } else {
 cout << "\tFailed to allocate memory of size: " << size << endl; 
 } 
 }
#endif
n.h.reyes@massey.ac.nz
Selecting a memory management strategy to test
You can switch between different memory management strategies by changing the definition of 
MALLOC and FREE, as defined inside main.cpp (see below). The first two options are already 
provided, but the third option corresponds to the Buddy System and therefore, needs to be 
implemented in this assignment:
//---------------------------------------
// WHICH MEMORY MANAGEMENT STRATEGY?
//---------------------------------------
// enable the following compiler directives to test the real malloc and free
//(1) use built-in C functions
const string strategy = "malloc";
#define MALLOC malloc
#define FREE free
//---------------------------------------
//enable the following compiler directives to test a simple implementation of malloc and free
//(2) use user-defined functions
//const string strategy = "mymalloc";
// #define MALLOC mymalloc
// #define FREE myfree
//---------------------------------------
//enable the following compiler directives to test your implementation of the Buddy system strategy
//(3) use Buddy System
// const string strategy = "Buddy System";
// #define USE_BUDDY_SYSTEM
// #define MALLOC buddyMalloc
// #define FREE buddyFree
//---------------------------------------
CORE FUNCTIONS REQUIRED:
Skeleton functions for buddy system’s malloc and free are already provided inside buddysys.cpp. 
Write your implementation inside them. You are allowed to add any supporting functions, data 
structures and variables in the program. 
void *buddyMalloc(int request_memory){
 //write your buddy system’s memory allocation codes here
 //this function should provide the same functionality as the malloc() function

int buddyFree(void *p){
 //write your buddy system’s memory deallocation codes here
 //this function should provide the same functionality as the free() function
}
AUXILIARY FUNCTIONS PROVIDED:
The Auxiliary functions, constants and data structures declared and implemented inside auxiliary.cpp 
and auxiliary.h should all be kept as is.
MINIMUM CONTIGUOUS MEMORY SIZE
As part of characterising the performance of your implementation, find the minimum contiguous 
memory size that allows the Buddy System strategy to accommodate the succession of memory 
allocation and deallocation requests in the test routine. To accomplish this, you need to experiment 
with different settings for the NUMBEROFPAGES until the test routine could be fully completed. 
Example: 
As an example, if you set NUMBEROFPAGES equal to 1024, then the MEMORYSIZE could be 
computed as follows:
// inside main.cpp
MEMORYSIZE = (long long int) ((long long int)NUMBEROFPAGES * (long long int)PAGESIZE);
Note that in the start-up codes, the PAGESIZE is set to 4096. Therefore, MEMORYSIZE will be equal 
to 4,194,304 bytes (1024 * 4096) or 4.19 MegaBytes. 
Next, with your MEMORYSIZE setting, run the test routines to see if all requests for memory 
allocations and deallocations can be satisfied. 
If the test routine cannot be completed, repeat the following steps until the test routine can be 
completed.
1. increase the MEMORYSIZE by a small amount, then recompile the code
2. run the test routine.
MEASURE OF PERFORMANCE
Download the Excel file, named assignment_documentation.xlsx from our stream website.
Characterise your Buddy System implementation and compare it against the C Standard library’s 
malloc and free to see if its speed of execution is comparable. Fill-up the Excel worksheet to 
document your experiment results. You only need to record the performance of your Buddy System 
implementation.
DEBUGGING:
For debugging purposes, I have created a simple test routine (inside the start-up codes) to assist the 
class. To activate this simple test temporarily, modify the auxillary.h file to enable 
RUN_SIMPLE_TEST as follows:
Before submitting your assignment, you should comment out #define RUN_SIMPLE_TEST and re activate #define RUN_COMPLETE_TEST again.
n.h.reyes@massey.ac.nz
n.h.reyes@massey.ac.nz
Further, inside main.cpp, I have made a provision for this Simple Test already, it will automatically 
switch to using 512 bytes as the MEMORYSIZE, to conduct the test.
For more details on how to debug your codes, please see the file, named 
A3_debugging_tips_2025_v1.docx. This is downloadable from our stream website.
SUBMISSION INSTRUCTIONS:
1. Submit your complete C/C++ program electronically via Stream. 
2. Use the following filename for your main program (as set in the start-up codes): main.cpp
3. Submit the makefile for building your codes. The makefile should suffice to build your 
codes.
4. As a backup, if you developed your program using an IDE, such as VSCODE or Clion, also 
submit the complete support files (e.g. CMakeLists.txt, project file, *.sln, *.JSON, etc.), for 
building your codes. 
5. Assignment documentation file: Download and fill out the Excel file, named 
assignment_documentation.xlsx to provide important information about your work. 
Rename the file using your ID_number (e.g. 87654321.xlsx). This will help facilitate 
accurate marking of your assignment. Deductions will be made if you do not submit the 
completed Excel file.
6. Snapshots file: Create a document containing snapshots of the simulation results. Show the 
results of executing RUN_COMPLETE_TEST. If this cannot be achieved, for partial marks, show 
the results of executing RUN_SIMPLE_TEST.
Label and briefly describe each image. You may create a Word document or a pdf file to 
accomplish this task.
7. Create a zip file containing the following files:
o Complete set of codes (including *.cpp, *.h, makefile, other supporting files)
o Snapshots file
8. Submit the zip file containing your complete program and snapshots electronically via 
Stream. You will find a button with the following label.
9. Submit the assignment documentation Excel file via Stream website. You will find a 
separate button with the following label.
10. Lastly, submit the Gen AI Usage documentation file via Stream website. You will find a 
separate button with the following label.
Distribution of marks:
The assignment will be marked based on functionality, design and correctness. 
The marks are distributed as follows:
• 5 marks: for correct implementation of buddyMalloc.
• 5 marks: for correct implementation of buddyFree.
• 3 marks: for memory efficiency (Note: this is based on the minimum contiguous memory 
size that allows the Buddy System strategy to accommodate the succession of memory 
allocation and deallocation requests in the RUN_COMPLETE_TEST routine)
• 2 marks: for documentation (i.e. accurate documentation of performance and other 
important assignment details - Excel assignment documentation, snapshots).
Other Notes
• This assignment is worth 15 marks. 
• Marks will be subtracted for obvious copying and/or for delays without justification.

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


 

掃一掃在手機打開當前頁
  • 上一篇:BISM3206代做、代寫Python編程語言
  • 下一篇:COMP4233代做、代寫Python/Java程序
  • 無相關信息
    合肥生活資訊

    合肥圖文信息
    2025年10月份更新拼多多改銷助手小象助手多多出評軟件
    2025年10月份更新拼多多改銷助手小象助手多
    有限元分析 CAE仿真分析服務-企業/產品研發/客戶要求/設計優化
    有限元分析 CAE仿真分析服務-企業/產品研發
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    出評 開團工具
    出評 開團工具
    挖掘機濾芯提升發動機性能
    挖掘機濾芯提升發動機性能
    海信羅馬假日洗衣機亮相AWE  復古美學與現代科技完美結合
    海信羅馬假日洗衣機亮相AWE 復古美學與現代
    合肥機場巴士4號線
    合肥機場巴士4號線
    合肥機場巴士3號線
    合肥機場巴士3號線
  • 短信驗證碼 目錄網 排行網

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

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

    91精品国产91久久久久久_国产精品二区一区二区aⅴ污介绍_一本久久a久久精品vr综合_亚洲视频一区二区三区
    欧美高清一区| 色综合天天做天天爱| 欧美一级网站| 一个色妞综合视频在线观看| 在线播放一区| 亚洲男同1069视频| 亚洲国产高清视频| 亚洲精品国产一区二区三区四区在线| 你懂的视频一区二区| 日本一区二区视频在线| 影音先锋久久| 午夜欧美在线一二页| 欧美色精品天天在线观看视频| 久久精品国产免费看久久精品| 老牛影视一区二区三区| 久久国产免费看| 日韩亚洲欧美中文三级| 97超碰欧美中文字幕| 亚洲色大成网站www久久九九| 成人app软件下载大全免费| 日韩一区二区三区精品视频| 成人黄动漫网站免费app| 欧美一区二区三区人| 欧美久久在线| 国产精品国产三级国产三级人妇| 亚洲一区二区三区高清不卡| 久久精品99国产精品| 中文字幕电影一区| 久久久久久亚洲精品杨幂换脸 | 日韩视频精品| 毛片不卡一区二区| 日本一区二区电影| 欧美日韩精品电影| av不卡在线| 成人av在线播放网站| 亚洲福利一二三区| 久久综合九色综合欧美98 | 91精品国产综合久久久久久漫画| 风间由美一区二区三区在线观看| 中文字幕一区av| 欧美日韩国产高清一区二区 | 国产一区91| 欧美在线精品一区| 精品一二线国产| 亚洲一二三区不卡| 2023国产精品| 在线不卡中文字幕| 色综合久久久网| 国产精品久久久久久久久婷婷| 91在线一区二区| 国产白丝精品91爽爽久久| 日本午夜一区二区| 亚洲成av人综合在线观看| 中国色在线观看另类| 欧美变态凌虐bdsm| 日韩一级片网站| 精品日韩av一区二区| 99亚洲精品| 91视频xxxx| 国产成人精品www牛牛影视| 日韩电影在线一区| 亚洲精品v日韩精品| 中文字幕在线不卡一区| 欧美videos中文字幕| 欧美一区中文字幕| 欧美日韩亚洲丝袜制服| 欧美视频精品在线| 色悠久久久久综合欧美99| 亚洲激情国产| 国产精品女主播一区二区三区 | 久久精子c满五个校花| 国产欧美日韩视频在线观看| 欧美韩国日本不卡| 亚洲精选一二三| 一区二区三区自拍| 国产精品久久久久一区| 欧美一卡二卡在线观看| 精品国产亚洲在线| 精品国产sm最大网站| 精品欧美一区二区久久| 国产欧美一区二区三区网站| 中文字幕中文字幕在线一区| 一区二区日韩av| 蜜桃av噜噜一区| 国产精品亚洲а∨天堂免在线| 91浏览器入口在线观看| 国产精品毛片| 日韩美女天天操| 亚洲色欲色欲www| 麻豆一区二区99久久久久| 国产一区二区三区久久久| 欧美日韩精品不卡| 日本韩国一区二区三区视频| 日韩午夜激情电影| 亚洲精品成a人| 成人黄色av电影| 久久一区二区三区四区五区| 欧美xxxx老人做受| 亚洲综合激情小说| 欧美日韩国产一区精品一区| 色婷婷精品大在线视频| 久久―日本道色综合久久| 天天色图综合网| 亚洲第一黄色| 91精品欧美久久久久久动漫| 亚洲欧洲99久久| 国产福利电影一区二区三区| av电影在线观看完整版一区二区| 一本色道**综合亚洲精品蜜桃冫| 中文字幕av一区 二区| 国内外精品视频| 色av综合在线| 亚洲一级二级三级| 国产一区二区三区四区三区四| 欧美一区二区三区四区五区| 日韩av电影天堂| 日韩一区在线看| 欧美激情1区2区3区| 久久久久久久综合色一本| 国产乱人伦偷精品视频免下载| 在线免费观看日本欧美| 激情文学综合丁香| 欧美成人vr18sexvr| 国产精品亚洲午夜一区二区三区 | 日本一不卡视频| 在线中文字幕不卡| 国产又粗又猛又爽又黄91精品| 欧美色图片你懂的| 韩日精品视频一区| 国产精品日韩精品欧美在线| 91视频在线观看免费| 欧美国产亚洲另类动漫| 中文日韩欧美| 日韩成人一级片| 欧美tickle裸体挠脚心vk| 亚洲图片在线| 老司机精品视频一区二区三区| 欧美va日韩va| 色噜噜狠狠色综合中国| 国产传媒欧美日韩成人| xnxx国产精品| 国产精品久久久久久久久久妞妞| 蜜桃av一区二区在线观看 | 国产91精品露脸国语对白| 国产精品国产三级国产普通话99 | 国产成人免费视| 久久综合狠狠综合久久激情| 久久久久高清| 欧美一区影院| 狠狠色丁香久久婷婷综合丁香| 欧美国产一区二区| 久久综合影视| 红桃视频欧美| www.久久久久久久久| 日韩av电影一区| 中文字幕亚洲成人| 久久综合九色综合97_久久久| 色视频成人在线观看免| 亚洲午夜精品久久久久久浪潮| 欧美日韩一区二区三区在线视频| 免费在线看一区| 尤物在线观看一区| 日韩一本二本av| 精品视频一区 二区 三区| 亚洲区一区二| 在线不卡亚洲| 香蕉亚洲视频| 在线观看亚洲精品视频| 亚洲电影专区| 欧美三级黄美女| 欧美一区二区| 91丨九色丨黑人外教| 国产成人精品一区二区三区四区 | 7777女厕盗摄久久久| 在线观看日韩精品| 欧美亚洲国产怡红院影院| 亚洲欧美日本视频在线观看| 国产欧美短视频| 国产婷婷精品| 欧美性猛交xxxxxx富婆| 色婷婷亚洲精品| 国产欧美综合一区二区三区| 国产欧美日韩一区| 久久国产主播精品| 色婷婷av一区二区三区软件 | 亚洲免费av在线| 亚洲高清免费视频| 午夜电影网亚洲视频| 久久99精品国产麻豆婷婷洗澡| 精品一区二区三区在线观看| 国产91色综合久久免费分享| 欧美精品麻豆| 亚洲在线电影| 欧美一区二区大片| 国产精品久久久久久妇女6080| 伊人婷婷欧美激情| 久久97超碰国产精品超碰| 国产.精品.日韩.另类.中文.在线.播放| 国产盗摄视频一区二区三区| 欧美日韩一区二区三区四区在线观看|