Preview

Malloc Lab: Writing a Dynamic Storage Allocator

Powerful Essays
Open Document
Open Document
2325 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Malloc Lab: Writing a Dynamic Storage Allocator
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 work. Then give the command: tar xvf malloclab-handout.tar. This will cause a number of files to be unpacked into the directory. The only file you will be modifying and handing in is mm.c. The mdriver.c program is a driver program that allows you to evaluate the performance of your solution. Use the command make to generate the driver code and run it with the command ./mdriver -V. (The -V flag displays helpful summary information.) Looking at the file mm.c you’ll notice a C structure team into which you should insert the requested identifying information about the one individual comprising your programming team. Do this right away so you don’t forget. When you have completed the lab, you will hand in only one file (mm.c), which contains your solution.

1

4 How to Work on the Lab
Your dynamic storage allocator will consist of the following four functions, which are declared in mm.h and defined in mm.c. int mm_init(void); void *mm_malloc(size_t size); void mm_free(void *ptr); void *mm_realloc(void *ptr, size_t size); The mm.c file we have given you implements the simplest but still functionally correct malloc package that we could think of. Using this as a starting place, modify these functions (and possibly define other private static

You May Also Find These Documents Helpful

  • Satisfactory Essays

    Over the past 30 years the cost of Electronics has steadily decreased. The cost of electronic storage has decreased greatly over the past 30 years as well. In this paper I will be talking about the decrease in the cost of RAM and Hard Drive Storage, how much will a 100TB HDD will cost when it becomes widely available in the future, and how much memory I will be able to buy with $100 in 10 years. In 1956, IBM created the first commercial Hard Drive called the IBM 305 RAMAC which held 5MB and cost a whopping 50 thousand dollars! Electronic storage started being more widespread during the early 1980’s, but it wasn’t until the 1990s that RAM and Hard Drive Storage begin to be cheap enough for the average person. Back in 1981 the price for one MB of Hard Drive storage space was $340! Most people couldn’t afford a computer back in the 1980’s because of the huge cost. Through the 1980’s the cost per MB fell from around $340 during 1981 then to $40 per MB in 1988, and finally to $9 per MB in 1990. The cost of one Bit of ram in 1981 was 0.000425 cents, in 1988 it was 0.000005 cents, in 1995 it was 0.000000158 cents, in 2000 the cost per Bit…

    • 494 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    SD1230 Lab 1

    • 239 Words
    • 2 Pages

    1. What happens to the volatile memory when the power is lost? –RAM is deleted…

    • 239 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Arrays store items that have the same type of data type like a group of employees’ names and social security numbers for a team of 2000 personal. Pointer is a variable that greatly extends the power and flexibility of a program, each memory location that is used to store data value has an address. The address provides the means for a PC hardware to reference a particular data item.…

    • 485 Words
    • 2 Pages
    Good Essays
  • Powerful Essays

    Fins 2624 Assignment

    • 1893 Words
    • 8 Pages

    You may cooperate on this assignment in groups consisting of up to three students. If you prefer to work alone or with only one other student that is fine, too. Either way, make sure to enter the student IDs (including the letter) and names of all students in your group in the appropriate cells (B1:B6) on the Answers sheet. There will be draconian punishments for students that fail to do this.…

    • 1893 Words
    • 8 Pages
    Powerful Essays
  • Good Essays

    Comp 220

    • 1463 Words
    • 6 Pages

    The Resistor class created in the Week 2 lab will be used as the class that the pointer operations will be used upon. The lab also requires the use of accessor functions and static data members, which may need to be added to the Resistor class definition and implementation.…

    • 1463 Words
    • 6 Pages
    Good Essays
  • Powerful Essays

    2. For direct-mapped cache, a main memory address is viewed as consisting of three fields. List and define the three fields.…

    • 1721 Words
    • 7 Pages
    Powerful Essays
  • Better Essays

    Week 5 Pos 355

    • 2010 Words
    • 9 Pages

    Memory management is an important part of an operating. The UNIX/Linux OS use numerous intricate algorithms for memory management which will permit the system to…

    • 2010 Words
    • 9 Pages
    Better Essays
  • Powerful Essays

    Datalab

    • 2606 Words
    • 11 Pages

    15-213/18-213 Fall 2012 Data Lab: Manipulating Bits Assigned: Thu, Aug 30, Due: Thu, Sep 13, 11:59PM Last Possible Time to Turn in: Sun, Sep 16, 11:59PM…

    • 2606 Words
    • 11 Pages
    Powerful Essays
  • Good Essays

    Symtab

    • 1520 Words
    • 7 Pages

    #include<stdio.h> #include<malloc.h> #include<string.h> #include<stdlib.h> int k=0; struct symtab { char name[10],type[10]; int size,address; char value[10]; }s[20];…

    • 1520 Words
    • 7 Pages
    Good Essays
  • Powerful Essays

    Linked List

    • 3270 Words
    • 14 Pages

    – Successive elements are connected by pointers. – Last element points to NULL. – It can grow or shrink in size during execution of a program. – It can be made just as long as required. – It does not waste memory space. A…

    • 3270 Words
    • 14 Pages
    Powerful Essays
  • Good Essays

    Memory Management

    • 589 Words
    • 3 Pages

    There are two different types of programming systems; uniprogramming and multiprogramming. In uniprogramming there is just an operating system and the program that is currently being utilized. In multiprogramming, it is just as the term says, working to accommodate multiple programs. When are there is more than one program being executed at a time, there needs to be proper protocol and system checks. There are five requirements that memory management needs to satisfy: relocation, protection, and sharing, logical and physical organization.…

    • 589 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    First and foremost, it is vital to understand that an operating system (OS) is just a program - a very large, very complex program, but still just a program. The OS provides support for the loading and execution of other programs (which we will refer to below as ``application programs''), and the the OS will set things up so that it has some special privileges which user programs don't have, but in the end, the OS is simply a program.…

    • 9021 Words
    • 37 Pages
    Powerful Essays
  • Powerful Essays

    Data structures

    • 7448 Words
    • 47 Pages

    2. Ellis Horowitz, Sartaj Sahni, & Susan Anderson Freed, “Fundamentals of Data Structures in C”, University Press, 2nd Edition, 2008 (Sections 3.5, 4.7, 6.1, 6.2.1, 6.2.2, 6.3.1, 6.3.2)…

    • 7448 Words
    • 47 Pages
    Powerful Essays
  • Satisfactory Essays

    memory management

    • 500 Words
    • 2 Pages

    Memory management can become very complex in modern day computers as with the requirements for the management of the memory. There are four categories that must be satisfied within memory management which are address mapping and relocation, protection and sharing, application organization, and two-level memory organization. Had one of these categories not been satisfied through memory management, then it is a failure and could cause major problems in terms of an operating system.…

    • 500 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    The memory management operators can be overloaded to customize allocation and deallocation (e.g. to insert pertinent memory headers). They should behave as expected, new should return a pointer to a newly allocated object on the heap, delete should deallocate memory, ignoring a NULL argument. To overload new, several rules must be followed:…

    • 519 Words
    • 3 Pages
    Good Essays

Related Topics