VirtualBox

Changeset 2926 in kBuild


Ignore:
Timestamp:
Sep 15, 2016 11:02:50 PM (8 years ago)
Author:
bird
Message:

kWorker: A few more words.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kWorker/kWorker.c

    r2924 r2926  
    91269126 *
    91279127 *
    9128  * @subsection sec_kWorker_How_Works_Loading   Image loading
     9128 * @subsection ssec_kWorker_Loaing      Image loading
    91299129 *
    91309130 * kWorker will manually load all the executable images into memory, fix them
     
    91409140 *      - Intercept file reading for caching (header files, ++) as file system
    91419141 *        access is made even slower by anti-virus software.
     9142 *      - Intercept crypto hash APIs to cache MD5 digests of header files
     9143 *        (c1.dll / c1xx.dll spends a noticable bit of time doing MD5).
    91429144 *      - Intercept temporary files (%TEMP%/_CL_XXXXXXyy) to keep the entirely
    91439145 *        in memory as writing files grows expensive with encryption and
     
    91779179 *
    91789180 *
     9181 * @subsection ssec_kWorker_Optimizing  Optimizing the Compiler
     9182 *
     9183 * The Visual Studio 2010 C/C++ compiler does a poor job at processing header
     9184 * files and uses a whole bunch of temporary files (in %TEMP%) for passing
     9185 * intermediate representation between the first (c1/c1xx.dll) and second pass
     9186 * (c2.dll).
     9187 *
     9188 *
     9189 * @subsubsection sssec_kWorker_Headers     Cache Headers Files and Searches
     9190 *
     9191 * The preprocessor part will open and process header files exactly as they are
     9192 * encountered in the source files.  If string.h is included by the main source
     9193 * and five other header files, it will be searched for (include path), opened,
     9194 * read, MD5-summed, and pre-processed six times.  The last five times is just a
     9195 * waste of time because of the guards or \#pragma once.  A smart compiler would
     9196 * make a little extra effort and realize this.
     9197 *
     9198 * kWorker will cache help the preprocessor by remembering places where the
     9199 * header was not found with help of kFsCache, and cache the file in memory when
     9200 * found.  The first part is taken care of by intercepting GetFileAttributesW,
     9201 * and the latter by intercepting CreateFileW, ReadFile and CloseFile.  Once
     9202 * cached, the file is kept open and the CreateFileW call returns a duplicate of
     9203 * that handle.  An internal handle table is used by ReadFile and CloseFile to
     9204 * keep track of intercepted handles (also used for temporary file, temporary
     9205 * file mappings, console buffering, and standard out/err buffering).
     9206 *
     9207 *
     9208 * @subsubsection sssec_kWorker_Temp_Files  Temporary Files In Memory
     9209 *
     9210 * The issues of the temporary files is pretty severe on the Dell machine used
     9211 * for benchmarking with full AV and encryption.  The synthetic benchmark
     9212 * improved by 30% when kWorker implemented measures to keep them entirely in
     9213 * memory.
     9214 *
     9215 * kWorker implement these by recognizing the filename pattern in CreateFileW
     9216 * and creating/opening the given file as needed.  The handle returned is a
     9217 * duplicate of the current process, thus giving us a good chance of catching
     9218 * API calls we're not intercepting.
     9219 *
     9220 * In addition to CreateFileW, we also need to intercept GetFileType, ReadFile,
     9221 * WriteFile, SetFilePointer+Ex, SetEndOfFile, and CloseFile.  The 2nd pass
     9222 * additionally requires GetFileSize+Ex, CreateFileMappingW, MapViewOfFile and
     9223 * UnmapViewOfFile.
    91799224 *
    91809225 *
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette