Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

. . 6. (30) Consider a memory allocator with the following properties: Allocations are 4-bytc aligned for cach memory block, cither allocated or frec Allocator

image text in transcribed image text in transcribed

. . 6. (30) Consider a memory allocator with the following properties: Allocations are 4-bytc aligned for cach memory block, cither allocated or frec Allocator uses an implicit free list Allocator uses immediate coalescing that is, adjacent free blocks are merged immediately cach time a block is freed To find a free block, first fit method is used The allocated and free blocks both have header and footer The header and footer use: the higher order 14 bits to record block size (block size includes the header and footer) . the lower order 2 bits to record allocation information: bit O indicates the use of current block-1 for allocated, o for frec bit 1 indicates the use of previous adjacent block: 1 for allocated, O for free. 10 Dits Eeader 15 Block size (bytes) Footer Block size (bytes) If the heap starts at memory address Oxb000, show the contents of heap after cach of the following requests. Note that the addresses grow from top down. i. ii. iii. iv. Draw the heap Indicate the memory location that pl.p2, and p3 points at. Indicate each memory block either allocated or frec. Indicate the blocks that contain header and footer. Give the contents of header and footer for cach block (in hexadecimal). Don't forget to indicate the change in header and footer when there is a need. V. c) pl - malloc(3) b) p2 - malloc(5) c) free (pl) d) p3 - malloc(9) c) free (p2) f) p4 - malloc (4) Show all your work and briefly explain your answer! Your heap will be like the following and you will draw the heap 5 times (i.c., for each request). You can insert more rows as you need. Address Content Header/Footer ? is pointed ? Oxb000 Oxb002 Oxb004 Oxb006 Oxb008 Oxbood OxbOOC . . 6. (30) Consider a memory allocator with the following properties: Allocations are 4-bytc aligned for cach memory block, cither allocated or frec Allocator uses an implicit free list Allocator uses immediate coalescing that is, adjacent free blocks are merged immediately cach time a block is freed To find a free block, first fit method is used The allocated and free blocks both have header and footer The header and footer use: the higher order 14 bits to record block size (block size includes the header and footer) . the lower order 2 bits to record allocation information: bit O indicates the use of current block-1 for allocated, o for frec bit 1 indicates the use of previous adjacent block: 1 for allocated, O for free. 10 Dits Eeader 15 Block size (bytes) Footer Block size (bytes) If the heap starts at memory address Oxb000, show the contents of heap after cach of the following requests. Note that the addresses grow from top down. i. ii. iii. iv. Draw the heap Indicate the memory location that pl.p2, and p3 points at. Indicate each memory block either allocated or frec. Indicate the blocks that contain header and footer. Give the contents of header and footer for cach block (in hexadecimal). Don't forget to indicate the change in header and footer when there is a need. V. c) pl - malloc(3) b) p2 - malloc(5) c) free (pl) d) p3 - malloc(9) c) free (p2) f) p4 - malloc (4) Show all your work and briefly explain your answer! Your heap will be like the following and you will draw the heap 5 times (i.c., for each request). You can insert more rows as you need. Address Content Header/Footer ? is pointed ? Oxb000 Oxb002 Oxb004 Oxb006 Oxb008 Oxbood OxbOOC

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Define policy making?

Answered: 1 week ago

Question

Define co-ordination?

Answered: 1 week ago

Question

What are the role of supervisors ?

Answered: 1 week ago