Fysiek en Virtueel geheugen in Windows 10


Hoe werkt het fysiek en virtueel geheugen in Windows 10

Een Nederlandse vertaling van het artikel van Sushovon Sinha vind je op onze OneDrive.

Als slotconclusie is deze niet onbelangrijk als je van plan bent iets anders aan te schaffen:

RAM ontwikkelde zich als buffer tussen de lage snelheid HDD en de high speed processor. RAM kan in de toekomst vervangen worden als de snelheid van de harde schijf of SSD, de snelheid van de RAM kan bereiken. Momenteel is de opslagtechnologie geavanceerd naar Solid State Drives (SSD) en SD-kaarten die aanzienlijke snelheid, robuustheid en voor mobiele apparaten ook miniaturisatie vereisen die nodig zijn . Maar deze SSD-drives kunnen de RAM niet effectief vervangen vanwege hun beperkte schrijfcyclus-duurzaamheid, die de uiteindelijke levensduur bepaalt. Ten einde de levensduur tot een minimum van 5 jaar te verbeteren heeft een SSD een ingebouwde controller die de schrijfcycli gelijkmatig verdeelt over al zijn bruikbare ruimte. Als een SSD wordt toegepast om als RAM te simuleren, zal deze strategie zal echter het leven van SSD’s niet verlengen, omdat de schrijfcycli overweldigend groot zijn in RAM. Immers objecten zoals webpagina’s, apps en data worden de hele tijd gemaakt of bewerkt. In feite moet het RAM als buffer fungeren voor alle objecten die worden opgeslagen van opslaglocaties, ofwel in web / netwerk / lokale opslag.

Er is nog een andere mogelijkheid dat RAM uiteindelijk wordt samengevoegd met de cache van de processor, wanneer de technologie voldoende geavanceerd is voor het produceren (met verdere miniaturisering) van lage energie-verbruikende geheugenchips, die haalbaar zijn om de verzadigingsgrootte in het systeemontwerp te bereiken. In het huidige systeem blijft het doel van het uitvoeren van processen nog steeds verschillend van het doel van de harde schijf, namelijk om gegevens op te slaan en opgeslagen procesbestanden naar geheugen te sturen.

De uitzondering is de page file (aanwezig op de HDD of SSD) en fungeert als een secundaire cache wanneer de geheugenbehoefte van processen hoger is dan het geïnstalleerde fysieke geheugen. Vanwege de trage responstijd van een harde schijf in relatie tot geheugensnelheid is het paginabestand nooit een echte vervanging voor RAM en wordt alleen toegepast als een noodmaatregel om geheugenruimte vrij te maken. Het vergroten van de grootte van het page file verbetert de prestaties van het systeem niet.

Met name deze beschouwing is reden om een maximale grootte van RAM toe te passen en zo mogelijk een SSD niet te gebruiken als page file. Je kan dit dus het beste aan Windows 10 overlaten.

De 4 GB geheugengrens en 2 TB opslagruimte limiet in 32-bits systemen, maakt een enorme sprong in 64-bits systemen.  De maximale capaciteit van RAM en harde schijf, die momenteel ondersteund kan worden in een high-end systeem, is vele malen groter. Zo maken 64-bits systemen alle toekomstige technologische ontwikkelingen in de komende decennia mogelijk.

How to measure VAS with FSUIPC


measuring-vas-fsuipc2.pngYou can measure the status of the VAS using FSUIPC and place the measurement on screen.

If you don’t know what VAS is, please read first this post :: How Memory is Managed by the OS.
Further you can read all about Memory issues in this category.

With FSUIPC you can measure the Available FS memory (as it is called in the FSUIPC Offset Status.pdf). With the offset code 024C with Type S32 you measure the Available Virtual Address Space in kilobytes. This value is updated every 10 seconds.

The Available VAS + the Virtual Size of the process Prepar3D.exe equals ± 4GB as being the total VAS space for each 32 bits process. With other words: the  4GB VAS space minus the virtual size of the process Prepar3D.exe equals the remaining available virtual address space. When this VAS space is consumed…you get an OOM error message.vas-maxed-out2.png

How to show Available VAS on screen.

  1. In Prepar3D open Add-ons – FSUIPC and select tab Logging.
  2. Check: IPC reads  in Log Details and FS Window (or FS Title Bar) in Display to
  3. Fill Offset = 024C and Type =32 in the Specific value checks
  4. Close with OK
  5. You can drag and resize the green FS Window bar as desired to any convenient place on the screen. Once configured in FSUIPC it will appear again at next start.

measuring-vas-fsuipc.pngYou could also place the information in the FS Title Bar for a better reading result.

The value in the Title bar is read as 2643028 x KB=2.643 MB …as we speak of 2.6 GB.vas-maxed out3.PNG

How could you reach an OOM situation on startup?


vas-maxed-out1.png

In the image above you see the development of a coming OOM:: Out of Memory situation of the virtual address space. When a value of 4096 MB  (4GB) is reached, you get this message:vas-maxed-out2.png

How could you reach an OOM situation on startup?

start-scenario.pngThere are 2 possibilities for start after you have activated prepar3d.exe. Either the previous flight starts or the Prepar3D® Training Scenario Setup screen is activated.

When scrolling through the list of airplanes, textures are loaded. The texture map pages textures out if they have not been used in 10 seconds.  

Unfortunately, the timer used to age texture has not been initialized yet when the scenario start-up screen loads.  

The textures for the aircraft you looked at, but didn’t pick, will stay loaded until roughly 10 seconds after the simulation finishes loading.  This makes it much easier to run out of memory on startup.  

If you go to the vehicle select screen, after the sim is loaded up, the textures should page out ok while in the preview screen.  You can still have issues if you scroll too fast though because of the 10 second limit.  

For the next release, Update 2.5,  textures will page out in both versions of the vehicle select screen and the textures will page our much more quickly.

Issue is soved in V2.5

Source: Prepar3D®


How to prevent?

Select_vehicle-01.pngAt startup of the sim with the Prepar3D® Training Scenario Setup screen the virtual space is used for approx. 0.8 GB.

When scrolling through the list of airplanes with its different textures, each airplane will consume an amount of VAS.

At the moment you reach the 4GB limit you get the OOM error message.

If you won’t run the risk of OOM at startup, you could reduce the number of airplanes in the folder ../Simobjects/Airplanes, so you have little to choose (little to scroll) OR you start the sim with the Previous Flight which automatically runs at startup.

If you want to change the aircraft then, just go to Vehicles select screen and select the vehicle. You could also reduce the risk when you make a list of your Favorites. (Hit the asterix on the line of your choice and check the asterix “Show Only Favorites”).

According to Prepar3D® this should be improved in the next release.

If you want to watch the development of your VAS with FSUIPC click HERE to read how you can view on screen.

Monitoring RAM and virtual memory usage


Performance Monitor is the principle tool for monitoring system performance and for identifying the location of the bottleneck. To start Performance Monitor, click Start, click Control Panel, click Administrative Tools, and then double-click Performance Monitor. Here is a summary of some important counters and what they tell you:

  • Memory, Available MBytes:
    This counter measures how much RAM is available to satisfy demands for virtual memory (either new allocations, or for restoring a page from the pagefile).
    When RAM is in short supply (for example, Committed Bytes is greater than installed RAM), the operating system will try to keep a certain fraction of installed RAM available for immediate use by copying virtual memory pages that are not in active use to the pagefile. Therefore, this counter will not reach zero and is not necessarily a good indication of whether your system is short of RAM.
  • Memory, Committed Bytes:
    This counter is a measure of the demand for virtual memory.
    This shows how many bytes were allocated by processes and to which the operating system has committed a RAM page frame or a page slot in the pagefile (or perhaps both). As Committed Bytes grows greater than the available RAM, paging will increase, and the pagefile size that is being used will also increase. At some point, paging activity starts to significantly affect performance.
  • Memory, Pages Output/Sec:
    This counter shows how many virtual memory pages were written to the pagefile to free RAM page frames for other purposes each second.
    This is the best counter to monitor if you suspect that paging is your performance bottleneck. Even if Committed Bytes is greater than the installed RAM, if Pages Output/sec is low or zero most of the time, there is no significant performance problem from insufficient RAM.
  • Memory, Pages/Sec:
    This counter is one of the most misunderstood measures.
    A high value for this counter does not necessarily imply that your performance bottleneck stems from a shortage of RAM. The operating system uses the paging system for purposes other than swapping pages because of memory over-commitment.
  • Paging File, %pagefile in use:
    This counter is a measure of how much of the pagefile is actually being used.
    Use this counter to determine whether the pagefile is an appropriate size. If this counter reaches 100, the pagefile is full, and things will stop working. Depending on the volatility of your workload, you probably want the pagefile large enough so that it is generally no more than 50-75 percent used. If much of the pagefile is being used, having more than one on different physical disks, may improve performance.
  • Process, Working Set, _Total:
    This counter is a measure of the virtual memory in “active” use.
    This counter shows how much RAM is required so that the virtual memory being used for all processes is in RAM. This value is always a multiple of 4,096, which is the page size that is used in Windows. As demand for virtual memory increases beyond the available RAM, the operating system adjusts how much of a process’s virtual memory is in its Working Set to optimize available RAM usage and minimize paging.
  •  
  • If you really want to know how memory is managed in Windows 10 you better read this stuff:
  • https://answers.microsoft.com/en-us/windows/forum/windows_10-performance/physical-and-virtual-memory-in-windows-10/e36fb5bc-9ac8-49af-951c-e7d39b979938?auth=1
  • Source: Microsoft

Address Space Monitor


Address Space Monitor is a simple utility to monitor a process’ use of its address space.  To begin monitoring a process, choose the “Process|Attach …” menu option and type in the process id of the process to be monitored. The “Attach to process” dialog box now features a process browser so that you can select the process by name.

Alternatively you can choose to spawn a new process. If you select the “Process|Run…” menu option you will be presented with the “Run” dialog box. From here you can browse for the executable file for the process you wish to start and the initial working directory for the process. You can also enter in any required command line arguments.

While monitoring a process, the display is split into three sections.

The top section shows the address space of the process in a gauge format, from low addresses (close to zero) on the left, rotating clockwise to high addresses (2GB for 32-bit processes, 8TB for 64-bit processes) on the right.

Free address space is shown in green, reserved addresses in yellow and used (committed) memory regions in red.

The next section of the display shows the largest free regions of address space as colored ellipses in descending order of size. The full width of the display represents a quarter of the total address space for the process (about 512MB for 32-bit processes, about 2TB for 64-bit processes) and large regions are shown as half an ellipse covering the full width of the display even if they exceed half the total address space.

The regions are colored according to their upper address so that they can be tracked as their lower parts are used up. Low regions start from yellow, going through magenta at half way, to cyan at the upper end of the address space.

The final section has some textual summaries for the address space.

The first number is the total amount of committed address space for the whole process,  the second number is the total amount of reserved address space for the process, the third number is the total amount of free memory and the final number is the size of the largest free address space region.

For committed and reserved regions these totals may be larger than what you might expect from looking at other memory analysis tools as all address space is counted, including mapped files and shared memory regions, rather than just regions which are mapped to physical memory or swap file space.

The utility has most use for 32-bit processes as 64-bit process tend to be dominated by a very large (only fractionally smaller that 8TB) region of free address space from the 2GB boundary upwards.

Address Space Monitor now supports recording both single snapshots of a process’ address space as well as recordings of a process’ address space over time. A snapshot can be recorded through the “File|Save as…” menu options, and redisplayed through the “File|Open…” option.

A recording can either be started through the “File|Record…” option or, when creating a new process, by selecting the “Record” check box in the “Run” dialog box and browsing for the name of a file to record. In both cases the recording will stop when the process being monitored exits. While recording the “File|Record…” menu option will display a tick icon. The recording can be halted manually by reselecting the “File|Record…” menu option while the menu option displays a tick mark.

The utility can be downloaded from HERE

Source: Charles Bailey.