国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看

合肥生活安徽新聞合肥交通合肥房產(chǎn)生活服務(wù)合肥教育合肥招聘合肥旅游文化藝術(shù)合肥美食合肥地圖合肥社保合肥醫(yī)院企業(yè)服務(wù)合肥法律

代寫(xiě)CS 551、代做C/C++編程語(yǔ)言
代寫(xiě)CS 551、代做C/C++編程語(yǔ)言

時(shí)間:2024-10-22  來(lái)源:合肥網(wǎng)hfw.cc  作者:hfw.cc 我要糾錯(cuò)



CS 551 Systems Programming, Fall 2024
Programming Project 1 Out: 10/13/2024 Sun.
Due: 10/26/2024 Sat. 23:59:59
In this project your are going to implement a custom memory manager that manages heap memory allocation at program level. Here are the reasons why we need a custom memory manager in C.
• The C memory allocation functions malloc and free bring performance overhead: these calls may lead to a switch between user-space and kernel-space. For programs that do fre- quent memory allocation/deallocation, using malloc/free will degrade the performance.
• A custom memory manager allows for detection of memory misuses, such as memory over- flow, memory leak and double deallocating a pointer.
The goal of this project is to allow students to practice on C programming, especially on bitwise operations, pointer operation, linked list, and memory management.
Figure 1: Overview
1 Overview
Figure 1 depicts where the memory manager locates in a system. The memory manager basically preallocates chunks of memory, and performs management on them based on the user program memory allocation/deallocation requests.
We use an example to illustrate how your memory manager is supposed to work. Suppose memory allocations in the memory manager are 16 bytes aligned1.
• After the user program starts, the first memory allocation from the program requests 12 bytes of memory (malloc(12)). Prior to this first request, your memory manager is initialized
1In other words, the memory manager always allocates memory that is a multiple of 16 bytes. In the base code, this is controlled by the MEM ALIGNMENT BOUNDARY macro defined in memory manager.h
 User program
User program
   malloc/free
malloc/free (interposed version)
malloc/free
  OS kernel
Your memory manager (a library)
OS kernel
  
with a batch of memory slots2, each of which has a size of 16 bytes. Memory manager returns the first slot of the batch to the user program.
• Then the user program makes a second request (malloc(10)). Because the memory al- location is 16 bytes aligned, the memory manager should return a chunk of memory of 16 bytes. This time, because there are still available 16-byte-slots in the allocated batch, the memory manager simply return the second slot in the allocated batch to fulfill the request without interacting with the kernel.
• The user program makes 6 subsequent memory requests, all of which are for memory less than 16 bytes. The memory manager simply returns each of the rest 6 free 16-byte-slots to fulfill the requests. And for the implementation of this project, assume you will only get requests for less than or equal to 16 bytes memory.
• The user program makes the 9th request (malloc(7)). Because there is no free slots avail- able, the manager allocates another batch of memory slots of 16 bytes, and returns the first slot in this batch to the user program.
• Suppose the 10th memory request from the user program is malloc(28). The manager should return a memory chunk of ** bytes (remember memory allocation is 16 bytes aligned). Because there is no memory list of **-byte-slots, the manager has to allocate a batch of memory slots of ** bytes, and returns the first slot to fulfill this request. At this moment, the memory list of **-byte-slots has only one memory batch.
• The memory manager organizes memory batches that have the same slot size using linked list, and the resulting list is called a memory batch list, or a memory list.
• Memory lists are also linked together using linked list. So the default memory list with slot size of 16 bytes is linked with the newly created ** bytes slot size memory list.
• The manager uses a bitmap to track and manage slots allocation/deallocation for each memory batch list.
It is easy to see that with such a mechanism, the memory manager not only improves program performance by reducing the number of kernel/user space switches, but also tracks all the memory allocation/deallocation so that it can detect memory misuse such as double freeing. The memory manager can also add guard bytes at the end of each memory slot to detect memory overflow (just an example, adding guard bytes is not required by this project.)
2 What to do
2.1 Download the base code
Download the base code from Assignments section in the Brightspace. You will need to add your implementation into this base code.
2In the base code, the number of memory slots in a batch is controlled by the MEM BATCH SLOT COUNT macro defined in memory manager.h
 
