100 physical memory errors. Device Manager error codes. Virtual memory in Windows

In my last article "" I talked about the capabilities of the Windows 7 Resource Monitor (Resource Monitor), explained how to use it to monitor the distribution of system resources between processes and services, and also mentioned that it can be used to solve specific problems - for example, to analyze memory consumption. This is exactly what this article will discuss.

A little about memory

Before starting the analysis, I’ll briefly talk about how memory is controlled. This will make it easier for you to understand what information is presented in the Windows 7 Resource Monitor.

Windows 7 Memory Manager creates a virtual memory system that consists of available physical RAM and a page file on the hard drive. This allows the operating system to allocate fixed-length memory blocks (pages) with sequential addresses in physical and virtual memory.

Launching Windows 7 Resource Monitor

To launch Windows 7 Resource Monitor, open the Start menu, type "Resmon.exe" in the search bar and click . In the window that opens, select the “Memory” tab (Fig. A).

Figure A: The Memory tab in Windows 7 Resource Monitor provides detailed memory allocation information.

Processes table

The Memory tab has a Processes table (Figure B) that lists all running processes and breaks memory usage into several categories.


Figure B: Memory usage information for each process is broken down into several categories.

Column "Image"

In the “Image” column the name is indicated executable file process. Processes, launched by applications, it is very easy to find out - for example, the process “notepad.exe” clearly belongs to Notepad. Processes named "svchost.exe" represent various services operating system. The service name appears in parentheses next to the process name.

Process ID column

The Process ID (PID) column indicates the process number - a unique combination of numbers that allows you to identify the running process.

"Completed" column

The Commit column indicates the amount of virtual memory, in kilobytes, that the system has reserved for this process. This includes both the physical memory used and the pages stored in the paging file.

Column "Working set"

The “Working Set” column indicates the volume physical memory in kilobytes used by the process in this moment time. The working set consists of public and private memory.

Column "General"

The Shareable column indicates the amount of physical memory in kilobytes that this process shares with others. Sharing a single memory segment or swap page for related processes can save memory space. This physically stores only one copy of the page, which is then mapped to the virtual address space of other processes that access it. For example, all processes initiated by system DLLs - Ntdll, Kernel32, Gdi32 and User32 - use shared memory.

Column "Private"

The Private column indicates the amount of physical memory, in kilobytes, used exclusively by this process. It is this value that allows you to determine how much memory a particular application needs to operate.

Column “Errors of page missing from memory/sec.”

In the column “Errors of page out of memory/sec.” (Hard Faults/sec) shows the average number of page out of memory errors per second over the last minute. If a process tries to use more physical memory than is currently available, the system writes some of the data from memory to disk - to the page file. Subsequent access to data saved to disk is called a page out of memory error.

What do page out of memory errors mean?

Now that you have an idea of ​​what information is collected in the Processes table, let's see how you can use it to monitor memory allocation. When running applications and working with files, the memory manager monitors the working set size of each process and records requests for additional memory resources. As a process's working set increases, the dispatcher matches these requests to the needs of the kernel and other processes. If the available address space is insufficient, the dispatcher reduces the working set size by storing data from memory to disk.

Later, when reading this data from disk, a page out of memory error occurs. This is quite normal, but if errors occur simultaneously for different processes, the system requires additional time to read data from the disk. Too much common mistakes Page absences in memory, accordingly, reduce system performance. You've probably experienced unexpected slowdowns in all applications, which then also suddenly stopped. This slowdown was almost certainly due to active data redistribution between physical memory and swap.

The conclusion follows: if page out of memory errors for a particular process occur too often and regularly, the computer does not have enough physical memory.

To make it more convenient to monitor processes that cause frequent page out of memory errors, you can mark them with flags. In this case, the selected processes will move to the top of the list, and in the graph of page missing errors they will be represented by an orange curve.

It's worth keeping in mind that memory allocation depends on a number of other factors, and monitoring page-out-of-memory errors is not the best or only way to identify problems. However, it can serve as a good starting point for observation.

Table "Physical memory"

The Processes table provides detailed information about the memory allocation between individual processes, and the Physical Memory table gives an overall picture of RAM usage. Its key component is the unique histogram shown in Fig. C.


Figure C. The histogram in the Physical Memory table allows you to plot general idea about memory allocation in Windows 7.

Each section of the histogram is indicated by its own color and represents certain group memory pages. As the system is used, the memory manager in background moves data between these groups, maintaining a delicate balance between physical and virtual memory to ensure all applications run efficiently. Let's take a closer look at the histogram.

Section “Reserved equipment”

On the left is the “Hardware Reserved” section, indicated in gray: this is the memory allocated for the needs of the connected hardware, which it uses to interact with the operating system. Memory reserved for hardware is locked and cannot be accessed by the memory manager.

Typically, the amount of memory allocated to the equipment ranges from 10 to 70 MB, but this figure depends on the specific system configuration and in some cases can reach several hundred megabytes. Components that affect the amount of reserved memory include:

;
Components motherboard- for example, advanced programmable input/output interrupt controller (APIC);
sound cards and other devices that perform memory-mapped input/output;
PCI bus Express (PCIe);
video cards;
various chipsets;
flash drives.

Some users complain that their systems reserve an abnormal amount of memory for their hardware. I have never encountered such a situation and therefore I cannot vouch for the effectiveness of the proposed solution, but many note that updating the BIOS version can solve the problem.

“In Use” section

The In Use section, shown in green, represents the amount of memory used by the system, drivers, and running processes. The amount of memory used is calculated as the “Total” value minus the sum of the “Modified”, “Standby” and “Free” indicators. In turn, the “Total” value is the “Installed RAM” indicator minus the “Reserved Equipment” indicator.

Section "Changed"

The “Modified” section is highlighted in orange, which represents memory that has been modified but not used. In fact, it is not used, but can be used at any time if needed again. If memory has not been used for a long time, the data is transferred to the page file and the memory goes into the "Waiting" category.

Section "Waiting"

The Pending section, shown in blue, represents memory pages that have been removed from working sets but are still associated with them. In other words, the "Waiting" category is actually a cache. Memory pages in this category are assigned a priority from 0 to 7 (maximum). Pages associated with high-priority processes are given maximum priority. For example, shared processes have high priority, so the pages associated with them are given the highest priority in the Pending category.

If a process requires data from a waiting page, the memory manager immediately returns that page to the working set. However, all pages in the Pending category are available for recording data from other processes. When a process requires additional memory and there is not enough free memory, the memory manager selects the waiting page with the lowest priority, initializes it, and allocates it to the requesting process.

Section "Free"

The Free category, indicated in blue, represents pages of memory that have not yet been allocated to any process or have been freed when a process terminates. This section shows both unused and freed memory, but in fact, unused memory belongs to another category - “Zero Pages”, which is so called because these pages are initialized to zero and ready for use.

About the problem of free memory

Now that you have a basic understanding of how the memory manager works, let's take a moment to address a common misconception about the memory management system in Windows 7. As you can see from Figure 1. C, The free memory section is one of the smallest in the histogram. However, it is a mistake to assume on this basis that Windows 7 consumes too much memory and that the system cannot work properly if there is so little free memory.

In fact, it's quite the opposite. In the context of Windows 7's approach to memory management, free memory is useless. The more memory used, the better. By maximizing memory and constantly moving pages from one category to another using a priority system, Windows 7 improves efficiency and prevents data from ending up in the page file, preventing out-of-page errors from slowing down performance.

Memory monitoring

Want to see Windows 7's memory management system in action? Restart your computer and immediately after startup, open the Windows 7 Resource Monitor. Go to the Memory tab and pay attention to the ratio of sections in the physical memory histogram.

Then start launching applications. As you run, watch the histogram change. Once you've launched as many applications as possible, start closing them one at a time and watch how the ratio of sections in the physical memory histogram changes.

By doing this extreme experiment, you'll understand how Windows 7 manages memory on your particular computer, and you'll be able to use Windows 7 Resource Monitor to monitor memory allocation under normal day-to-day operating conditions.

What do you think?

Do you like the idea of ​​using Windows 7 Resource Monitor to monitor memory allocation? Share your opinion in the comments!

Preemptive/non-preemptive algorithms.

