Mapping all file at once or by page


 
Thread Tools Search this Thread
Top Forums Programming Mapping all file at once or by page
# 8  
Old 05-14-2009
Yes, my program just read the file sequentially without bouncing back and forward.

I really doubt physical memory on which the application will run will have enough memory
to contain the whole file.

By the way, is there a syscall for linux to get the total amount of free physical memory?

Thanks guys for your help.

Really appreciated.
# 9  
Old 05-14-2009
I just stumbled across linux syscall readahead().

Do you think it can be used to improve performances even further ?
Or is it just an alternative way of setvbuf ?

Thanks again.
# 10  
Old 05-14-2009
It can improve read performance - see also preload (a system service or daemon) and madvise.
# 11  
Old 05-14-2009
madavise seem interesting.

So it's either
mmap + madavise( MADV_SEQUENTIAL )orsetvbuf + readahead + fread

although I'm not sure I understood how readahead is supposed to be used,
that is, can I tell him I wanna read the whole file (magnitude of giga bytes)
or should I tell him chunk by chunk?

It's becoming an interesting thread btw. :-)

Thanks to all of you guys.
# 12  
Old 05-14-2009
Quote:
Originally Posted by emitrax
Yes, my program just read the file sequentially without bouncing back and forward.

I really doubt physical memory on which the application will run will have enough memory
to contain the whole file.

By the way, is there a syscall for linux to get the total amount of free physical memory?

Thanks guys for your help.

Really appreciated.
Yes you are on the right track as you need to figure out first the total amount of free physical memory available before you start coding the mmap call and no I don't know how to get that information on Linux but others may be able to tell you that.
# 13  
Old 05-14-2009
Quote:
Originally Posted by emitrax
I just stumbled across linux syscall readahead().

Do you think it can be used to improve performances even further ?
Or is it just an alternative way of setvbuf ?

Thanks again.
I don't know Linux but I Google'd the readahead call and it seems to be the system equivalent of the mmap call. Only difference seems to be that while mmap loads the file contents into the user process readahead does the same thing but puts it all into the system buffer cache in units of pagesize.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replacing 12 columns of one file by second file based on mapping in third file

i have a real data prod file with 80+ fields containing 1k -2k records. i have to extract say 12 columns out of this which are sensitive fields along with one primary key say SEQ_ID (like DOB,account no, name, SEQ_ID, govtid etc) in a lookup file. i have to replace these sensitive fields in... (11 Replies)
Discussion started by: megh12
11 Replies

2. UNIX for Dummies Questions & Answers

Formatting data in a raw file by using another mapping file

Hi All, i have a requirement where i need to format the input RAW file ( which is CSV) by using another mapping file(also CSV file). basically i am getting feed file with dynamic headers by using mapping file (in that target field is mapped with source filed) i have to convert the raw file into... (6 Replies)
Discussion started by: ravi4informatic
6 Replies

3. Shell Programming and Scripting

Search and replace with mapping from a mapper file in a target file

Hello, I have a special problem. I have a file in 8 bit and would like to convert the whole database to 16Bit unicode. The mapping file has the following structure: The mapper is provided as a zip file The target file to be converted contains data in English and 8 bit Urdu mapping, a... (4 Replies)
Discussion started by: gimley
4 Replies

4. UNIX for Dummies Questions & Answers

Mapping a data in a file and delete line in source file if data does not exist.

Hi Guys, Please help me with my problem here: I have a source file: 1212 23232 343434 ASAS1 4 3212 23232 343434 ASAS2 4 3234 23232 343434 QWQW1 4 1134 23232 343434 QWQW2 4 3212 23232 343434 QWQW3 4 and a mapping... (4 Replies)
Discussion started by: kokoro
4 Replies

5. Shell Programming and Scripting

Creating unique mapping from multiple mapping

Hello, I do not know if this is the right title to use. I have a large dictionary database which has the following structure: where a b c d e are in English and p q r s t are in a target language., the two separated by the delimiter =. What I am looking for is a perl script which will take... (5 Replies)
Discussion started by: gimley
5 Replies

6. Shell Programming and Scripting

Mapping with series from master file and calculate count

Hi All, My shell script is calculating the count of each shortcode series wise whose sample output is as follows: -------------------------- 56882 9124 1 9172 1 9173 4 8923 6 9175 1 9058 2 7398 2 -------------------------- 58585 series count 9124 1 8858 17 9061 21 9125 21 (10 Replies)
Discussion started by: poweroflinux
10 Replies

7. Shell Programming and Scripting

read a file and use the content for mapping

help me pls.. :( i want to read a mapping file. Below is the content of my mapping file. 6221,189,SMSC1,OMC1,WAP1 6223,188,SMSC2,OMC2,WAP2 so when my program running msisdn="622130302310" while not EOF if substring($msisdn,1,4) == "6221" -- > "6221" read from the file then echo... (0 Replies)
Discussion started by: voidmain
0 Replies

8. Shell Programming and Scripting

Join 3 files using key column in a mapping file

I'm new of UNIX shell scripting. I'm recently generating a excel report in UNIX(file with delimiter is fine). How should I make a script to do it? 1 file to join comes from output of one UNIX command, the second from another UNIX command, and third from a database query. The key columes of all... (7 Replies)
Discussion started by: bigsmile
7 Replies

9. Shell Programming and Scripting

[BASH] mapping of values from file line into variables

Hello, I've been struggling with this for some time but can't find a way to do it and I haven't found any other similar thread. I'd like to get the 'fields' in a line from a file into variables in just one command. The file contains data with the next structure:... (4 Replies)
Discussion started by: semaler
4 Replies

10. Linux

mapping of a printer model with a ppd file in CUPS

Hi all, I am currently working on building a GUI to be interfaced with CUPS 1.3.4 package; In my GUI I have a list of printer manufacturers mapped With various printer models ; and for a particular printer model selected I needed to know how to map that model with an Appropriate ppd file; as I... (0 Replies)
Discussion started by: sc3008
0 Replies
Login or Register to Ask a Question