04-24-2009
What kind of socket do you have that your hard drive cannot keep up with? Normal read/write calls are not slow. Seeking is slow, if you're going to be seeking randomly all over the place then mmap-ing it might be better. But keep in mind that, on 32-bit machines at least, you're limited in how big an area you can map, a gig is a big chunk of a process' 4-gig address space. 64-bit's limit is much, much higher.
What you might also find useful is cache-hinting, being able to tell the kernel 'OK, I am done with this area of the file for the foreseeable future' in order to let it purge data from cache earlier than it might otherwise have, or do read-ahead differently, etc. It gives you some of the advantages of raw I/O without the problems. See fadvise and madvise.
Last edited by Corona688; 04-24-2009 at 06:11 PM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am new to Unix so will really appreciate if someone can guide me on this.
What I want to do is:
Step1: Read binary file - pick first 2 bytes, convert from hex to decimal. Read the next 3 bytes as well.
2 bytes will specify the number of bytes 'n' that I want to read and write... (1 Reply)
Discussion started by: Kbenipel
1 Replies
2. AIX
We just set up a system to use large pages. I want to know if there is a command to see how much of the memory is being used for large pages. For example if we have a system with 8GB of RAm assigned and it has been set to use 4GB for large pages is there a command to show that 4GB of the *GB is... (1 Reply)
Discussion started by: daveisme
1 Replies
3. Shell Programming and Scripting
Hi, I would like to read the specific data from file and write the data in the new file.
My data input is something like this..
<EXROP:R=TJ0311T;
ROUTE DATA
R ROUTE PARAMETERS
TJ0311T DETY=UPDR TTRANS=1 FNC=3
MA=628160955000
R=TJ0311D
... (3 Replies)
Discussion started by: bha148
3 Replies
4. Shell Programming and Scripting
Hello
I have the following files
VOICE_hhhh
SUBSCR_llll
DEL_kkkk
Consider that there are 1000 VOICE files+1000 SUBSCR files+1000DEL files
When i try to tar these files using
tar -cvf backup.tar VOICE* SUBSCR* DEL*
i get the error:
ksh: /usr/bin/tar: arg list too long
How can i... (9 Replies)
Discussion started by: chriss_58
9 Replies
5. Solaris
Would simply like to write data (no audio) to a CD/RW disk. The disk drive states CD/RW on the front but don't know for sure if the software is configured to recognize it as a writable disk. I can read/move data from the disk to the hard drive with no issue from the disk. Any help in this... (4 Replies)
Discussion started by: jes1trish
4 Replies
6. Shell Programming and Scripting
Hi,
can some one help me how to encrypt and decrypt a file.
AIM: reade user input, encrypt it and save it to file.
while decryption read the encrypted file decrypt it and save the output in some variable.
Example: consider we have Credentials.txt file with content username: password... (5 Replies)
Discussion started by: saichand1985
5 Replies
7. Shell Programming and Scripting
This basic code works.
I have a very long list, almost 10000 lines that I am building into the array. Each line has either 2 or 3 fields as shown in the code snippit. The array elements are static (for a few reasons that out of scope of this question) the list has to be "built in".
It... (5 Replies)
Discussion started by: sumguy
5 Replies
8. Shell Programming and Scripting
Hi,
I have on Designdocument in that information is stored with in tabular format.I need Perlscript to read and write the datausing perl script?
Regards,
Ravi (0 Replies)
Discussion started by: toravi.pentaho
0 Replies
9. Shell Programming and Scripting
Hi,
I have on Designdocument in that information is stored with in tabular format.I need Perl/unix script to read and write the data
using perl script?
Regards,
Ravi (4 Replies)
Discussion started by: toravi.pentaho
4 Replies
10. Shell Programming and Scripting
I have nginx web server logs with all requests that were made and I'm filtering them by date and time.
Each line has the following structure:
127.0.0.1 - xyz.com GET 123.ts HTTP/1.1 (200) 0.000 s 3182 CoreMedia/1.0.0.15F79 (iPhone; U; CPU OS 11_4 like Mac OS X; pt_br)
These text files are... (21 Replies)
Discussion started by: brenoasrm
21 Replies
madvise(2) System Calls Manual madvise(2)
NAME
madvise() - advise the system of a process's expected paging behavior
SYNOPSIS
DESCRIPTION
The system call permits a process to advise the system about its expected future behavior in referencing a mapped file, an anonymous memory
region, or a shared memory region. Certain implementations can use this information to optimize the use of resources.
addr and len specify the address and length in bytes of the region to which the advice refers. For the address and length must be con-
tained within a successful call to (see mmap(2)) or a successful call to (see shmat(2)); otherwise, fails with an [EINVAL] error.
The behav argument is one the following flags defined in the header
Removes any previous advice and sets the default behavior. By default, the kernel tracks access patterns on data objects and per-
forms I/Os based on process trends (that is, sequential versus random). Sequential trends cause larger "read-ahead" I/Os, while
random accesses reduce the amount of I/O to avoid unnecessary I/O.
Informs the kernel that any objects mapped in this range
will be accessed in a random matter. The kernel will read only the minimal amount of data to satisfy the user fault.
Informs the kernel that any objects mapped in this range
will be accessed in a sequential matter. The kernel will perform the maximum read-ahead for every fault. The kernel does
not pay attention to access patterns and trends, but instead assumes sequentiality for every access on the object.
Informs the kernel that the specified range
is no longer needed by the process. This allows the kernel to release the physical pages associated with an address range
back to the system for use by other processes.
is restricted to object ranges created with calls to and Attempting to use on an object that was not created using a call to
or will result in [EINVAL] being returned to the caller.
Will need these pages.
Ensure that resources are reserved.
WARNINGS
The current implementation of defines and as null operations.
RETURN VALUE
returns the following values:
Successful completion.
Failure.
is set to indicate the error.
ERRORS
If fails, is set to one of the following values.
[EFAULT] The range specified by (addr, addr+len) is invalid for a process's address space, or permission was incorrect on the
object for the behav specified.
[EINVAL] behav contains an invalid value, or addr is not a multiple of the page size as returned by the system call
[EINVAL] The address range specified by addr and len was not created by a successful call to or
AUTHOR
was developed by HP and OSF.
SEE ALSO
mmap(2), sysconf(2).
STANDARDS CONFORMANCE
madvise(2)