Hi
I need to share about 10 MB of data between two processes. In the first
process, I do something similar to:
HANDLE hBuffer = CreateFileMappi ng(INVALID_HAND LE_VALUE, NULL,
PAGE_READWRITE, 0, 10000000, "This is a test");
// <- Check for errors
void *buffer = MapViewOfFile(h Buffer,FILE_MAP _WRITE, 0, 0, 0);
// <- Check for errors
// <- Write something in the buffer
In the second process:
HANDLE hBuffer = OpenFileMapping (FILE_MAP_WRITE , false, "This is a
test");
// <- Check for errors
void *buffer = MapViewOfFile(h Buffer, FILE_MAP_WRITE, 0, 0, 0);
// <- Check for errors
// <- Read all the buffer
What I read is what was written, which is okay. The problem is that, in
the second process, it is about 10 (ten) times slower to read the buffer
that was allocated in the first process than to read another 10 MB
buffer allocated in the second process itself. Is it normal? Is there a
way to share memory more efficiently?
Thanks
Joe
--
.--------------------.
| |
| Good Morning.... | .--.--.
| | .; .;|;. ;.
`-------------. ,---' .;_;' `;_;.
\| ; ;' `; ;
\ ;;'.--.___.--.`;;
;-( o )=3D( o )-;
( `--' | `--' )
\| . . |/
........... . .:::::. . .______
/ . '---` . '\
.' `. .' \
| ____,.- . | `.....' | _______ |
| ,-' \ /|\'' \.-- |
| / \.'\ /,'. \. - |
| /| ` `\ / \ |
| ,/ _ '/ '\ |
,-' ,-. |o '
/ '| | | | \
/ ,/| |o | \ `
| .' | |.' |. \ \
________/ .'____|________ _______________ _||__`. `__________
( \ ) / )
'-. '-. ( .-` .-`
'-. .-'--.__. .-.__.--`-. .-`
'-..' \--' : ~`:=3D,`- `..-`
\ .. \\ |`-'|`-, /
\\\\\\\) | |`-'/.'/
\)\)\\ `-' `-'
`
I need to share about 10 MB of data between two processes. In the first
process, I do something similar to:
HANDLE hBuffer = CreateFileMappi ng(INVALID_HAND LE_VALUE, NULL,
PAGE_READWRITE, 0, 10000000, "This is a test");
// <- Check for errors
void *buffer = MapViewOfFile(h Buffer,FILE_MAP _WRITE, 0, 0, 0);
// <- Check for errors
// <- Write something in the buffer
In the second process:
HANDLE hBuffer = OpenFileMapping (FILE_MAP_WRITE , false, "This is a
test");
// <- Check for errors
void *buffer = MapViewOfFile(h Buffer, FILE_MAP_WRITE, 0, 0, 0);
// <- Check for errors
// <- Read all the buffer
What I read is what was written, which is okay. The problem is that, in
the second process, it is about 10 (ten) times slower to read the buffer
that was allocated in the first process than to read another 10 MB
buffer allocated in the second process itself. Is it normal? Is there a
way to share memory more efficiently?
Thanks
Joe
--
.--------------------.
| |
| Good Morning.... | .--.--.
| | .; .;|;. ;.
`-------------. ,---' .;_;' `;_;.
\| ; ;' `; ;
\ ;;'.--.___.--.`;;
;-( o )=3D( o )-;
( `--' | `--' )
\| . . |/
........... . .:::::. . .______
/ . '---` . '\
.' `. .' \
| ____,.- . | `.....' | _______ |
| ,-' \ /|\'' \.-- |
| / \.'\ /,'. \. - |
| /| ` `\ / \ |
| ,/ _ '/ '\ |
,-' ,-. |o '
/ '| | | | \
/ ,/| |o | \ `
| .' | |.' |. \ \
________/ .'____|________ _______________ _||__`. `__________
( \ ) / )
'-. '-. ( .-` .-`
'-. .-'--.__. .-.__.--`-. .-`
'-..' \--' : ~`:=3D,`- `..-`
\ .. \\ |`-'|`-, /
\\\\\\\) | |`-'/.'/
\)\)\\ `-' `-'
`
Comment