Results 1 to 4 of 4
Hello,
Some questions puzzling me:
When the kernel allocate physical memory to a process, is there a certain limit of KB/MB or pages the kernel can allocate?
If a program ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 06-10-2010 #1Just Joined!
- Join Date
- Jun 2010
- Posts
- 6
Memory allocation
Hello,
Some questions puzzling me:
When the kernel allocate physical memory to a process, is there a certain limit of KB/MB or pages the kernel can allocate?
If a program requests a huge amount of memory, does the kernel give the requested amount at a time? Or does it allocates in small pieces(not continuous physically)?
Is it possible that a user program can roll its own physical memory allocator, instead of resorting to kernel?
Thanks in advance!
- 06-10-2010 #2
Google- linux kernel memory allocation
The top hit looks like a good place to start.Jay
New users, read this first.
New Member FAQ
Registered Linux User #463940
I do not respond to Private Messages asking for Linux help. Please, keep it on the public boards.
- 06-10-2010 #3Just Joined!
- Join Date
- Jun 2010
- Posts
- 6
Please clarify something for me. When a user program requests some memory in user space, does this request go to the OS kernel? Since only the OS knows which physical locations can be allocated to the process(?), Or can a user process have access to the data structure which stores all the free physical pages directly(then operate on it)? My understanding is no, but still enlighten me please.
My question was: does Linux OS has any limit on the amount of physical memory can be allocated to a user process (in user space) if OS is in this process?
Uh, I am confusing myself.
- 06-12-2010 #4Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,227
The malloc/free and related API calls are not system (kernel) calls, though one function they use when necessary, brk(), is. The brk() function, called by malloc() and friends, sets the end of the process data segment. This is virtual memory, and where it is physically mapped to depends entirely on the kernel. Once the process virtual memory space has been allocated/set, then malloc() and free() can physically manipulate it to allocate and delete dynamic memory from that space. The amount of space that brk() asks for is generally in some number of system pages.
As for size limits, that is determined by the process limits, which is determined at runtime by a call to getrlimit(). The system command ulimit can alter this up to system or administrator defined maximum values.Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote
