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 STACK

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.

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

Vsync and Screen Tearing


A typical video tearing artifact (simulated image)
A typical video tearing artifact (simulated image)

Screen tearing is a visual artifact in video where information from two or more different frames is shown in a display device in a single screen draw. The artifact occurs when the video feed sent to the device isn’t in sync with the display’s refresh, be it due to non-matching refresh rates, or simply lack of sync between the two. During video motion, screen tearing creates a torn look as edges of objects (such as a wall or a tree) fail to line up. Tearing can occur with most common display technologies and video cards, and is most noticeable on situations where horizontally moving visuals are commonly found, such as in slow camera pans in a movie, or classic side-scrolling video games. The ways to prevent video tearing are dependent on the technology of the display device and video card, the software in use, and the nature of the material being shown. The most common solution is to use multiple buffering. Most systems will use this function along with one or both of these two methods:

V-sync

Vertical synchronization is an option found in most systems, wherein the video card is prevented from doing anything visible to the display memory until after the monitor has finished its current refresh cycle. During the vertical blanking interval, the driver would order the video card to either rapidly copy the off-screen graphics area into the active display area (double buffering), or treat both memory areas as display-able, and simply switch back and forth between them (page flipping).

Complications

When vertical synchronization is in use, the frame rate of the rendering engine will exactly equal the monitor’s refresh rate, if it was higher. Although this feature normally results in improved video quality, it is not without trade-offs in some cases.

Judder

Vertical synchronization can also lead to artifacts in video and movie presentations, as they are generally recorded at frame rates significantly lower than the typical monitor frame rates (24–30 frame/s). When such a movie is played on a monitor set for a typical 60 Hz refresh rate, the video player will miss the monitor’s deadline fairly frequently, in addition to the interceding frames being displayed at a slightly higher rate than they were intended for, resulting in an effect similar to judder – see Telecine: Frame rate differences.

Input lag

Video games, which have a wide variety of rendering engines, tend to benefit well visually from vertical synchronization, as a rendering engine is normally expected to build each frame in real time, based on whatever the engine’s variables specify at the moment a frame is requested. However, because vertical synchronization causes input lag, it interferes with the interactive nature of games, and particularly interferes with games which require precise timing or fast reaction times.

Benchmarking

Lastly, when one wishes to benchmark a video card or rendering engine, it is generally implied that the hardware and software render the display as fast as possible, without regard to monitor’s capabilities or the resultant video tearing. Otherwise, the monitor and video card will throttle the benchmarking program, causing it to generate invalid results.

Many games have internal limits that prevent them rendering faster than a certain frame rate. In some cases this can mean they are locked at a maximum frame rate of only 20 fps. The maximum frame rate you can obtain is equal to the refresh rate of your display.

When you have Vsync enabled: Vsync is used to synchronize the output of your graphics card with the display of your monitor. When your graphics card has finished rendering the next frame it waits for the monitor to finish displaying the current one before switching to the new one. This means that the maximum frame rate you can obtain will be equal to the refresh rate of your monitor (which is usually 60 Hz, 75 Hz, 85 Hz, or  100 Hz).

If you disable Vsync, then your graphics card will continuously render without waiting for the last frame to be displayed in its entirety. With fast graphics cards this means that your monitor may switch to a new frame halfway down the screen. This effect is known as tearing as there appears to be a visible line separating two different halves. Due to this, you should generally leave Vsync enabled except when benchmarking.

Resources used: wikipedia