[lkml]   [1996]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject`pipe` forces write?

I've discovered that doing something like the following under csh or tcsh:
while (1)
set foo = `echo bar | cat`
it causes continuous disk activity even in the presence of gobs of free
pages (and without the while loop around it will still cause an immediate
write). the sh moral equivalent:
while true; do set foo = `echo bar | cat` ; done
doesn't cause the disk to churn...nor does it drive the CPU usage up beyond
about 15% (total for the loop and top), even once the disk becomes completely
idle. I see this on both my 486DX2-100 (kernel 2.1.13) or my 486DLC-40

Obviously, Berkeley csh and tcsh are being inefficent about backquoted tails
of pipes (get rid of the piping and the disk activity goes away), but I don't
think that the kernel should be insisting on doing a write to the device so
immediately. Also, the lack of CPU usage seems quite odd...

Are these fsync() calls in some shell code combined with a deliberate time-
wasting mechanism held secret in the depths of UN*X specs all these years,
or what?

Keith (this task fits in memory; it ought to act like it)

 \ /
  Last update: 2005-03-22 13:38    [W:0.017 / U:1.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site