Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Heap in Linux

Posted on 2003-11-26
8
Medium Priority
?
963 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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
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 2000 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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
Fine Tune your automatic Updates for Ubuntu / Debian
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

670 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