Click here to Skip to main content
15,917,610 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Suggestions Needed: Populating ListView Pin
valikac16-Jul-03 4:52
valikac16-Jul-03 4:52 
QuestionHow to do Windows Service Programmatically Pin
PrasadD15-Jul-03 10:50
PrasadD15-Jul-03 10:50 
AnswerRe: How to do Windows Service Programmatically Pin
Frank Deo15-Jul-03 11:17
Frank Deo15-Jul-03 11:17 
GeneralGetting windows running process list Pin
PrasadD15-Jul-03 10:48
PrasadD15-Jul-03 10:48 
GeneralRe: Getting windows running process list Pin
Ryan Binns15-Jul-03 14:56
Ryan Binns15-Jul-03 14:56 
GeneralMemory Mapped Files and Performance Strategies Pin
Steve The Plant15-Jul-03 10:00
Steve The Plant15-Jul-03 10:00 
GeneralRe: Memory Mapped Files and Performance Strategies Pin
David Crow15-Jul-03 10:12
David Crow15-Jul-03 10:12 
GeneralRe: Memory Mapped Files and Performance Strategies Pin
Mike Dimmick16-Jul-03 6:36
Mike Dimmick16-Jul-03 6:36 
For some situations it's more convenient to use memory mapped files (e.g. if your file is structured with offsets to given items), and so that you can have a disk-backed data structure. It really simplifies programming such a shared structure - you don't have to explicitly read or write the file, you just read from or write to memory.

Note that there isn't any particular improvement in speed, nor any fewer disk hits: pages of a mapped view of a memory-mapped file are still paged in (and out) on demand.

SQL Server makes a lot of use of memory mapped files, IIRC.

If you're just reading a file sequentially, rely on the file system caching. It'll do much the same thing and is typically less complicated to program. To optimise the caching behaviour, pass the FILE_FLAG_SEQUENTIAL_SCAN or FILE_FLAG_RANDOM_ACCESS flags, depending on how you're using the file. If you specify one mode but your program actually reads the other way, performance is typically worse than if you hadn't specified either flag. Essentially FILE_FLAG_SEQUENTIAL_SCAN tells the system to read-ahead a lot and not at all behind, whereas FILE_FLAG_RANDOM_ACCESS tells it not to read ahead or behind very much. Specifying neither gives a compromise mode that does a little read-behind and some read-ahead. FILE_FLAG_SEQUENTIAL_SCAN causes pages behind the current file pointer to be discarded aggressively.

For information on how Windows 2000 file caching works, see Inside Windows 2000[^], chapters 7 (Memory Management) and 11 (Cache Manager). Basically the system implements caching by memory-mapping the files.
GeneralRe: Memory Mapped Files and Performance Strategies Pin
David Crow16-Jul-03 6:55
David Crow16-Jul-03 6:55 
GeneralRe: Memory Mapped Files and Performance Strategies Pin
Mike Dimmick16-Jul-03 22:41
Mike Dimmick16-Jul-03 22:41 
GeneralRe: Memory Mapped Files and Performance Strategies Pin
David Crow17-Jul-03 5:59
David Crow17-Jul-03 5:59 
Generalcarriage return/line feed Pin
butterbean73015-Jul-03 9:55
butterbean73015-Jul-03 9:55 
GeneralRe: carriage return/line feed Pin
John M. Drescher15-Jul-03 10:04
John M. Drescher15-Jul-03 10:04 
GeneralRe: carriage return/line feed Pin
Ryan Binns15-Jul-03 14:54
Ryan Binns15-Jul-03 14:54 
Generalshowing # recds in CRecordset Pin
RalfPeter15-Jul-03 9:30
RalfPeter15-Jul-03 9:30 
GeneralRe: showing # recds in CRecordset Pin
David Crow15-Jul-03 9:40
David Crow15-Jul-03 9:40 
GeneralRe: showing # recds in CRecordset Pin
RalfPeter15-Jul-03 11:11
RalfPeter15-Jul-03 11:11 
GeneralRe: showing # recds in CRecordset Pin
Toni7815-Jul-03 15:33
Toni7815-Jul-03 15:33 
GeneralRe: showing # recds in CRecordset Pin
David Crow16-Jul-03 3:00
David Crow16-Jul-03 3:00 
GeneralRe: showing # recds in CRecordset Pin
Toni7816-Jul-03 16:06
Toni7816-Jul-03 16:06 
GeneralLBN_SELCHANGE Pin
John R. Shaw15-Jul-03 9:16
John R. Shaw15-Jul-03 9:16 
GeneralProcess, Module and Thread enumeration classes Pin
kurnaziso15-Jul-03 9:10
kurnaziso15-Jul-03 9:10 
QuestionExchange server plugin... Where to start? Pin
LukeV15-Jul-03 8:46
LukeV15-Jul-03 8:46 
AnswerRe: Exchange server plugin... Where to start? Pin
Michael P Butler15-Jul-03 9:07
Michael P Butler15-Jul-03 9:07 
GeneralHelp! Mysterious type mismatch errors with my ActiveX control Pin
David F Zimny15-Jul-03 8:39
David F Zimny15-Jul-03 8:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.