Re: Is swap really needed when RAM's aplenty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 20 Aug 2010 13:22:33 -0500 (CDT)
Michael Hennebry <hennebry@xxxxxxxxxxxxxxxxxxxxx> 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.
-- 
Jussi Lehtola
Fedora Project Contributor
jussilehtola@xxxxxxxxxxxxxxxxx
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux