1

I am using NSM to exchange data between separate processes, and it's all working fine and dandy, however the memory space is declared in the page file, which I think is a default way of doing it.

   hMapFile = CreateFileMapping(
             INVALID_HANDLE_VALUE,    // use paging file
             NULL,                    // default security
             PAGE_READWRITE,          // read/write access
             0,                       // maximum object size (high-order DWORD)
             BUF_SIZE,                // maximum object size (low-order DWORD)
             szName);                 // name of mapping object

My question is, is the file declared on the disk, then the actual contents are put into the RAM, and accessed from there? I have been doing experiments on my home computer, which is an i5 4 core, 16 GB 1800 MHz RAM and SSD, and the same experiments on a laboratory's i9 12 core, 32 GB 2800 MHz RAM with an HDD.

The "better" computer is slower by many times (same experiment parameters), but I was told it doesn't have anything to do with SSD or HDD. The experimental algorithm uses NSM heavily for data exchange, so if it has to access a file on the disk, I can see why it is slower, but if it is all RAM... then?

  • So you are asking why some code runs slower on one machine without supplying any details on what this code is doing, huh? It is not even clear why would you blame NSM all of it sudden. If you suspect HDD then you can either disable page file or pin mapped pages to RAM by calling `VirtualLock`. – user7860670 Jun 15 '18 at 06:53
  • @VTT I just want to find out what NSM is really doing. If it is using the RAM or constant reading/writing to the disk .. theoretically – Mads Midtlyng Jun 15 '18 at 08:08
  • are you checking that paging setup is the same on both machines ? are you doing benchmarking trying to isolate the code that really delay the process ? – ROCFER Jun 15 '18 at 08:37
  • @Rochi Yes, I want to find out what is causing the major difference in performance. The paging file is 8GB on both machines. The faster i5 run is on Win 7, but the other is on Win 10. I don't know if the really deep areas of this are affecting the performance. – Mads Midtlyng Jun 16 '18 at 04:54
  • @Rochi Basically, the i9 should outperform the i5 in every way. The only hardware which is a drawback is the HDD on the i9 while the i5 uses a samsung ssd. The program settings and experiment parameters are identical. – Mads Midtlyng Jun 16 '18 at 06:06
  • What about disk fragmentation??? – ROCFER Jun 16 '18 at 12:48

1 Answers1

1

The answer is "it depends". Windows will not use the disk when there is enough RAM and the memory is in active use. We don't know of course how much your program needs for the shared memory or other purposes.

MSalters
  • 173,980
  • 10
  • 155
  • 350