Hi
memory management system consist of three layers
physical,virtual and malloc/new,free/delete,
so... i never used malloc in my normal program,
i used to use new and delete but i don't know exactly
what malloc does.I read some articals
about its job and they said it puts a pointer at some continuous free pages and this pages may not be continuous in the physical memory but they are in the virtual one.
Is this the way the three layers work together?
thats it some explain about malloc,free and the three layers.
Thanx
physical,virtual,malloc
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
Re:physical,virtual,malloc
Here is the documentation I could find using Google.
General Function Information
http://www.opengroup.org/onlinepubs/009 ... alloc.html
http://www.opengroup.org/onlinepubs/009 ... alloc.html
http://www.opengroup.org/onlinepubs/009 ... alloc.html
http://www.opengroup.org/onlinepubs/009 ... /free.html
http://www.opengroup.org/onlinepubs/009 ... align.html
More Information With Examples...
http://www.cplusplus.com/ref/cstdlib/free.html
http://www.cplusplus.com/ref/cstdlib/malloc.html
http://www.cplusplus.com/ref/cstdlib/calloc.html
http://www.cplusplus.com/ref/cstdlib/realloc.html
delete() appears to be C++ ?
I recommend googling for examples
I hope this help's a little
General Function Information
http://www.opengroup.org/onlinepubs/009 ... alloc.html
http://www.opengroup.org/onlinepubs/009 ... alloc.html
http://www.opengroup.org/onlinepubs/009 ... alloc.html
http://www.opengroup.org/onlinepubs/009 ... /free.html
http://www.opengroup.org/onlinepubs/009 ... align.html
More Information With Examples...
http://www.cplusplus.com/ref/cstdlib/free.html
http://www.cplusplus.com/ref/cstdlib/malloc.html
http://www.cplusplus.com/ref/cstdlib/calloc.html
http://www.cplusplus.com/ref/cstdlib/realloc.html
delete() appears to be C++ ?
I recommend googling for examples
I hope this help's a little
Re:physical,virtual,malloc
for application development malloc() and free() differs from new and delete in the following:
1- malloc() and free() are library procedures while new and delete are operators.
2- malloc() and free() allocates and de-allocates memory of arbitrary size.
3- new and delete performs more than just allocation and deallocation. They call constructors of objects.
the following articles just describe the three layers.
http://www.osdever.net/tutorials/memory1.php?the_id=44
http://www.osdever.net/tutorials/memory2.php?the_id=45
or if you want pdf versions:
http://www.osdever.net/tutorials/pdf/memory1.pdf
http://www.osdever.net/tutorials/pdf/memory2.pdf
the main idea is having a system call more_memory() which increases the address space of a given process by amount of memory and having some management of this new area.
heap management.
There are many algorithms in the last level:
I used address-ordered first fit algorithm.
this pdf contains some description:
http://www.cs.northwestern.edu/~pdinda/ics-s05/doc/dsa.pdf
::)
1- malloc() and free() are library procedures while new and delete are operators.
2- malloc() and free() allocates and de-allocates memory of arbitrary size.
3- new and delete performs more than just allocation and deallocation. They call constructors of objects.
the following articles just describe the three layers.
http://www.osdever.net/tutorials/memory1.php?the_id=44
http://www.osdever.net/tutorials/memory2.php?the_id=45
or if you want pdf versions:
http://www.osdever.net/tutorials/pdf/memory1.pdf
http://www.osdever.net/tutorials/pdf/memory2.pdf
the main idea is having a system call more_memory() which increases the address space of a given process by amount of memory and having some management of this new area.
heap management.
There are many algorithms in the last level:
I used address-ordered first fit algorithm.
this pdf contains some description:
http://www.cs.northwestern.edu/~pdinda/ics-s05/doc/dsa.pdf
::)
To write an OS you need 2 minds one for coding and other for debugging.