2.2 Complete the bitmap operation functions (25 points)
Complete the implementation of the functions in bitmap.c.
• int bitmap find first bit(unsigned char * bitmap, int size, int val)
This function finds the position (starting from 0) of the first bit whose value is “val” in the “bitmap”. The val could be either 0 or 1.
Suppose
         unsigned char bitmap[] = {0xF7, 0xFF};
Then a call as following
         bitmap_find_first_bit(bitmap, sizeof(bitmap), 0);
finds the first bit whose value is 0. The return value should be 3 in this case.
• int bitmap set bit(unsigned char * bitmap, int size, int target pos)
This function sets the “target pos”-th bit (starting from 0) in the “bitmap” to 1.
Suppose
     unsigned char bitmap[] = {0xF7, 0xFF};
Then a call as following
     bitmap_set_bit(bitmap, sizeof(bitmap), 3);
sets bit-3 to 1. After the call the content of the bitmap is {0xFF, 0xFF};
• int bitmap clear bit(unsigned char * bitmap, int size, int target pos)
This function sets the “target pos”-th bit (starting from 0) in the “bitmap” to 0.
• int bitmap bit is set(unsigned char * bitmap, int size, int pos)
This function tests if the “pos”-th bit (starting from 0) in the “bitmap” is 1.
Suppose
     unsigned char bitmap[] = {0xF7, 0xFF};
Then a call as following
     bitmap_bit_is_set(bitmap, sizeof(bitmap), 3);
returns 0, because the bit-3 in the bitmap is 0.
• int bitmap print bitmap(unsigned char * bitmap, int size)
This function prints the content of a bitmap in starting from the first bit, and insert a space
every 4 bits. Suppose
     unsigned char bitmap[] = {0xA7, 0xB5};
Then a call to the function would print the content of the bitmap as
     1110  0101  1010  1101
The implementation of this function is given.

2.3 Complete the memory manager implementation (70 points)
In memory manager.h two important structures are defined:
• struct stru mem batch: structure definition of the a memory batch (of memory slots). • struct stru mem list: structure definition of a memory list (of memory batches).
To better assist you understand how a memory manager is supposed to organize the memory using the two data structures, Figure 2 shows an example of a possible snapshot of the memory manager’s data structures.
Figure 2: An example of data structures Basically there are two kinds of linked list:
• A list of memory batches (with a certain slot size): as shown in the previous example, this list expands when there is no free slot available. The memory manager adds a new batch at the end of the list.
• A list of memory batch list: this list expands when a new slot size comes in. You will need to implement the functions in memory manager.c:
 • void * mem mngr alloc(size t size)

– This is the memory allocation function of the memory manager. It is used in the same way as malloc().
– Provide your implementation.
– The macro MEM ALIGNMENT BOUNDARY (defined in memory manager.h) controls how memory allocation is aligned. For this project, we use 16 byte aligned. But your implementation should be able to handle any alignment. One reason to de- fine the alignment as a macro is to allow for easy configuration. When grading we will test alignment that is multiples of 16 by changing the definition of the macro MEM ALIGNMENT BOUNDARY to 8, **, ....
– The macro MEM BATCH SLOT COUNT (defined in memory manager.h) controls the number of slots in a memory batch. For this project this number is set to 8. But your implementation should also work if we change to the macro MEM BATCH SLOT COUNT to other values. When grading, we will test the cases when MEM BATCH SLOT COUNT is set to multiples of 8 (i.e., 8, 16, 24, ...).
– When there are multiple free slots, return the slot using the first-fit policy(i.e, the one with smallest address).
– Remember to clear the corresponding bit in free slots bitmap after a slot is allo- cated to user program.
– Do not use array for bitmap, because you never now how many bits you will need. Use heap memory instead.
– Remember to expand the bitmap when a new batch is added to a list, and keep the old content after expansion.
– Create a new memory list to handle the request if none of the existing memory list can deal with the requested size.
– Add this memory list into the list of memory lists.
– This function should support allocation size up to 5 times the alignment size, e.g., 80
bytes for 16 byte alignment.
• void mem mngr free(void * ptr)
– This is the memory free function of the memory manager. It is used in the same way
as free().
– Provide your implementation.
– The ptr should be a starting address of an assigned slot, report(print out) error if it is not (three possible cases:
1: ptr is the starting address of an unassigned slot - double freeing;
2: ptr is outside of memory managed by the manager;
3: ptr is not the starting address of any slot).
– Remeber to set the corresponding bit in free slots bitmap after a slot is freed, so
that it can be used again.
– Search through all the memory lists to find out which memory batch the ptr associated slot belongs to.

