First of all am quite new to cpp especially under linux.
I am currently working on a small project under Linux and am having to deal with large number of data(larger than 1 GB). numerous number of operation is to be done with these data. for example: sorting, searching, comparing ... etc. so in order to perform all these operations it is important that these data are in the memory...
in order to deal with such a large amount of data am thinking of using a memory mapped file..
can anyone help me or guide me in the steps of creating a memory mapped file?
Memory Mapped Files are typically used when an existing implementation (or other requirement) DICTATES that the operation must be performed on "files", and you are looking for a faster media than disk.
A memory mapped solution will never be smaller or faster than an optimal object based implementation.
So, before getting into the "how" can you explain the "why?"
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!) 2008, 2009 In theory, there is no difference between theory and paractice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
if (stat("mmapdemo.c", &sbuf) == -1) {
perror("stat");
exit(1);
}
offset = atoi(argv[1]);
if (offset < 0 || offset > sbuf.st_size-1) {
fprintf(stderr, "mmapdemo: offset must be in the range 0-%d\n", \
sbuf.st_size-1);
exit(1);
}
Bookmarks