Question

In: Computer Science

A one Megabytes block of memory is allocated using the buddy system. Show the results of...

A one Megabytes block of memory is allocated using the buddy system. Show the results of the following sequence of requests and returns in a figure that is similar to Figure 7.6: Request A: 200 Kilobytes;

Request B: 80 Kilobytes;

Request C: 380 Kilobytes;

Return A;

Request D: 120 Kilobytes;

Return B;

Return D;

Return C.

Also, find the internal fragmentation at each stage of allocation/de-allocation.

Solutions

Expert Solution

  • Request A: 200 kilobytes
    No such block found, so we traverse up and split the 0-1024 block into 0-511, 512-1024; we add 512-1024 to list tracking 512 Kilobyte blocks and pass 0-511 downwards; again it is split into 0-255 and 255-512; since we have found the required block size, we add 512-1024 to list tracking
    We have 56 kb internal fragmentation here.
  • Request B: 80 kilobytes
    No such block found, so we traverse up and split the 256-512 block into 256-383, 384-512; since we have found the required block size, we add 384-512 to list tracking
    We have 48kb internal fragmentation here.
  • Request C: 380 kilobytes
    we have found the required block size 512-1024
    We have 132kb internal fragmentation here.
  • Deallocation Request A: 200 kilobytes
    Deallocation will be done,no coalesscing possible  and 0-255 block is free.
  • Request D: 120 kilobytes
    No such block found, so we traverse up and split the 0-255 block into 0-127, 128-255; we have found the required block size. we have 8kb internal fragmentation here.
  • Deallocation Request B: 80 kilobytes
    Deallocation will be done, no coalesscing possible  and 256-383 block is free.
  • Deallocation Request D: 120 kilobytes
    Deallocation will be done, coalesscing of the blocks 0-127,128-255 ,256-512 will also be done and 0-127 block is free.
  • Deallocation Request C: 380 kilobytes
    Deallocation will be done,coalesscing of the blocks 0-511, 512-1024 will also be done and 512-1024 block is free.

Related Solutions

Constructors/Destructors - Initialize your data. Allocate memory if using a dynamically allocated array. The destructor should...
Constructors/Destructors - Initialize your data. Allocate memory if using a dynamically allocated array. The destructor should deallocate the memory. The constructor should take a single int variable to determine the size. If no size is specified (default constructor), then the size should be set to 50. operator[](size_t) - This should return the location with the matching index. For example if given an index of 3, you should return the location at index 3 in the list. Location class/struct - This...
malloc() searches the recently de-allocated memory objects to satisfy incoming memory allocation request. Explain the rationale...
malloc() searches the recently de-allocated memory objects to satisfy incoming memory allocation request. Explain the rationale of this design.
Implement a Linux Block Driver which simulates a block device with a region of memory init,...
Implement a Linux Block Driver which simulates a block device with a region of memory init, exit, and IO functionalities must be included. Please use either C or C++ Programming for this Thank You!
ISP have been allocated the address block 200.23.16.0/20 ISP, wants to divide its address block into...
ISP have been allocated the address block 200.23.16.0/20 ISP, wants to divide its address block into four equal sized address blocks and give one to each of four organizations. Write the address range and also subnet mask for each organization
What are the block tags and block indexes for the below 12-bit memory locations with 256-byte...
What are the block tags and block indexes for the below 12-bit memory locations with 256-byte cache? a. 0001 0110 1010, for 16-byte blocks with direct-mapped cache b. 0010 0011 1011, for 4-byte blocks with 4-way associative cache
1) Which one of the following would most likely be allocated to products using ABC by...
1) Which one of the following would most likely be allocated to products using ABC by McDonald's? A) Cost of plastic gloves worn by the burger cooks B) Cost of employees who chop lettuce C) Cost of tomatoes added to burgers D) Cost of cups for soft drinks 2) Fixed costs..... A) increase per unit as total production decreases B) increase in total as total production increases C) decrease in total as total production decreases D) decrease per unit as...
Memory was allocated initially for 5 elements, later on two more elements added to list. How...
Memory was allocated initially for 5 elements, later on two more elements added to list. How can space be managed in such case. Implement the scenario in C. IN C PROGRAMING
We decide to speed up the virtual memory system of question 1 by using a translation...
We decide to speed up the virtual memory system of question 1 by using a translation lookaside buffer (TLB). Suppose your memory system has the characteristics shown in the following table. The TLB and cache miss rates indicate how often the requested entry is not found. The main memory miss rate indicates how often page faults occur.                                                                            Memory Characteristics Memory Unit Access Time (Cycles) Miss Rate TLB 1 0.05% Cache 1 2% Main memory 100 0.0003% Hard drive...
A block of memory contains 40 random words of data. Assume that the values are in...
A block of memory contains 40 random words of data. Assume that the values are in two’s complement representations and are stored in the Read/Write memory area. You need to provide the 40 random words and to include them in an initialization file: assign.ini. Write a program using the ARM assembly programming language to do the following: a) You are required to reverse the word order in a block of 40 random words (Hint: the last word stored in the...
Using Activity based costing, why are indirect costs allocated while direct costs are not allocated?
Using Activity based costing, why are indirect costs allocated while direct costs are not allocated?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT