Solved

Heap in Linux

Posted on 2003-11-26
8
926 Views
Last Modified: 2013-11-15
Hi yours,

I am doing a simulation for studying purposes,
and need to know how Heaps are implemented in linux.
With a Heap I mean the memory managing thing, the thing you get by GetProcessHeap()
and not the mathematical datastructure of the same name.
I would like to hear some detailled explaination of the basic algorithms running
and the Heaps features.
Thanks in advance, drnick.

p.s. i'm asking this for windows in another thread too
0
Comment
Question by:drnick
8 Comments
 
LVL 5

Author Comment

by:drnick
Comment Utility
sorry, copy-paste-error: GetProcessHeap is windows, okok
0
 
LVL 9

Expert Comment

by:majorwoo
Comment Utility
drnick,

Seems alot like homework (which we are not allowed to do as you know) -- maybe start us off with what you know, and ask some more specific questions?

majorwoo
0
 
LVL 5

Author Comment

by:drnick
Comment Utility
hi majorwoo,

I understand you concers well.
maybe i gotta specify a little more what i mean.
my question targets into that direction:
i am interested in how they work internally, what data structures and algorithms they use.
if i do HeapAlloc (in windows), for sure it will allocate memory for me,
but how does it this?
does it use kinda best-fit on a sequential set of memory pages, or returns it the first fitting free block?
is free memory handled by a free-space-list or do they come with buddy-processing?
I need to know this, because i am writing a simulation for heaps in general.
therefore, i asked this question on different os'es,
to let the use have a drop down list where she/he can decide, what os to simulate.
for academic purposes, you know.
so, this question is also not a homework, if any doubt occures, the programming will of course be done by myself, i just need some hints to make the simulations as precise as possible.
also, as you can see under my profile, i am a guy who has already answered some questions here, in different areas (and an average-a-student, who really would never ever ask someone to do his homework, to set record straight).
the thing is this: i am doing this for an international project for teaching of computer studies, the simulation'll be for other students and i'm doing this for zero money.
i have to do other stuff as well, and the only time, i can do some work on this, is sunday and tuesday afternoon, so i just want to enhance my perfomance with this question.
if experts maybe can describe in a short, understandable way, how the heap in their os works, and what it's main parameters are, i can process a lot faster.
If you're still questioning my integrity, than it is ok if you don't answer.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 5

Author Comment

by:drnick
Comment Utility
however, i elaborated on my question in the mac-os section a little more, so maybe that'll help anyone who wanna help me. thanks
0
 
LVL 45

Accepted Solution

by:
sunnycoder earned 500 total points
Comment Utility
drnick,

Is it that you are looking at heap organization for the entire system or what is the algorithm used for memory allocation on the heap?

If former, then I think source at dmalloc.com might be helpful in deciphering the required information ...sorry I am not familiar with the organization of overall heap or for that matter who creates/maintains it

However, if you are looking at algorithm used for memory allocation on the heap, then it depends entirely on the implementation of the malloc function in your library .. system/compiler has nothing to do with it ...

generally,

a list of free memory blocks of different sizes is maintained ... this size is generally (mostly) power of 2 ... the minimum size maintained is the minimum amount of memory that can be allocated ... even if you request lesser memory, a whole block will be allocated.

When an allocation request is made, the smallest available block that will satisfy the request is returned ... If request cannot be satisfied, NULL is returned
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
Comment Utility
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Answered by sunnycoder
Please leave any comments here within the next four days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

khkremer
EE Cleanup Volunteer
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now