99爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

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

代做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程序
  • 無相關信息
    合肥生活資訊

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

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

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

    99爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

          狠狠v欧美v日韩v亚洲ⅴ| 久久久久网址| 欧美好吊妞视频| 狠狠狠色丁香婷婷综合激情| 亚洲午夜一级| 欧美日韩午夜视频在线观看| 亚洲国产精品美女| 久热爱精品视频线路一| 激情小说另类小说亚洲欧美| 久久九九99视频| 国产三区精品| 欧美一区免费视频| 国产性猛交xxxx免费看久久| 午夜久久资源| 国产精品视频导航| 午夜国产精品视频免费体验区| 欧美视频精品在线| 亚洲欧美激情视频在线观看一区二区三区 | 另类av导航| 亚洲高清视频在线| 男女激情久久| 亚洲人成在线播放网站岛国| 欧美二区在线播放| 99视频在线观看一区三区| 欧美日韩精品| 亚洲免费中文字幕| 国产视频一区欧美| 久久久久久自在自线| 在线观看亚洲| 欧美精品免费视频| 亚洲社区在线观看| 国产日韩久久| 久久野战av| 亚洲精品一区二区在线| 欧美日韩免费观看一区二区三区| 一区二区三区视频在线| 国产精品普通话对白| 欧美尤物一区| 亚洲人成在线观看网站高清| 欧美日韩精品系列| 欧美伊人精品成人久久综合97 | 亚洲欧美视频在线观看| 国产一区二区三区在线观看网站 | 久久久不卡网国产精品一区| 亚洲缚视频在线观看| 欧美日韩免费高清一区色橹橹| 亚洲无亚洲人成网站77777 | 国内精品视频在线播放| 欧美激情在线观看| 午夜精品久久久| 亚洲福利av| 国产精品美女久久久浪潮软件| 久久精品国产一区二区三区| 日韩一级大片在线| 国产午夜精品久久久久久免费视 | 欧美国产视频一区二区| 亚洲欧美区自拍先锋| 在线日韩av片| 国产毛片精品国产一区二区三区| 久色婷婷小香蕉久久| 亚洲一区二区三区视频播放| 亚洲福利视频免费观看| 国产精品日韩在线播放| 欧美高清视频| 亚洲欧美www| 亚洲精品一区二区三区在线观看| 国产精品入口福利| 欧美日本国产一区| 久久夜色精品国产欧美乱| 亚洲欧美日韩在线不卡| 亚洲美女av网站| 在线观看免费视频综合| 国产欧美va欧美va香蕉在| 欧美日韩亚洲国产一区| 久久视频精品在线| 欧美一级电影久久| 亚洲视频网站在线观看| 亚洲人成人一区二区在线观看| 国产日韩1区| 国产精品久久| 欧美色图五月天| 欧美国产综合一区二区| 乱中年女人伦av一区二区| 欧美在线播放一区二区| 亚洲直播在线一区| 一本久道久久综合婷婷鲸鱼| 亚洲黄色影片| 亚洲国产欧美一区二区三区久久| 国外成人免费视频| 国产亚洲一区在线| 国产女主播一区二区| 国产精品久久久久aaaa樱花| 欧美日韩国产成人在线91| 欧美成人午夜剧场免费观看| 玖玖精品视频| 欧美成人免费全部| 欧美激情中文字幕在线| 欧美大片免费观看| 欧美精品一区二区久久婷婷| 你懂的视频欧美| 欧美高清视频一区| 欧美精品一区二区久久婷婷| 欧美国产欧美综合| 欧美日韩午夜视频在线观看| 欧美日韩三区| 国产精品久久久久av| 国产精品视频第一区| 国产日韩欧美亚洲| 国产亚洲a∨片在线观看| 国产午夜精品麻豆| 在线高清一区| 亚洲人成网站在线观看播放| 亚洲精品综合精品自拍| aa成人免费视频| 亚洲男人的天堂在线| 欧美中日韩免费视频| 久久一区二区三区超碰国产精品| 欧美96在线丨欧| 欧美久久精品午夜青青大伊人| 欧美视频免费看| 国产免费成人| 亚洲高清免费在线| 一本色道久久88精品综合| 亚洲欧美三级伦理| 久久综合色天天久久综合图片| 欧美大片免费看| 国产精品欧美久久久久无广告| 国产视频欧美视频| 亚洲国产精品一区二区三区| 在线亚洲一区观看| 久久精品一二三| 欧美人妖在线观看| 国产日韩亚洲欧美精品| 亚洲国产婷婷| 午夜一级久久| 欧美精品一区二区三区在线看午夜| 欧美性生交xxxxx久久久| 国产一区二区三区久久| 日韩午夜一区| 久久亚洲春色中文字幕久久久| 欧美精品麻豆| 狠狠爱成人网| 亚洲一区www| 欧美成年人网站| 国产精品综合不卡av| 亚洲精品国久久99热| 欧美在线视屏| 欧美午夜宅男影院| 亚洲国产精品久久久久秋霞蜜臀| 亚洲一区二区三区欧美| 模特精品在线| 国精产品99永久一区一区| 亚洲先锋成人| 欧美激情第一页xxx| 国产综合一区二区| 亚洲综合精品一区二区| 欧美国产综合| 亚洲福利视频三区| 久久黄色小说| 国产精品亚洲美女av网站| 亚洲靠逼com| 美女黄毛**国产精品啪啪| 国产欧美日韩在线视频| 亚洲视频在线观看网站| 欧美电影免费观看高清| 韩日欧美一区二区| 欧美一区二区在线免费观看| 国产精品久久久久久久浪潮网站| 亚洲精品一区二区网址| 欧美.日韩.国产.一区.二区| 精品成人乱色一区二区| 久久久久国产免费免费| 国产一区二区三区高清| 午夜久久久久久久久久一区二区| 国产精品美女| 亚洲一区在线视频| 国产精品高潮呻吟| 亚洲一区在线免费| 国产精品视频1区| 午夜激情综合网| 国产区亚洲区欧美区| 欧美在线一二三四区| 国产日韩精品一区二区三区在线| 亚洲欧美日韩精品久久久久| 国产精品美女久久久久久久| 中文国产一区| 国产精品久久久一区二区| 亚洲一区二区综合| 国产精品日韩欧美一区二区| 亚洲欧美日韩精品综合在线观看| 国产精品日韩一区二区| 小嫩嫩精品导航| 狠狠干成人综合网| 免费观看30秒视频久久| 亚洲人成在线观看网站高清| 欧美日韩国产一区二区| 亚洲字幕在线观看| 国产一区二区黄色| 免费不卡在线视频| 99热这里只有精品8|