In the case of a preemptive algorithm, the operating system can interrupt the execution of the current thread at any time and switch the processor to another thread. In non-preemptive algorithms, the thread that is given the processor only decides when to transfer control to the operating system.

Algorithms with quantization.

Each thread is given a time slice during which the thread can execute on the processor. When the quantum expires, the operating system switches the processor to the next thread in the queue. Quantum is usually equal to an integer number of system timer intervals 1.

Algorithms with priorities.

Each thread is assigned a priority - an integer indicating the degree of privilege of the thread. The operating system, if there are several threads ready to run, selects the thread with the highest priority.

Windows implements a mixed scheduling algorithm - preemptive, based on quantization and priorities.

  1. Multitasking type for DOS application
  2. Service guarantees
  3. Scheduling foreground processes
  4. Purpose of the paging file
  5. Processes P1, P2, P3 allocate 100, 20, 80 MB of memory. The system has 128MB of RAM. What is the size used memory in the swap file. What is the size of the swap file.
  1. What is a "page fault"?

Interrupt 14 -Page fault (#PF): Intel386…

Generated if the page engine is activated (CR0.PG = 1) and one of the following situations occurs when translating a linear address to a physical one:

  • element of the page table or page directory used in address translation, has zero presence bit, i.e. the required page table or page is not present in physical memory;
  • the procedure does not have privilege level, sufficient to access the selected page, or attempts to write to a page that is write-protected for the current privilege level.

The page fault handler obtains information about its cause from two sources: the error code, which is pushed onto the stack, and the contents of the CR2 register, which contains the linear address that caused the error. The page fault code has a special format (Fig. 3.7.).

An interrupted program, after eliminating the reasons that caused the page fault (for example, loading a page into physical memory), can be continued without any additional adjustments.

If a page fault was caused due to a violation of page security privileges, the access bit (A) in the corresponding page directory entry is set. The behavior of the access bit in the corresponding element of the page tables for this case is not regulated in Intel processors and may be different in different models.

  1. A high page error rate indicates:

Program insecurities

Insecurities random access memory

Other: explain

Column “Errors of page missing from memory/sec.”

In the column “Errors of page out of memory/sec.” (Hard Faults/sec) shows the average number of page out of memory errors per second over the last minute. If a process tries to use more physical memory than is currently available, the system writes some of the data from memory to disk - to the page file. Subsequent access to data saved to disk is called a page out of memory error.

What do page out of memory errors mean?

Now that you have an idea of ​​what information is collected in the Processes table, let's see how you can use it to monitor memory allocation. When running applications and working with files, the memory manager monitors the working set size of each process and records requests for additional memory resources. As a process's working set increases, the dispatcher matches these requests to the needs of the kernel and other processes. If the available address space is insufficient, the dispatcher reduces the working set size by storing data from memory to disk.

Later, when reading this data from disk, a page out of memory error occurs. This is quite normal, but if errors occur simultaneously for different processes, the system requires additional time to read data from the disk. Too frequent page out of memory errors, respectively, reduce system performance. You've probably experienced unexpected slowdowns in all applications, which then also suddenly stopped. This slowdown was almost certainly due to active data redistribution between physical memory and swap.

The conclusion follows: if page out of memory errors for a particular process occur too often and regularly, The computer does not have enough physical memory.

To make it more convenient to monitor processes that cause frequent page out of memory errors, you can mark them with flags. In this case, the selected processes will move to the top of the list, and in the graph of page missing errors they will be represented by an orange curve.

It's worth keeping in mind that memory allocation depends on a number of other factors, and monitoring page-out-of-memory errors is not the best or only way to identify problems. However, it can serve as a good starting point for observation.

  1. How is thread priority determined in Windows?

Priorities

The Windows OS implements preemptive priority scheduling, when each thread is assigned a certain numerical value - a priority, in accordance with which the processor is allocated to it. Threads with the same priorities are scheduled according to the Round Robin algorithm (carousel). An important advantage of the system is the ability to preempt threads running in kernel mode - the executive system code is completely reentrant. Only threads holding a spinlock are not preempted (see "Synchronizing Threads"). Therefore, spinlocks are used with great care and are set for a minimum time.

The system provides 32 priority levels. Sixteen priority values ​​(16-31) correspond to the real-time priority group, fifteen values ​​(1-15) are for normal threads, and a value of 0 is reserved for the system page zeroing thread (see Figure 6.2).

Rice. 6.2. Thread Priorities

To relieve the user of the need to remember numerical values ​​of priorities and be able to modify the scheduler, the developers introduced into the system priority abstraction layer. For example, the priority class for all threads of a particular process can be set using a set of constant parameters of the SetPriorityClass function, which can have the following values:

  • real time (REALTIME_PRIORITY_CLASS) - 24
  • high (HIGH_PRIORITY_CLASS) - 13
  • above normal (ABOVE_NORMAL_PRIORITY_CLASS) 10
  • normal (NORMAL_PRIORITY_CLASS) - 8
  • below normal (BELOW_NORMAL_PRIORITY_CLASS) - 6
  • and idle (IDLE_PRIORITY_CLASS) 4

The relative priority of a thread is set by similar parameters of the SetThreadPriority function:

A set of six process priority classes and seven thread priority classes forms 42 possible combinations and allows us to form the so-called basic thread priority

The default base priority of a process and primary thread is the value in the middle of the process priority ranges ( 24, 13, 10, 8, 6 or 4). Changing the priority of a process entails changing the priorities of all its threads, while their relative priorities remain unchanged.

Priorities 16 through 31 are not really real-time priorities because Windows' soft real-time support makes no guarantees about thread timing. These are simply higher priorities that are reserved for system threads and those threads that are given such priority by a user with administrative rights. However, the presence of real-time priorities, as well as preemptibility of kernel code, localization of memory pages (see "Operation of the memory manager") and a number of additional features- all this allows you to run soft real-time applications, for example, multimedia, in the Windows environment. The system thread with zero priority is busy clearing memory pages. Regular user threads can have priorities from 1 to 15.


Related information.


Many computing systems include one or another version of a memory manager (another name is a memory management unit - MMU), with the help of which a multitasking operating system allocates memory to each task and provides protection from user programs. For example, a typical problem occurs when an application program makes an error when calculating an address, perhaps using an index value that is too large or too small. If the system is not protected, this kind of error can lead to changes in the codes included in the operating system programs or modification of device tables and even cause an unplanned startup of the device with fatal consequences, such as unauthorized writes to the data file.

In addition to protecting the operating system from unintentional destruction, the memory manager provides automatic program relocation. With the help of a memory manager, logical or software addresses of user programs are converted into physical or hardware addresses. These addresses may be located in memory completely different from where the logical addresses point. Address translation causes the operating system and protected I/O devices to be completely removed from the user's address space. Any attempt to read or write memory outside the address space allocated to the user causes the processor to crash the user program.

Information is usually transmitted in chunks consisting of a fixed number of bits; The 80386 MP uses 32-bit chunks unless it is instructed to reduce the chunk size to 16-bits. These portions are named after words. The process of writing a word into a memory system is called recording in memory the process of retrieving a word from memory - reading from memory.

There are two methods of accessing memory: random and sequential. Sequential access is used in those storage systems where words are accessed in some predetermined order. Random access, on the other hand, involves the ability to access the words of a storage system in any order and in approximately the same time.

No matter how perfect the memory is, when a signal passes between devices, delays arise in its propagation. Propagation delay is defined as the time required for a logical signal to travel through a device or sequence of devices forming a logical chain. This delay also takes into account the passage of the signal along all connecting lines between the chips.

Direct Memory Access (DAM)

Direct Memory Access allows external devices and memory to directly exchange data without program intervention. DDP provides maximum I/O speed and maximum process parallelism. While interrupt-driven I/O and software-controlled I/O transfer data through the processor, DMA transfers data directly between the I/O device and memory.

To minimize the number of data buses, special measures are taken to allow the use of a conventional backbone for the DMA. These measures consist in the fact that the processor releases the highway, and the external device captures it and uses it to transmit data.

During the DAP, program execution is usually suspended. The trunk is released as soon as the DMA request control line is excited. The processor terminates the current operation, frees the address and data lines, and asserts a signal on one of the control lines to prevent unintentional decoding of undefined control signals.

The I/O interface transfers data directly to memory using a special register. When there is a need to transfer data, the interface requests a memory cycle from the processor. Once acknowledged, the interface transfers the data directly to memory while the processor pauses for one memory cycle. The logic that performs this transfer is called channel.

The channel contains a register to store the address of the memory cell to or from which data is being transferred. In most cases, the channel also includes a word counter to count the number of direct transfers performed. In addition, the channel must contain circuitry that ensures the exchange of control signals, synchronization and other auxiliary operations. In Fig. Figure 13.4 shows the logical connections between the CPU and the DMA controller.

RAP components. The main components of a DMA are a request trigger, an address register, a counter, and a data register, which is used by the peripheral device. Sending data over a DMA channel involves several stages: 1) initializing the DMA logic to perform DMA during repeated cycles of bus seizing; 2) activation of the PDP asynchronous with respect to program operations; 3) notification of the end of transfers (by a signal from the meter or as a result of a change in the state of the device); 4) calling the “cleaning” program at the end of transfers; 5) completion of the DDP using an interrupt service program, which returns control to the main program.

Block data forwarding. The DDP procedure for high-speed devices uses block transfer of data. While executing the current program, the processor initiates the transfer of a block of data and determines the number of words that make up the block. However, the actual transmission of words is performed under the control of a separate device - the DMA controller. Maximum speed block transmission over the DMA channel is limited only by the duration of the memory cycle (reading or writing) and the operating speed of the DMA controller.

DDP with memory cycle occupation. The program initiates block transfer by placing the start address in the address counter and the number of words in the word counter. and issuing the run command. This type of DDP is often called a DDP with occupying the memory cycle, because it pauses program execution for approximately one machine cycle each time.

When using memory cycle-occupied DMA, data transfer occurs in parallel with other processes running on the CPU. The sequence of actions here is the same as for block transfer, with the exception that the DMA controller takes up memory cycles from the processor and, therefore, slows down its operation (block data transfer over the DMA channel also takes memory cycles, unless DMA is used on a separate bus).

Memory allocation in Windows 9x and Windows NT. Windows 7 Resource Monitor. Explore memory-related items and tabs. Using Windows 7 Resource Monitor to monitor memory allocation. Increasing the size of the paging file (virtual memory). Checking memory using Windows.

3.1. Memory allocation in Windows 9x

Windows 9x OS is a 32-bit multi-threaded OS with preemptive multitasking and a graphical user interface. To boot, they use MS-DOS 7.0, which provides two modes of processor operation - real (BootGUI=0 is written in the MSDOS.SYS file) and protected (BootGUI=1). Protected mode is installed immediately before Windows 9x boots, as a result of which the processor begins to manage memory using a paging mechanism for converting virtual addresses to physical ones. The virtual address space area consists of 4 kilobyte pages that are located in RAM or on disk.

