Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The malloc() routine in the C standard library uses the sbrk() Unix/Linux kernel call to allocate space for the heap. If the default heap was

The malloc() routine in the C standard library uses the sbrk() Unix/Linux kernel call to allocate space for the heap. If the default heap was 10000 bytes, for example, and if heapptr was the pointer to the start of the heap, then it would use heapptr=sbrk(10000) to initialize the heap pointer.

Suppose you used sbrk() instead of malloc()to allocate memory for dynamically created objects in your application. Assume you make this change, without making any other changes, and your code still works. Also assume that your program uses large numbers of small objects.

a) There must be some heap manager function your code did not use. What function?

b) Given what you know about how the memory management unit and the implementation of the data segment in modern Unix/Linux systems, what can you conclude about the efficiency of your program after you make the changes described here?

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

Recommended Textbook for

T Sql Fundamentals

Authors: Itzik Ben Gan

4th Edition

0138102104, 978-0138102104

More Books

Students also viewed these Databases questions

Question

25.0 m C B A 52.0 m 65.0 m

Answered: 1 week ago