合肥生活安徽新闻合肥交通合肥房产生活服务合肥教育合肥招聘合肥旅游文化艺术合肥美食合肥地图合肥社保合肥医院企业服务合肥法律

代做COMP2046、代写Memory Management

时间:2023-12-17  来源:合肥网hfw.cc  作者:hfw.cc 我要纠错


Coursework COMP2046: Memory Management and Concurrent Programming

 Weight: 20% module marks

Deadline: 22nd December 2023, 5pm Beiging time

Submission: Create a single scyXXX.zip (Student account) file containing your source code files and reports. We will need to rebuild your code to test your implementation. You should submit your single zip file through Moodle.

Copying Code and Plagiarism

 You may freely copy and adapt any code samples provided in the lab exercises or lectures. You may freely copy code samples from the Linux/POSIX websites, which has many examples explaining how to do specific tasks. This coursework assumes that you will do so and doing so is a part of the coursework. You are therefore not passing someone else’s code off as your own, thus doing so does not count as plagiarism. Note that some of the examples provided omit error checking for clarity of the code. You are required to add error checking wherever necessary.

You must not copy code samples from any other source, including another student on this or any other course, or any third party (such as GPT). If you do so then you are attempting to pass someone else’s work off as your own and this is plagiarism. The University takes plagiarism extremely

seriously and this can result in getting 0 for the coursework, the entire module, or potentially much worse.

Coding and Compiling Your Coursework

 You are free to use a code editor of your choice, but your code MUST compile and run on a Linux environment. It will be tested and marked on these machines.

IMPORTANT: There are source file memory_allocation_simulation.c available on Moodle for download that you must use. To ensure consistency across all students, apart from the number parameter setting changes and the required TODO code, you are not allowed to change anything in the given source files. You need to compile your code using gcc compiler (e.g. gcc task1.c - o taks1 or gcc task2.c -pthread -o task2 ). Code cannot be successfully compiled on linux

     

 environment will receive ZERO marks.

 Introduction

 This coursework simulates real-world scenarios in memory management and concurrent programming. It is designed to deepen your understanding of these fundamental concepts through hands-on implementation and analysis.

Task 1: Memory Allocation Algorithm Implementation within a Bounded Buffer (6 Marks)

Objective

Implement and complete a memory allocation algorithm within a bounded buffer to emulate real- world memory management scenarios.

System Overview and Simulation Context

Code Base: You are provided with memory_allocation_simulation.c , which sets the groundwork for the simulation.

Simulation Environment: The code simulates a memory management system, reflecting typical real-world constraints and behaviors.

Random Memory Requests: The system generates multiple random memory requests, each with a unique ID, required memory size, allocation time, and duration.

Bounded Buffer Implementation: A bounded buffer, acting as a queue, stores up to 100 memory allocation requests. It manages incoming requests when immediate allocation is not feasible.

Memory Allocation Recording: A linked-list structure records the allocation status, with each node indicating process or hole status, request ID, and other relevant data.

Fixed-Size Memory Blocks: Memory is pre-allocated in 1MB (1024KB) blocks, subdivided into 1KB slices for allocation to requests.

Allocation Failure Handling: Requests failing immediate allocation due to space constraints or fragmentation are queued in the buffer.

Periodic Deallocation and Compaction: The system periodically deallocates memory and compacts freed spaces to optimize allocation efficiency.

 

 Configuration Parameters: The simulation works with a total memory size of 1MB, slice size of 1KB, and request sizes varying between 2KB to 50KB.

Detailed Requirements

Complete the Code: Complete the TODO code sections and enhance the provided simulation code to fully implement the memory management system.

Allocation Algorithms: Implement and integrate the Next Fit and Worst Fit allocation algorithms, in addition to the existing First Fit algorithm.

Memory Compaction: Develop a method to compact memory upon deallocation, improving allocation efficiency.

Submission

Submit task1.c containing your source code.

Ensure your code includes clear, explanatory comments.

Evaluation Criteria

Correct Implementation (90%): Accurate and efficient functioning of the Next Fit and Worst Fit algorithms, and the memory compaction method.

Documentation and Comments (10%): Clarity and usefulness of comments explaining the logic behind your implementation.

   Task 2: Multi-threaded Producer-Consumer Simulation with Counted Semaphores (6 Marks)

Objective

Based on the memory management simulation provided by Task 1 ( task1.c ), the objective of this task is to develop a multi-threaded simulation of a producer-consumer system, specifically focusing on memory management. This task requires the use of counted semaphores to manage synchronization between multiple producer and consumer threads.

