Re: wierd behaviour...

Harald Koenig (koenig@tat.physik.uni-tuebingen.de)
Tue, 25 Feb 1997 11:01:38 +0100 (MET)


> > main(){ fork();} /* no while to do several fork(). so its safe */
> > /* no danger for your computer */
> >
> > so when i run it, my harddrive is running. Even if i run it several times
> > to be sure sure that the code is in buffers. i don't understand why my
> > hd need to write or read something during or after this little program.
>
> i studied vmstat's io bo ("bo: Blocks received from a block device (blocks/s)"
> from vmstat's manpage) and i see 4 new bo each time i run my source.
>
> that comes from fork(), and the following source makes me think something
> these 4 blocks is read when the child die.
> main(){ if( !fork()) sleep(4); else sleep(2); }
>
> any explaination ?

too complicated tests give wierd results and wrong conclutions... try

main(){ pause(); }

and you'll realize that these writes are ~5-10 secs after you start the image.
and

ls -l prog
ls -lc prog
ls -lu prog

will show the reason: every time you run, the "last access" timestamp
of the file is updated in the inode. and these changes are flushed to disk
a few seconds later by kflushd...

Harald

--
All SCSI disks will from now on                     ___       _____
be required to send an email notice                0--,|    /OOOOOOO\
24 hours prior to complete hardware failure!      <_/  /  /OOOOOOOOOOO\
                                                    \  \/OOOOOOOOOOOOOOO\
                                                      \ OOOOOOOOOOOOOOOOO|//
Harald Koenig,                                         \/\/\/\/\/\/\/\/\/
Inst.f.Theoret.Astrophysik                              //  /     \\  \
koenig@tat.physik.uni-tuebingen.de                     ^^^^^       ^^^^^