Кешируются ли процессы в Windows 7?

399
Kao

Я профилирую свое Java-приложение с помощью Windows Performance Analyzer . Мое приложение представляет собой простой анализатор, который использует внешнюю программу командной строки для анализа файлов. Эта внешняя программа вызывается для каждого файла. Вот как это выглядит при исполнении в Windows 7:

profiling results

Как видите, одновременно создаются два короткоживущих процесса: conhost.exeи src2srcml.exe. Что странно, так это то, что впервые эти процессы живут гораздо дольше, чем позже. Что может быть причиной этого?

Возможно ли, что Windows каким-то образом кеширует эти процессы?

4

2 ответа на вопрос

4

Windows 7 действительно кэширует все виды файлов, включая приложения, в памяти. Ваше предположение, вероятно, верно, тот факт, что процессы находятся в памяти, заставляет их запускаться намного быстрее. Кешируются не только сами исполняемые файлы, но и требуемые библиотеки DLL также загружаются и готовы.

1
harrymc

conhost.exe is the console-hosting process, that is launched by the Command Prompt (cmd). It is present because you are using a command-line program.

src2srcml.exe is part of the srcML toolkit, and is present probably because you are manipulating Source Markup or XML files.

As to why it is slower on the first call, as was already noted by MoJo, it is because the first call loads nedeed objects into memory. As long as Windows does not require the RAM, it will leave in it all the file-blocks that were read or written.

This includes executable files, DLL files, disk tables, directory structure, user data files, the registry, needed kernel modules, in short anything and everything that resides on the disk is cached by Windows.

The size of the cache is entirely dynamic and may extend to more than half of the RAM. As memory is required by programs, Windows will free blocks that were read. It will also periodically check for the need to write out modified blocks so they can become candidates for freeing (lazy writing), which is why it is not a good idea to pull the power plug on a Windows computer.

This is why newer invocations are faster, because Windows has adapted itself to your needs by loading into RAM all the required objects.

For more information see the Microsoft blogs File Caching or I/O Concepts.

Что касается первой части - я уже знал об этом, потому что я сам написал эту программу Java;) Kao 9 лет назад 0