Coursework: xv6 Memory Management
This assignment is worth 20% of the final module grade.
It covers Learning Objectives 1 (LO1) and 2 (LO2) of the module:
LO1: compare operating system design decisions and associate those decisions with performance
LO2: describe how operating systems manage computer resources.
This coursework is a combination of a programming task and a short written report that explains your code and implementation. It builds upon lab and group tasks set earlier in the module so you will need to engage with all the practical tasks to be able to complete and pass this assignment.
This is an individual project and although discussion of your ideas is encouraged, plagiarism,copying or submission of someone else’s work is strictly prohibited and could result in you committing an academic integrity offence.
Standard late penalties apply for work submitted after the deadline.
Assessment & Submission
There will be TWO assignment submission points for the TWO parts of your coursework.
You will be required to submit both your code and the associated written report.
The code you have submitted will be tested automatically to confirm that it works.
Code Submission: Upload your code to the assignment point in Minerva via Gradescope:
As a single zip file named: comp2211_username.zip
(where username is your IT username)
Report Submission: Upload the report to the Minerva Turnitin assignment submission point:
as a single PDF named: comp2211report_username.pdf
Remember that Turnitin will automatically check for plagiarism and will indicate to the markers if you have included text from other sources without properly citing and referencing.Your task
Part (a): xv6 programming exercise
In a standard Linux, dynamic memory allocation is facilitated by calls to malloc, free, realloc and calloc.
Behind the scenes, these calls are dynamically expanding and shrinking the heap memory segment of the process.
Your task is to implement functions similar to malloc and free to meet the following specification in a copy of xv6 (our model operating system) which does not have these features implemented.
Your code should be implemented in a new file called
…and with a corresponding header file:
Your files should be suitable for location in the user directory of xv6.
(i) Implementing a version of malloc (7 marks)
The malloc function allocates the specified number of bytes and returns a pointer to the allocated memory. The memory is not initialized.
If the requested size is 0, then malloc() returns either NULL, or a unique pointer value that can later be successfully passed to free.
- the function should have the prototype void* _malloc(int size)
- the function should return a void pointer to the start of the allocated memory
- the function should allocate memory on the heap
- the function should implement a mechanism which is space efficient
(i) Implementing a version of free (7 marks)
The free function frees the memory space pointed to by the parameter which must have been returned by a previous call to _malloc().
Otherwise, or if free has already been called on the pointer before, undefined behaviour occurs. If the pointer is NULL, no operation is performed.
- the function should have the prototype void _free(void *ptr)
- the function should “free” the memory and make it available for subsequent allocations
- the function should implement a mechanism which is space efficientPart (b): written report (6 marks)
Your written report should explain how you implemented the feature(s) you programmed in part (a). It should be a maximum of three (3) sides of A4 (excluding references and title page) and should have line spacing, font size and margins appropriate for a technical report (Arial or Times New Roman size
11, 2 cm margins and 1.5 line spacing).
Ensure that you reference (following the University recommendations on referencing) any books,papers, tutorials or Web/ Video resources that you have used.
Please make sure you put your name and student number in the document header and page numbers in the footer.
Use diagrams where appropriate instead of long and complex written descriptions.
The report should include the following sections:
(a) The design decisions you made to implement your solution
(b) A detailed explanation of your code and why you have implemented the features in the way you did
(c) A reflection of the skills you learned, what went well and what you would do differently in future
The report will be marked as follows:
Understanding of the requirements (10%)
Code description and comprehension (70%)
Report structure and quality of English (10%)
本网站支持 Alipay WeChatPay PayPal等支付方式
E-mail: firstname.lastname@example.org 微信号:vipnxx