Sponsored Content
Top Forums Programming Tool to simulate non-sequential disk I/O (simulate db file sequential read) in C POSIX Post 302531771 by achenle on Friday 17th of June 2011 09:17:26 PM
Old 06-17-2011
Have at it. Don't forget - that's meant to be 64-bit code. It might work if you compile t with large-file compile flags/defines, but I'm not sure as I pretty much do nothing but 64-bit code any more.

I did forget to call srand48() to seed the random number generator. FWIW, something like this would work:

Code:
srand48( time( NULL ) );

On Solaris I usually like this as running something like the above C code over and over in a script can result in sequential runs getting the same "random" sequence when using time() as the seed because the seed value is the same:

Code:
srand48( gethrtime() );

I don't recall offhand if Linux has gethrtime() or an equivalent.

I also didn't try to test or even compile that code. There's a good chance I missed include files and put in something utterly brain dead.

And the location of the read isn't technically random because using the % operator means the beginning of the file will have a slightly larger chance of being selected because of the way it causes the full 64-bit random offset to wrap. But unless the file/device is HUGE it won't really matter - even multiple petabytes won't make the difference measurable.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

inserting uniq sequential numbers at the start of the file

Hi Unix gurus, I have a file. I need to insert sequential number at the starting of the file. Fields are delimited by "|". I know the starting number. Example: File is as follows |123|4test|test |121|2test|test |x12|1test|test |vd123|5test|test starting number is : 120 ... (7 Replies)
Discussion started by: jingi1234
7 Replies

2. Programming

Reading special characters while converting sequential file to line sequential

We have to convert a sequential file to a 80 char line sequential file (HP UX platform).The sequential file contains special characters. which after conversion of the file to line sequential are getting coverted into "new line" or "tab" and file is getting distorted. Is there any way to read these... (2 Replies)
Discussion started by: Rajeshsu
2 Replies

3. Shell Programming and Scripting

Finding missing sequential file names

So, I've got a ton of files that I want to go through (ie something like 300,000), and they're all labeled sequentially. However I'm not 100% positive that they are all there. Is there any way of running through a sequence of numbers, checking if the file is in the folder, if not appending it... (2 Replies)
Discussion started by: Julolidine
2 Replies

4. Shell Programming and Scripting

how to scan a sequential file to fetch some of the records?

Hi I am working on a script which needs to scan a sequential file and fetch the row where 2nd column = 'HUB' Can any one help me with this... Thanks (1 Reply)
Discussion started by: manmeet
1 Replies

5. Shell Programming and Scripting

How to sca a sequential file and fetch some substring data from it

Hi, I have a task where i need to scan second column of seuential file and fetch first 3 digits of that column For e.g. FOLLOWING IS THE SAMPLE FOR MY SEQUENTIAL FILE AU_ID ACCT_NUM CRNCY_CDE THHSBC001 30045678 THB THHSBC001 10154267 THB THHSBC001 ... (2 Replies)
Discussion started by: manmeet
2 Replies

6. Shell Programming and Scripting

Sequential comparison (one row with file and so on)

Dear linux experts, I'd like to ask for your support, I've read some posts in this forum about files comparison but haven't found what I'm looking for. I need to create a sequential script to compare row-by-row one file with 34 similar files but without success so far. This is what I get: ... (2 Replies)
Discussion started by: Gery
2 Replies

7. Shell Programming and Scripting

sequential to line sequential

Hi I have a file sequential way i.e. written in contineous mode and the Record Seperator is AM from which the record is seperated .Now to process I have to make line sequential,and more over record length is not same it varies as per the input address, AM1234563 John Murray 24 Old streeet old... (5 Replies)
Discussion started by: vakharia Mahesh
5 Replies

8. UNIX for Dummies Questions & Answers

Inserting a sequential number into a field on a flat file

I have a csv flatfile with a few million rows. I need to replace a field (field number is 85) in the file with a sequential number. As an example, let's assume there are only 4 fields in the file: A,A,,32 A,A,,27 A,B,,43 C,C,,354 If I wanted to amend the 3rd field in this way my... (2 Replies)
Discussion started by: BristolSmithy
2 Replies

9. Shell Programming and Scripting

Read directories sequential based on timestamp

Hi, I have a directory structure like below Directoryname create time d1 12:00 d2 12:05 d3 12:08 I want to read the directories based on timestamp.That is oldest directory must be read first and kick off certain process. ... (7 Replies)
Discussion started by: chetan.c
7 Replies

10. Shell Programming and Scripting

Sequential Reading from two file in a loop

Hello All, I have two files with me file1.txt and file2.txt file1.txt has: 333 222 111 file2.txt has ccc bbb aaa ccc is related to 333 only, bbb is related to 222 only and aaa is related to 111 only. I have to get the values from each of the file and pass them in the URL... (3 Replies)
Discussion started by: ankur328
3 Replies
fcache_seqlimit_system(5)					File Formats Manual					 fcache_seqlimit_system(5)

NAME
fcache_seqlimit_system - percentage of file cache that can be consumed by sequential accesses, per system-wide limit VALUES
Failsafe Default Allowed values The minimum value allowed is The maximum value allowed is Specify a positive integer value. DESCRIPTION
This parameter places a system-wide limit on how much memory can be consumed in the file cache by sequential accesses. It is important to note the relationship between this tunable and the per-file limit tunable, These two tunables, in conjunction, control how much memory in the file cache can be consumed by sequential accesses. When sequential accesses to a file has exceeded the per-file limit AND the system-wide limit, the excess file cache pages are paged out. Note that both limits have to be reached in order for page stealing to occur. For example, a file can exceed its limit if the limit has not been reached. Similarly, no page stealing occurs if none of the files on the system has exceeded the per-file limit, even if the sys- tem-wide limit has been hit. The page stealing feature is specific to improving sequential I/O performance for large files. Limiting file cache memory consumption helps alleviate memory pressure in the file cache. It also prevents cache wiping -- a single thread sequentially accessing a large file can wipe out the existing contents of the file cache. Who is Expected to Change This Tunable? System administrators that run applications which do large sequential file I/O's. Typically, these files are larger than the size of phys- ical memory on the system. Restrictions on Changing Changes to this tunable take effect immediately. When Should the Value of This Tunable Be Raised? When you wish to allow greater file cache consumption due to sequential accesses. Setting and to 100 effectively disables the sequential access page stealing feature. What Are the Side Effects of Raising the Value? Setting the tunable too high may yield poor performance for large sequential I/O's for large files (larger than physical memory size). and should be tuned appropriately for the anticipated workload. When Should the Value of This Tunable Be Lowered? When you wish to limit file cache consumption due to sequential accesses. Setting and to 0 forces sequential access page stealing to always occur. What Are the Side Effects of Lowering the Value? Could cause more pageouts to occur in an attempt to limit the file cache consumption. What Other Tunable Values Should Be Changed at the Same Time? and should be changed at the same time. WARNINGS
All HP-UX kernel tunable parameters are release specific. This parameter may be removed or have its meaning changed in future releases of HP-UX. Installation of optional kernel software, from HP or other vendors, may cause changes to tunable parameter values. After installation, some tunable parameters may no longer be at the default or recommended values. For information about the effects of installation on tun- able values, consult the documentation for the kernel software being installed. For information about optional kernel software that was factory installed on your system, see at AUTHOR
was developed by HP. SEE ALSO
fcache_seqlimit_file(5). Tunable Kernel Parameters fcache_seqlimit_system(5)
All times are GMT -4. The time now is 01:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy