Solved

Heap in Linux

Posted on 2003-11-26
8
939 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 5

Author Comment

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

Expert Comment

by:majorwoo
ID: 9828073
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
ID: 9829728
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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
LVL 5

Author Comment

by:drnick
ID: 9829823
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
ID: 9837666
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
ID: 10306362
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The purpose of this article is to show how we can create Linux Mint virtual machine using Oracle Virtual Box. To install Linux Mint we have to download the ISO file from its website i.e. http://www.linuxmint.com. Once you open the link you will see …
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

739 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