Skip to contentSkip to conversation

address space reservation functionality?

DISCUSSION Robert W. Fuller 2 participants 5 messages Jan 10, 2005 – Jan 11, 2005

lore
Share & tools
lore
#0 lore raw

Hi,

I was wondering if some functionality existed in Linux. Specifically, in Solaris, you can mmap the null device in order to reserve part of the address space without otherwise consuming resources. This is detailed in the Solaris manpage null(7D). The same functionality is also available under Windows NT/XP/2K by calling the VirtualAlloc function with the MEM_RESERVE flag omitting the MEM_COMMIT flag. Does Linux have a similar mechanism buried somewhere whereby I can reserve a part of the address space and not increase the "virtual size" of the process or the system's idea of the amount of memory in use? I could not find one by using the source.

Regards,

Rob

#1 lore raw
Quoted 12 lines · Robert W. Fuller

Hi,

I was wondering if some functionality existed in Linux. Specifically, in Solaris, you can mmap the null device in order to reserve part of the address space without otherwise consuming resources. This is detailed in the Solaris manpage null(7D). The same functionality is also available under Windows NT/XP/2K by calling the VirtualAlloc function with the MEM_RESERVE flag omitting the MEM_COMMIT flag. Does Linux have a similar mechanism buried somewhere whereby I can reserve a part of the address space and not increase the "virtual size" of the process or the system's idea of the amount of memory in use? I could not find one by using the source.

malloc() already does this...
what you describe is the default behavior of linux; only when you actually write to the memory does it get backed by ram.

#2 lore raw

This is not quite the same thing. This still does a check for whether or not there is enough memory and includes this in the virtual size of the process. I simply want to reserve a part of the address space so I'm guaranteed I can map something else over a contiguous portion of the address space. I don't want it to check for available memory or increase the virtual size of the process because I will be using this region sparsely. That is why Solaris and Windows have separate interfaces for this.

Quoted 10 lines · Arjan van de Ven
Quoted 3 lines · Robert W. Fuller

Hi,

I was wondering if some functionality existed in Linux. Specifically, in Solaris, you can mmap the null device in order to reserve part of the address space without otherwise consuming resources. This is detailed in the Solaris manpage null(7D). The same functionality is also available under Windows NT/XP/2K by calling the VirtualAlloc function with the MEM_RESERVE flag omitting the MEM_COMMIT flag. Does Linux have a similar mechanism buried somewhere whereby I can reserve a part of the address space and not increase the "virtual size" of the process or the system's idea of the amount of memory in use? I could not find one by using the source.

malloc() already does this...
what you describe is the default behavior of linux; only when you actually write to the memory does it get backed by ram.

#3 lore raw
In reply to Arjan van de Ven
Quoted 12 lines · Arjan van de Ven
Quoted 3 lines · Robert W. Fuller

Hi,

I was wondering if some functionality existed in Linux. Specifically, in Solaris, you can mmap the null device in order to reserve part of the address space without otherwise consuming resources. This is detailed in the Solaris manpage null(7D). The same functionality is also available under Windows NT/XP/2K by calling the VirtualAlloc function with the MEM_RESERVE flag omitting the MEM_COMMIT flag. Does Linux have a similar mechanism buried somewhere whereby I can reserve a part of the address space and not increase the "virtual size" of the process or the system's idea of the amount of memory in use? I could not find one by using the source.

malloc() already does this...
what you describe is the default behavior of linux; only when you actually write to the memory does it get backed by ram.

Sorry about the top posting. This is a resend without it.

This is not quite the same thing. This still does a check for whether or not there is enough memory and includes this in the virtual size of the process. I simply want to reserve a part of the address space so I'm guaranteed I can map something else over a contiguous portion of the address space. I don't want it to check for available memory or increase the virtual size of the process because I will be using this region sparsely. That is why Solaris and Windows have separate interfaces for this.

#4 lore raw
Quoted 7 lines
Quoted 2 lines

Sorry about the top posting. This is a resend without it.

This is not quite the same thing. This still does a check for whether or not there is enough memory

no it doesn't

Quoted 2 lines

and includes this in the virtual size of
the process.

because the virtual size is taken.... by the reservation

Quoted 6 lines

I simply want to reserve a part of the address space so
I'm guaranteed I can map something else over a contiguous portion of the address space. I don't want it to check for available memory or increase the virtual size of the process because I will be using this region sparsely. That is why Solaris and Windows have separate interfaces for this.

well you can mmap /dev/zero.. but that's about the same as malloc.