Low-order addresses of the virtual address space are used jointly by all processes to ensure compatibility with real-time device drivers, resident Windows programs, etc. This, on the one hand, is convenient, but, on the other hand, reduces reliability (one of the main qualities of the OS), because any process can corrupt components located at these addresses.

Each 32-bit Windows application program runs in its own address space, but access to the necessary addresses is possible, i.e. the organization of virtual addresses does not use all the hardware protection built into the microprocessor. 16-bit programs share a common address space and are also vulnerable to each other. The Windows 9x memory model is shown in Fig. 3.1.

Rice. 3.1. OP distributions in Windows 9x

The lower 64 KB of OP are not accessible to 32-bit programs, but 16-bit programs can write their data here. Addresses below 4 MB are mapped into the address space of each application program and are shared by all processes. This makes this area vulnerable to accidental writing.

The minimum required amount of memory for Windows 9x to function is 4 MB, but it is practically impossible to work with this amount of memory. Page file , with the help of which the virtual memory mechanism is implemented, is located in the Windows directory and has a variable size, changed if necessary by the system itself. Its dimensions can be set using system tools (Control Panel → System → Performance → File system), or specified in the SYSTEM.INI section of the file - lines indicating the drive and file name:

Pagingfive=c:\PageFile.sys

MinPagingFileSize=65536 (64 MB)

MaxPagingFileSize=262144 (256 MB)

The first and second lines define the file name and its location, and the last two – the initial and maximum size of the page file in KB.

The minimum paging file size can be obtained by running the SysMon program ( system monitor) and, having selected the size of the paging file and the amount of free memory as the necessary parameters, estimate the memory requirements of the most frequently used applications.

3.2. Memory allocation in Windows NT

The differences between the distribution scheme and Windows 9x come down to the following:

1) more serious use of hardware memory protection provided in the microprocessor;

2) all system software modules are located in their own virtual address spaces and application programs cannot access them.

The distribution of address space in Windows NT is shown in Fig. 3.2.

Rice. 3.2. OP distributions in Windows NT

Application programs are allocated 2 GB of local (own) linear (unstructured) address space (the first 64 KB are not available). They are isolated from each other and can communicate with each other only through the clipboard, or through the DDE (Dynamic Data Exchange) and OLE (Object Linking and Embedding) mechanisms.

The upper part of the 2 GB area contains the code for system DLLs (dynamically linked libraries) that act as server processes. They check the values ​​of query parameters, execute the requested function, and send the results back to the calling program's address space.

In the address range of 2-4 GB there are system (low-level) components of Windows (i.e., the highest level of protection against unauthorized access: kernel, thread scheduler, memory manager).

For 16-bit Windows applications, WOW (Windows On Windows) sessions are implemented in preemptive multitasking mode, individually in their own address spaces or together in a shared address space.

When an application is launched, a process is created with its own information structure, within which the task is launched. It can run other tasks. As a result, a multitasking mode of operation is organized.

Memory management (allocation, reservation, release, paging) is performed by the VMM virtual memory manager (Virtual Memory Manager). Each virtual page is transferred to a physical page - a page frame filled in original condition zeros (this is the main requirement of the C2 level security system standard, which determines the impossibility of using their previous contents by other processes). Space for page swapping is reserved in the page file Pagefile.sys, which is a reserved block of disk space.

All Windows memory NT is subdivided into reserved(for dynamic use by processes when executing tasks), dedicated(for which uploading is reserved in Pagefile.sys) and accessible(the rest of the free memory).

      Virtual memory in Windows

The most common reason for system slowdown is Windows control- filling physical memory. At the same time, Windows begins the so-called “paging” - moving blocks of code and program data (each such block is called a page) from physical memory to the hard drive. Accessing the page file from time to time is normal and does not degrade system performance, but frequent requests for data from a file on disk can significantly reduce overall system speed. This problem is especially noticeable when switching between multiple memory-intensive programs on a computer that does not contain enough physical memory. As a result, the disk is almost constantly in use, because the system tries to “pump” data from it to memory and back.

If the total size of allocated memory exceeds the total amount of physical memory, Windows must "pump" pages between the fast RAM and the much slower virtual memory in the page file, causing the system to slow down.

In progress Windows installations XP page file is automatically created in the root folder on the same disk where the system files are located Windows files. The paging file size is determined based on the amount of physical memory on the system. By default, the minimum page file size is 1.5 times the amount of physical memory, and the maximum size is 3 times the size. The swap file can be seen in the Explorer window if you enable the mode for displaying hidden and system files (Fig. 3.3).

Rice. 3.3. Enabling the display of hidden and system files

Typically, the Windows operating system itself sets the optimal amount of virtual memory and it is enough for most tasks, but if the computer runs applications that require a lot of memory, then the amount of virtual memory can be changed.

To do this, you need to perform the following sequence of actions:

1. Log in to the system using an account from the Administrators group and open the “Control Panel – System” window.

2. On the “Advanced” tab, click the “Options” button in the “Performance” section (Fig. 3.4).

3. In the Performance Options dialog box, select the Advanced tab and click the Change button (Figure 3.5) to display the Virtual Memory dialog box, which is shown in Figure 3.5. 3.6 for Windows XP and in Fig. 3.7 for Windows 7.

The current paging file settings are reflected in the “Total paging file size across all drives” field.

4. Select any drive from the list at the top of the dialog box to configure the settings for that drive.

You can change the following settings:

