I have a C++ program that opens, gets a little data from, and closes about 5000 files. Now if I run the program when I first boot up, the running time is from about 10 seconds to a minute. Subsequently, the program runs in well inter one second. Buffering -- right?
So I changed a parameter, so the program gets a different (albeit similar) 5000 files from a different directory. Running time on the first try: well under one second.
How about that?
[~]$ uname -a Linux xxxxx 2.6.18-194.32.1.el5 #1 SMP Wed Jan 5 17:53:09 EST 2011 i686 i686 i386 GNU/Linux
Thanks for your comments. Mike.
On Wed, Mar 2, 2011 at 10:59 AM, Michael D. Berger m_d_berger_1900@yahoo.com wrote:
I have a C++ program that opens, gets a little data from, and closes about 5000 files. Now if I run the program when I first boot up, the running time is from about 10 seconds to a minute. Subsequently, the program runs in well inter one second. Buffering -- right?
So I changed a parameter, so the program gets a different (albeit similar) 5000 files from a different directory. Running time on the first try: well under one second.
How about that?
[~]$ uname -a Linux xxxxx 2.6.18-194.32.1.el5 #1 SMP Wed Jan 5 17:53:09 EST 2011 i686 i686 i386 GNU/Linux
Buffering, certainly.. but maybe on several layers. The physical disk may have a read ahead cache. The OS may also buffer.
You may also be pulling in libraries on the initial run which stay resident for awhile..
Kwan Lowe wrote:
Michael D. Berger
I have a C++ program that opens, gets a little data from, and closes about 5000 files. Now if I run the program when I first boot up, the running time is from about 10 seconds to a minute. Subsequently, the program runs in well inter one second. Buffering -- right?
So I changed a parameter, so the program gets a different (albeit similar) 5000 files from a different directory. Running time on the first try: well under one second.
How about that?
[~]$ uname -a Linux xxxxx 2.6.18-194.32.1.el5 #1 SMP Wed Jan 5 17:53:09 EST 2011 i686 i686 i386 GNU/Linux
Buffering, certainly.. but maybe on several layers. The physical disk may have a read ahead cache. The OS may also buffer.
You may also be pulling in libraries on the initial run which stay resident for awhile..
You might explore what vmstat says about disk activity during an initial vs follow-on run. Also, I wonder what "top" shows in the WCHAN and nFLT columns.
On Wed, 02 Mar 2011 22:24:00 -0800, Charles Polisher wrote:
Kwan Lowe wrote:
[...]
You might explore what vmstat says about disk activity during an initial vs follow-on run. Also, I wonder what "top" shows in the WCHAN and nFLT columns.
The problem is OBE since I added some real processing to the code, and I no longer get the apparent buffering.
But please see my new thread: "top and allocation issues".
Mike.