Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Physical Memory

dbruceg
Beginner
1,188 Views

Once upon a time, before the advent of virtual memory,when one allocated memory, it was PHYSICAL memory. If he had to, say, sort a big file, he could optimize the operation for the amount of PHYSICAL memory available.

Nowadays, of course, if one allocates memory, the OS will quite happily provide it, but will reserve the right to swap it out of core whenever it has the urge to do so. If one makes a large allocation and tries to optimize a process assuming that the allocation produced PHYSICAL memory, he might well be beaten to death by page faults.

Though this problem originated a few decades ago, I've never found a simple way to defeat it. Windows appears to have a method of guaranteeing that a specific block of memory remains in core, so I suspect that Intel has devised a way to do it from FORTRAN, since this problem is universal. Am I right? Any advice? Warnings? Hints? Incantations? Prayers?

Bruce

0 Kudos
2 Replies
Steven_L_Intel1
Employee
1,188 Views
Intel doesn't need to devise a way to do it - Windows provides that mechanism through the WIn32 API. See the documentation of the Win32 API routine VirtualLock.
0 Kudos
dbruceg
Beginner
1,188 Views

Yeah, that's what I was referring to when I said "Windows appears to..." I thought VF might have a way to avoid the direct API call: something that might work on other operating systems as well.

Is there any header or trailer info in front or in back of a FORTRAN allocated array that have to be locked with it? That is, if I allocate an array with FORTRAN, then call VirtualLock with the address of the first byte in that array and its total length, is that all I need, or is there a little more to it?

Bruce

Bruce

0 Kudos
Reply