Is swap really needed when RAM's aplenty

JD jd1008 at
Fri Aug 20 20:51:31 UTC 2010

  On 08/20/2010 12:00 PM, Jussi Lehtola wrote:
> On Fri, 20 Aug 2010 13:22:33 -0500 (CDT)
> Michael Hennebry<hennebry at>  wrote:
>> It makes sense that if a process insists on physically
>> contiguous memory and can't get it, the process would die,
>> but the above code does not tell the compiler what is to be achieved.
>> In the following, would fred or greg necessarily
>> refer to physically contiguous memory?
>> #include<stdlib.h>
>> extern void hank(char *);
>> int main(*args[], int argsNum)
>> {
>> char fred[69000];
>> char *greg=malloc(96000);
>> hank(fred);
>> hank(greg);
>> return 0;
>> }
> If I remember my Kerningham-Ritchie correctly, the answer is yes, since
> C relies on pointer arithmetic to refer to the elements of the array.
> The "fred" and "greg" variables are pointers to the beginning of the
> corresponding memory area, and referring fred[i] goes to the start of
> the array at fred, and then goes i elements forward to end up with the
> wanted element.
User virtual space (say 128 Megabyte char array) would NOT
have a correspondingly contiguous Physical space of 128MB.
Each virtual page would correspond to a particular physical
page. But those corresponding physical pages are not contiguous
with each other.

More information about the users mailing list