2.4

void mem mngr init(void)
– This function is called by user program when it starts.
– Initialize the lists of memory batch list with one default batch list. The slot size of this default batch list is 16 bytes.
– Initialize this default list with one batch of memory slots.
– Initialize the bitmap of this default list with all bits set to 1, which suggests that all
slots in the batch are free to be allocated.
void mem mngr leave(void)
– This function is called by user program when it quits. It basically frees all the heap
memory allocated.
– Provide your implementation.
– Don’t forget to free all the memory lists to avoid memory leak.
void mem mngr print snapshot(void)
This function has already been implemented. It prints out the current status of the memory manager. Reading this function may help you understand how the memory manager orga- nizes the memory. Do not change the implementation of this function. It will be used to help the grading.
Writing a makefile (5 points)


Write a makefile to generate
• • •
2.5
Log your work: besides the files needed to build your project, you must also include a README
file which minimally contains your name and B-number. Additionally, it can contain the following:
• The status of your program (especially, if not fully complete).
• Bonus is implemented or not.
• A description of how your code works, if that is not completely clear by reading the code (note that this should not be necessary, ideally your code should be self-documenting).
• Possibly a log of test cases which work and which don’t work.
• Any other material you believe is relevant to the grading of your project.
memory manager.o bitmap.o
a static library memory manager.a, which contains the previous relocatable object files. This library will be linked to our test program for testing.
Log and submit your work

Compress the files: compress the following into a ZIP file: • bitmap.c
• common.h
• interposition.h
• memory manager.c • memory manager.h • Makefile
• README
Name the ZIP file based on your BU email ID. For example, if your BU email is “abc@binghamton.edu”, then the zip file should be “proj1 abc.zip”.
Submission: submit the ZIP file to Brightspace before the deadline. 2.6 Grading guidelines
(1) Prepare the ZIP file on a Linux machine. If your zip file cannot be uncompressed, 5 points off.
(2) If the submitted ZIP file/source code files included in the ZIP file are not named as specified above (so that it causes problems for TA’s automated grading scripts), 10 points off.
(3) If the submitted code does not compile:
1 2 3 4 5 6 7 8 9
TA will try to fix the problem (for no more than 3 minutes);
if (problem solved)
  1%-10% points off (based on how complex the fix is, TA’s discretion);
else
  TA may contact the student by email or schedule a demo to fix the problem;
  if (problem solved)
    11%-20% points off (based on how complex the fix is, TA’s discretion);
  else
    All points off;
So in the case that TA contacts you to fix a problem, please respond to TA’s email promptly or show up at the demo appointment on time; otherwise the line 9 above will be effective.
(4) If the code is not working as required in this spec, the TA should take points based on the assigned full points of the task and the actual problem.
(5) Late penalty: Day1 10%, Day2 20%, Day3 40%, Day4 60%, Day5 80%
(6) Lastly but not the least, stick to the collaboration policy stated in the syllabus: you may discuss with your fellow students, but code should absolutely be kept private. Any violation to the Academic Honesty Policy and University Academic Policy, will result 0 for the work.

請(qǐng)加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp

掃一掃在手機(jī)打開(kāi)當(dāng)前頁(yè)
  • 上一篇:代做3DA3 C02、Java/python編程代寫(xiě)
  • 下一篇:CS209A編程代寫(xiě)、代做Java語(yǔ)言程序
  • 無(wú)相關(guān)信息
    合肥生活資訊

    合肥圖文信息
    流體仿真外包多少錢(qián)_專(zhuān)業(yè)CFD分析代做_友商科技CAE仿真
    流體仿真外包多少錢(qián)_專(zhuān)業(yè)CFD分析代做_友商科
    CAE仿真分析代做公司 CFD流體仿真服務(wù) 管路流場(chǎng)仿真外包
    CAE仿真分析代做公司 CFD流體仿真服務(wù) 管路
    流體CFD仿真分析_代做咨詢(xún)服務(wù)_Fluent 仿真技術(shù)服務(wù)
    流體CFD仿真分析_代做咨詢(xún)服務(wù)_Fluent 仿真
    結(jié)構(gòu)仿真分析服務(wù)_CAE代做咨詢(xún)外包_剛強(qiáng)度疲勞振動(dòng)
    結(jié)構(gòu)仿真分析服務(wù)_CAE代做咨詢(xún)外包_剛強(qiáng)度疲
    流體cfd仿真分析服務(wù) 7類(lèi)仿真分析代做服務(wù)40個(gè)行業(yè)
    流體cfd仿真分析服務(wù) 7類(lèi)仿真分析代做服務(wù)4
    超全面的拼多多電商運(yùn)營(yíng)技巧,多多開(kāi)團(tuán)助手,多多出評(píng)軟件徽y1698861
    超全面的拼多多電商運(yùn)營(yíng)技巧,多多開(kāi)團(tuán)助手
    CAE有限元仿真分析團(tuán)隊(duì),2026仿真代做咨詢(xún)服務(wù)平臺(tái)
    CAE有限元仿真分析團(tuán)隊(duì),2026仿真代做咨詢(xún)服
    釘釘簽到打卡位置修改神器,2026怎么修改定位在范圍內(nèi)
    釘釘簽到打卡位置修改神器,2026怎么修改定
  • 短信驗(yàn)證碼 寵物飼養(yǎng) 十大衛(wèi)浴品牌排行 suno 豆包網(wǎng)頁(yè)版入口 wps 目錄網(wǎng) 排行網(wǎng)

    關(guān)于我們 | 打賞支持 | 廣告服務(wù) | 聯(lián)系我們 | 網(wǎng)站地圖 | 免責(zé)聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網(wǎng) 版權(quán)所有
    ICP備06013414號(hào)-3 公安備 42010502001045

    国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看
    欧美激情视频在线观看| www.美女亚洲精品| 欧美激情在线观看视频| 亚洲视频欧美在线| 国产一区二区三区奇米久涩| 色妞在线综合亚洲欧美| 日本中文字幕久久看| av天堂永久资源网| 中文字幕中文字幕在线中心一区 | 国产精品一区二区三| 国产精品视频久| 欧美有码在线观看视频| 久草视频这里只有精品| 日韩在线综合网| 久久人人爽人人爽人人片av高请 | 国产成人精品在线视频| 日韩人妻精品一区二区三区| 久久久欧美一区二区| 一区二区不卡在线视频 午夜欧美不卡'| 国产又粗又长又爽视频| 久久99影院| 日韩一级免费看| 久久国产手机看片| 热门国产精品亚洲第一区在线| 国产v综合v亚洲欧美久久| 日本精品免费视频| 久久久精品在线视频| 日韩尤物视频| 久久久精品在线视频| 色婷婷综合久久久久中文字幕| 久久一区免费| 欧洲精品视频在线| 国产精品久久久久高潮| 国产日韩欧美综合精品| 伊人色综合久久天天五月婷| 国产日韩中文字幕在线| 欧美精品久久一区二区| av观看免费在线| 日本一区视频在线观看免费| 国产成人精品优优av| 精品视频免费观看| 一本色道婷婷久久欧美| 国产盗摄xxxx视频xxx69| 欧洲精品一区二区三区久久| 国产精品国产自产拍高清av水多 | 欧美一区1区三区3区公司| 国产成人av网址| 欧美精品一区二区三区三州| 按摩亚洲人久久| 免费国产一区二区| 最新中文字幕久久| 久久偷窥视频| 蜜桃免费区二区三区| 亚洲欧洲日产国码无码久久99| 九色91国产| 国产三级中文字幕| 手机在线观看国产精品| 国产精品久在线观看| 97人人爽人人喊人人模波多| 欧美日韩国产免费一区二区三区| 欧美人与性动交a欧美精品| 久久手机视频| 国产做受69高潮| 亚洲中文字幕无码专区| 精品国产网站地址| 国产精品一区二区三区四区五区 | 欧美巨猛xxxx猛交黑人97人| 91麻豆天美传媒在线| 热久久99这里有精品| 国产99久久九九精品无码| 久久99精品久久久久久青青日本| 国产午夜福利在线播放| 日产精品久久久一区二区| 久久成人人人人精品欧| 91国产一区在线| 欧美大香线蕉线伊人久久国产精品| 亚洲自拍欧美色图| 另类专区欧美制服同性| 色狠狠久久aa北条麻妃| 91av一区二区三区| 国产日韩中文字幕| 女女同性女同一区二区三区91| 日日夜夜精品网站| 一本—道久久a久久精品蜜桃| 国产精品久久久一区二区三区| 国产极品精品在线观看| 国产精品一区av| 激情五月宗合网| 日本不卡一区二区三区视频| 亚洲综合日韩在线| 国产精品国产亚洲精品看不卡15| 久久精品人成| 777精品久无码人妻蜜桃| 国产精自产拍久久久久久| 精品人伦一区二区三区| 欧美自拍大量在线观看| 日韩不卡视频一区二区| 无码人妻精品一区二区三区66| 欧美激情在线观看视频| 欧美麻豆久久久久久中文| 国产精品久久久久久久久久免费 | 国产一区二区三区高清| 日本不卡视频在线播放| 亚洲精品国产精品国自产观看| 久久91亚洲精品中文字幕| 国产精品久久久久久久美男| 国产精品免费视频一区二区| 日韩一区二区在线视频| 久久草视频在线看| 九色在线视频观看| 国产成人短视频| 久久久亚洲天堂| 91成人福利在线| 久久频这里精品99香蕉| 国产精品99久久久久久久| 久久久影视精品| 国产成人精品福利一区二区三区| 91久久久久久久| av色综合网| 国产精品333| 国产ts一区二区| 久久久久久国产精品一区| 日韩有码在线观看| 国产精品欧美亚洲777777| 国产精品毛片va一区二区三区| 国产精品入口夜色视频大尺度| 久久精品电影网站| 国产精品免费区二区三区观看| 国产精品日韩二区| 两个人的视频www国产精品| 国产99久久精品一区二区 夜夜躁日日躁 | 久久综合中文色婷婷| 91免费看蜜桃| 国产高清av在线播放| 日韩一区二区欧美| 国产精品乱码一区二区三区| 欧美成人精品在线播放| 一区二区三区的久久的视频| 久久97精品久久久久久久不卡| 久99久在线视频| 亚洲国产精品一区二区第四页av| 亚洲va韩国va欧美va精四季| 日本免费不卡一区二区| 男人天堂a在线| 成人中文字幕av| 国产成人激情视频| 国产精品久久久久久久久久直播 | 99国产精品白浆在线观看免费| 久久久亚洲影院你懂的| 久久久久久午夜| 国产精品免费在线播放| 久热精品视频在线观看| 亚洲日本一区二区三区在线不卡| 日本久久久网站| 免费观看亚洲视频| 91久久偷偷做嫩草影院| 日韩日本欧美亚洲| 九九热精品视频| 视频一区二区在线观看| 欧美动漫一区二区| 99视频免费观看| 色婷婷av一区二区三区在线观看| 欧美成人性色生活仑片| 电影午夜精品一区二区三区| 秋霞在线观看一区二区三区| 国产自产在线视频| 久久亚洲综合网| 久久在线免费观看视频| 无码人妻h动漫| 精品婷婷色一区二区三区蜜桃| 91国自产精品中文字幕亚洲 | 日韩av免费看网站| 黄色一级大片在线观看| 99在线精品免费视频| 久久国产一区二区三区| 伊人久久av导航| 欧美精品欧美精品系列c| 97福利一区二区| 久久精品国产69国产精品亚洲| 国产99久久精品一区二区 夜夜躁日日躁 | 不卡视频一区二区三区| 国产精品网站大全| 日韩一区二区高清视频| 国产视频一视频二| 色妞一区二区三区| 污污污污污污www网站免费| 国产素人在线观看| 久久精品国产清自在天天线| 亚洲欧洲国产日韩精品| 国内精品视频久久| 视频在线一区二区| 亚洲一区二区三区在线视频| 欧美视频免费看欧美视频| av在线免费观看国产| 国产精品高潮在线| 欧洲久久久久久| 国产成人一二三区| 亚洲精蜜桃久在线| 成人在线观看毛片| 欧美成人免费一级人片100|