- Special size. Enter the value in the field Original size to set the initial size of the pagefile.sys file on the specified disk (in megabytes). In field Maximum size enter a number not less than the value in the field Original size, but not exceeding 4096 MB (4 GB).

- Size according to system choice. Select this option to enable dynamic management of the paging file size for of this disk. Select this option if you do not want to change the default settings Windows offers.

- No swap file. Use for all drives where you don't need a page file. Make sure there is a swap file on at least one drive.

5. After making any changes, click Set to record changes.

6. Repeat steps 4 and 5 for other drives (if necessary). Click OK to close the dialog box when you're done.

Rice. 3.4. “Options” button to go to view and/or

changing virtual memory parameters

Rice. 3.5. “Change” button to go to change virtual memory settings in Windows XP (left) and in Windows 7

Rice. 3.6. Window for viewing and setting the virtual memory size

Rice. 3.7. Window for viewing and setting the virtual memory size in Windows 7

If your computer has multiple physical disks, it is best to place the page file on the fastest, and it is preferable if system files Windows will be on a different drive. It's even better to split the page file into several physical disks because the disk controller can process multiple write and read requests in parallel.

Do not try to place the paging file on several logical drives of one physical drive!!!

If the system has one hard drive divided into partitions C, D and E, and the page file is distributed over several partitions, then the system may even slow down, since in this configuration the magnetic heads of the hard drive have to read data from several areas, rather than from one to another. one area of ​​the disk.

If you reduce the minimum or maximum paging file size and create a new paging file on disk, you must reboot the system for the changes to take effect. Increasing the size of the page file usually does not require restarting the computer.

If you have a lot of physical memory, you may be tempted to disable the page file altogether. Do not do that! !!

Windows XP was designed to use the page file to perform some kernel tasks, so some third-party programs may report low memory when attempting to disable virtual memory completely.

Windows doesn't use the pagefile until it's needed, so disabling virtual memory won't improve performance!!!

Windows can dynamically increase the page file size as needed. This function only works when you select " System selectable size", as well as when setting a maximum size greater than the current size of the paging file.

Based on experience with previous versions of Windows, some users try to create a fixed size paging file with equal initial and maximum sizes. In theory, this should improve performance because it eliminates the possibility of page file fragmentation. However, the paging subsystem is designed so that in practice the file only occupies large blocks of disk space, making fragmentation minimal. You may notice a slight performance hit when Windows increases the size of the page file, but this is a one-time operation and has no impact on average performance.

      Monitoring Memory Usage in Windows

The easiest way to find out how much RAM is being used at a given time is to open the Task Manager by clicking ++ and go to the “Performance” tab (Fig. 3.8). A detailed description of the information in the “Performance” tab for Windows XP is presented in table. 3.1.

Table 3.1. Decrypting Task Manager data

The “Performance” tab for Windows7 has significant innovations compared to the corresponding Manager tab Windows tasks XP.

The number in the “Total” column of the “Physical Memory” section indicates the total amount of RAM for this system. The Cached column shows the amount of physical memory that was recently used by system resources. It remains in the cache in case the system needs it again, but is available to other processes. The new “Available” column indicates the amount of currently unused physical memory, and the “Free” column indicates the amount of memory that is used by the cache but does not contain useful information.

The “Kernel Memory” section contains two columns - “Paged” and “Nonpaged”. Together they indicate how much memory the kernel is using. Paged is virtual memory, and non-paged is physical memory.

In the “System” section, columns for “Handles” and “Threads” appeared, associated with the constituent components of processes. The “Descriptors” column indicates the number of object identifiers (descriptors) that are used by currently running processes. The Threads column shows the number of subprocesses running within larger processes. The number in the “Processes” column, of course, indicates the total number of running processes, which can be seen on the “Processes” tab.

The “Up Time” column indicates how much time has passed since the last time the computer was started. The “Commit” column contains information about the paging file. The first number indicates the total amount of physical and virtual memory currently in use, and the second number indicates the total amount of memory for a given computer in principle.

Even more detailed information can be obtained by clicking the “Resource Monitor” button and selecting the “Memory” tab (Fig. 3.9).

Rice. 3.9. Memory tab of the Windows 7 Resource Monitor window