Detailed Requirements

 Thread Creation and Roles:

 

 Implement a multi-threaded environment with separate threads acting as producers and consumers.

Producers generate memory allocation requests, while consumers process these requests.

Producer Threads:

Each producer thread should generate a random number of memory allocation requests. Request sizes should be random within a specified range (e.g., 2KB to 50KB).

Once generated, these requests must be enqueued into a shared bounded buffer.

Consumer Threads:

Consumer threads are responsible for dequeuing and processing memory allocation

requests from the buffer.

Processing includes simulating the allocation or deallocation of memory blocks, adhering to the memory allocation algorithms implemented in Task 1.

Synchronization with Counted Semaphores:

Utilize counted semaphores to manage access to the shared bounded buffer effectively.

Implement semaphores to signal when the buffer is not empty (for consumers) and not full (for producers), ensuring efficient and safe operation of the producer-consumer system.

Ensure thread safety and prevent race conditions with proper semaphore operations (wait and signal).

Logging and Monitoring:

Provide console output indicating the activities of consumer threads, including

allocation and deallocation of memory blocks.

Include details such as thread ID, operation type, and memory block size in the log messages.

Evaluation Criteria

Implementation of Semaphores (30%): Efficient semaphore use. Functionality (30%): Proper thread operation.

Synchronization (30%): Effective synchronization method.

 

 Documentation and Comments (10%): Quality of comments. Submission

Submit a file named task2.c containing the source code for this simulation.

The code should be well-commented, detailing the implementation and usage of semaphores and thread interactions.

  Task 3: Testing and Performance Analysis (8 Marks)

Objective

Implement and write a report that evaluates the correctness and performance of your implementation in the real-world scenario simulation.

Detailed Requirements:

Test the program using different scenarios, such as varying numbers of producer and consumer threads, different buffer sizes, and a variety of memory allocation patterns.

Measure and analyze key performance metrics, such as throughput (requests processed per second), respond time (hint: you can sue logging time method in the lab to measure the time), and resource utilization.

Discuss the advantages and disadvantages of the chosen memory allocation algorithm in the context of the simulated real-world scenario.

Evaluation Criteria

Testing Accuracy (40%): The thoroughness and relevance of the testing scenarios. Performance Analysis (20%): Depth and accuracy of performance metrics analysis.

Algorithm Evaluation (20%): Critical analysis of the chosen memory allocation algorithm's effectiveness.

Report Quality (20%): Clarity, structure, and comprehensiveness of the written report.

Submission

 Submit a file named task3.pdf containing the report for this performance analysis. The

 

 report should clearly articulate the testing process, performance metrics, and your analysis of the memory allocation algorithm. The length of the report should be less than three pages.

You can also submit your supporting documents (optional):

Source code used to generate evaluation metrics. This code should be well-commented and organized for easy understanding.

Any additional supporting documents such as screenshots of testing, graphs, charts, or other visual aids that illustrate your testing and analysis.

Ensure that all documents are comprehensively labeled and easy to navigate.

 Conclusion

 Completing these tasks will provide invaluable experience in integrating and evaluating memory management algorithms within concurrent programming environments. Good luck, and remember that assistance is available if you have any questions or need further guidance.

 

请加QQ:99515681 或邮箱:99515681@qq.com   WX:codehelp

 

扫一扫在手机打开当前页
  • 上一篇:G6017编程代做代写、MATLAB编程设计代做
  • 下一篇:代做Writing a Dynamic Storage Allocator
  • 无相关信息
    合肥生活资讯

    合肥图文信息
    海信罗马假日洗衣机亮相AWE  复古美学与现代科技完美结合
    海信罗马假日洗衣机亮相AWE 复古美学与现代
    合肥机场巴士4号线
    合肥机场巴士4号线
    合肥机场巴士3号线
    合肥机场巴士3号线
    合肥机场巴士2号线
    合肥机场巴士2号线
    合肥机场巴士1号线
    合肥机场巴士1号线
    合肥轨道交通线路图
    合肥轨道交通线路图
    合肥地铁5号线 运营时刻表
    合肥地铁5号线 运营时刻表
    合肥地铁4号线 运营时刻表
    合肥地铁4号线 运营时刻表
  • 关于我们 | 打赏支持 | 广告服务 | 联系我们 | 网站地图 | 免责声明 | 帮助中心 | 友情链接 |

    Copyright © 2020 hfw.cc Inc. All Rights Reserved. 合肥网 版权所有
    ICP备06013414号-3 公安备 42010502001045