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

I've discovered that doing something like the following under csh or tcsh:
while (1)
set foo = `echo bar | cat`
end
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
(2.0.21).

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.132 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site