Fall 2008 Malloc Lab: Writing a Dynamic Storage Allocator Assigned: December 16, Due: December 28, 11:59PM
YanQiben 12.16 2008
YanQiben (072021029@fudan.edu.cn) is the lead person for this assignment.
1 Introduction
In this lab you will be writing a dynamic storage allocator for C programs, i.e., your own version of the malloc, free and realloc routines. You are encouraged to explore the design space creatively and implement an allocator that is correct, efficient and fast.
2 Logistics
You may work in a group of up to one people. Any clarifications and revisions to the assignment will be posted on the course Web page.
3 Hand Out Instructions
Start by copying malloclab-handout.tar to a protected directory in which you plan to do your
…show more content…
Similarly, if the old block is 8 bytes and the new block is 4 bytes, then the contents of the new block are identical to the first 4 bytes of the old block. These semantics match the the semantics of the corresponding libc malloc, realloc, and free routines. Type man malloc to the shell for complete documentation.
5 Heap Consistency Checker
Dynamic memory allocators are notoriously tricky beasts to program correctly and efficiently. They are difficult to program correctly because they involve a lot of untyped pointer manipulation. You will find it very helpful to write a heap checker that scans the heap and checks it for consistency. Some examples of what a heap checker might check are: • Is every block in the free list marked as free? • Are there any contiguous free blocks that somehow escaped coalescing? • Is every free block actually in the free list? • Do the pointers in the free list point to valid free blocks? • Do any allocated blocks overlap? • Do the pointers in a heap block point to valid heap addresses? Your heap checker will consist of the function int mm check(void) in mm.c. It will check any invariants or consistency conditions you consider prudent. It returns a nonzero value if and only if your heap is consistent. You are not limited to the listed suggestions nor are you required to check all of them. You
and assigning memory using calloc (allows memory space '0' to be assigned to the very first bucket). (4.) Subsequently,
Consider that the memory as the previous table = > 300: 3005; 301 : 5940; 302 : 7006; ... ; 940 : 0002;
c) The memory chip reply with the data from the demanded memory position on the data bus.
a. The CPU tells the RAM which address holds the data that the CPU wants to
1. Consider a processor that supports virtual memory. It has a virtually indexed physically tagged cache, TLB, and page table in memory. Explain what happens in such a processor from the time the CPU generates a virtual address to the point where the referenced memory contents are available to the processor.
This unit we covered more specifics about how to implement compression. As part of that, we looked at different methods that can be used and what the benefits of each type would be. For the discussion assignment, I needed to implement Heap’s Law against the output of our programming assignment from last week. We needed to not only get the outcome of implementing the function but also determine how the information we obtained from the result could be applied to our understanding of what the program performed.
For this assignment I develop and either pseudo code or a flowchart for my following programming problem.
3) Quick sort – It also tends to have a significantly high memory space mostly due to the stack
An integer is stored somewhere in the memory; a pointer to this integer is at address 200. Show how memory indirect addressing is used to increment the number.
(a) [4 marks] Complete the timing diagram for outputs Y and Z for the memory element shown below. The initial state of the memory element is Y = 1 and Z = 0, as shown on the timing diagram.
Memory segmentation is the division of a computer's primary memory information into sections. Segments are applied in object records of compiled programs when linked together into a program image and when the image is loaded into the memory. Segmentation sights a logical address as a collection of segments. Each segment has a name and length. With the addresses specifying both the segment name and the offset within the segment. Therefore the user specifies each address by two quantities: a segment name and an offset. When compared to the paging scheme, the user specifies a single address, which is partitioned by the hardware into a page number and an offset, all invisible to the programmer. Memory segmentation is more visible
Equation \ref{e.cost2} depends on distribution of the data as well. Let $T_{cap}$ be the total capacity of disk in a node and $T_{used}$ be the total used space. Therefore the ideal storage on each volume/disk should be $I_{storage} = T_{cap} / T_{used}$. The volume of data density is difference between ideal storage and current DFS used ratio, in other words volume data density for one node is $DD_{volume} = I_{storage} - dfsUsedRatio$, where $DD_{volume}$ is volume of data density. A positive value of $DD_{volume}$ indicates that disk is under utilized and a negative indicates that disk is over-utilized. Now the we can calculate data distribution around the data center. This is done by computing nodes with maximum skew from $I_{storage}$ values, for that we sum all the absolute values of $DD_{volume}$. The node data density is calculated as: $node_{DD}= \sum_{d_{i}\epsilon DD_{volume}(I)} \left | d_{i} \right |$ \cite{jiraissue1312}, where $node_{DD}$ is
Note: Emails received after Due Date Due Date will be marked LATE and subject to a grade of 0 for the assignment.
Lesson 3.1 is a review of the low-level constructs that we use to store and
If the value of M at address A (10) in the data RAM) is equal to 0