Assignment作业 | Thread代做 | OS代写 | C语言代写 | C++代写 – Test Programs

Assignment作业 | Thread代做 | OS代写 | C代写 | C语言代写 | C++代写 – 这是一个利用C语言进行的内存分配方面的任务,属于操作系统题目比较难的部分

Test Programs

Provided with the assignment download are two test programs:

  • ivec_main – Collatz Conjecture simulation with dynamic array
  • list_main – Collatz Conjecture simulation with linked list

A Makefile is included that links these two programs with each of three different memory allocators: the system allocator and two allocators you will need to provide.

Task #1 – Adapt HW07 to be thread Safe

Select the hmalloc implementation submitted for HW07 and update it as follows:

  • Make it thread safe by adding a single mutex guarding your free list. There should be no data races when calling hmalloc/hfree functions concurrently from multiple threads.
  • Implement realloc.
  • Edit hw07_malloc.c in the starter code to either include or call your updated hmalloc.

Task #2 – Implement an optimized memory

allocator

Edit par_malloc.c to either implement or call an optimized concurrent memory allocator. This allocator should run the test cases as quickly as possible – definitely faster than hw07_malloc, and optimally faster than sys_malloc.

The two things that slow down hw07_malloc are 1.) lock contention and 2.) algorithmic complexity. Your optimized allocator should try to reduce these issues as much as possible.

Task #3 – Graph & Report

Time all six versions of the program ({sys, hw7, par} X {ivec, list}). Select input values so that you can distinguish the speed differences between the versions.

Do your timing on your local development machine.

Include a graph.png showing your results.

Include a report.txt with:

  • ASCII art table of results
  • Information on your test hardware / OS.
  • Discussion of your strategy for creating a fast allocator.
  • Discussion of your results

To Submit

A gzipped tarball containing:

  • Exactly one top level directory containing
  • A Makefile and source files to build all six versions of the test programs, as provided in the assignment download.
  • And report.txt / graph.png
  • No stray files.
  • If you add source files, make sure to modify the Makefile correctly.

Grading Notes

For this assignment we’ll be grading on both correctness and performance.

Here are some of the items we’ll be looking for in manual grading:

  • Your par_malloc should be faster than your hw07_malloc
  • Your par_malloc should be faster than sys_malloc
  • Your par_malloc should correctly handle coalescing when malloc and free occur in the same thread.
  • Your par_malloc should correctly handle coalescing when malloc and free occur in different threads.

If your allocator design uses a technique (like binning) where "coalescing" isn’t quite the right concept, your code still shouldn’t waste a ton of RAM due to fragmentation. If we allocate 100 MB of size 100 chunks and then 100 MB of size 200 chunks, the memory usage of the process shouldn’t be 200M.

That being said, avoiding fragmentation after beating the memory allocator won’t be a huge component of your grade.

发表评论

电子邮件地址不会被公开。 必填项已用*标注