On the “Memory” tab there is a “Processes” table, which lists all running processes, and information about the memory used for each process is divided into several categories (Fig. 3.10).

Rice. 3.10. Processes table

In a collumn " Image" indicates the name of the process executable file. The processes running by applications are very easy to recognize - for example, the process “Winword.exe” clearly belongs to the Word text editor. Processes named "svchost.exe" represent various operating system services. The service name appears in parentheses next to the process name.

In a collumn " Process ID» indicates the process number - a unique combination of numbers that allows you to identify the running process.

In the column " Completed" indicates the amount of virtual memory in kilobytes reserved by the system for this process. This includes both the physical memory used and the pages stored in the paging file.

In the column " Working set" indicates the amount of physical memory in kilobytes used by the process at a given time. The working set consists of public and private memory.

In a collumn " General" indicates the amount of physical memory in kilobytes that this process shares with others. Sharing a single memory segment or swap page for related processes can save memory space. This physically stores only one copy of the page, which is then mapped to the virtual address space of other processes that access it. For example, all processes initiated by system DLLs - Ntdll, Kernel32, Gdi32 and User32 - use shared memory.

In the column " Private" indicates the amount of physical memory in kilobytes used exclusively by this process. It is this value that allows you to determine how much memory a particular application needs to operate.

In the column " Page out of memory errors/sec."The average number of page out of memory errors per second over the last minute is indicated. If a process tries to use more physical memory than is currently available, the system writes some of the data from memory to disk - to the page file. Subsequent access to data saved to disk is called a page out of memory error.

When running applications and working with files, the memory manager monitors the working set size of each process and records requests for additional memory resources. As a process's working set increases, the dispatcher matches these requests to the needs of the kernel and other processes. If the available address space is insufficient, the dispatcher reduces the working set size by storing data from memory to disk.

Later, when reading this data from disk, a page out of memory error occurs. This is quite normal, but if errors occur simultaneously for different processes, the system requires additional time to read data from the disk. Too frequent page-out-of-memory errors consequently reduce system performance. This manifests itself in unexpected slowdowns in all applications, which then also unexpectedly stop. The slowdown is due to active redistribution of data between physical memory and swap.

The conclusion follows: if page out of memory errors for a particular process occur too often and regularly, the computer does not have enough physical memory.

To make it more convenient to monitor processes that cause frequent page out of memory errors, you can mark them with flags. In this case, the selected processes will move to the top of the list, and in the graph of page missing errors they will be represented by an orange curve.

It's worth keeping in mind that memory allocation depends on a number of other factors, and monitoring page-out-of-memory errors is not the best or only way to identify problems. However, it can serve as a good starting point for observation.

The Processes table provides detailed information about the memory allocation between individual processes, and the Physical Memory table gives an overall picture of RAM usage. Its key component is the unique histogram shown in Fig. 3.11.


Figure 3.11. The histogram in the "Physical Memory" table allows you to get an overview of memory distribution in Windows 7

Each section of the histogram is indicated by its own color and represents a specific group of memory pages. As the system is used, the memory manager moves data between these groups in the background, maintaining a delicate balance between physical and virtual memory to ensure all applications run efficiently. Let's take a closer look at the histogram.

On the left is the section “ Reserved equipment", indicated in gray: this is the memory allocated to the needs of the connected equipment, which it uses to interact with the operating system. Memory reserved for hardware is locked and cannot be accessed by the memory manager. Typically, the amount of memory allocated to the equipment ranges from 10 to 70 MB, but this figure depends on the specific system configuration and in some cases can reach several hundred megabytes.

Components that affect the amount of reserved memory include:

Motherboard components - such as the Advanced Programmable I/O Interrupt Controller (APIC);

Sound cards and other devices that perform memory-mapped input/output;

Tire PCI Express(PCIe);

Video cards;

Various chipsets;

Flash drives.

Section " Used", indicated in green, represents the amount of memory used by the system, drivers, and running processes. The amount of memory used is calculated as the value " Total» minus the sum of indicators « Changed», « Expectation" And " Free" In turn, the value " Total" is an indicator " Installed" minus the indicator " Reserved equipment».