Re: Scheduling problem with 2.4?

Andrea Arcangeli (andrea@suse.de)
Sat, 17 May 2003 23:53:45 +0200


On Sat, May 17, 2003 at 10:44:16PM +0200, David Kastrup wrote:
> Which kernel? Oh, and of course: on a SMP machine the problem would

I run it on smp. but I understood what's going on.

--- testio.el.orig 2003-05-17 22:22:24.000000000 +0200
+++ testio.el 2003-05-17 23:39:49.000000000 +0200
@@ -19,7 +19,7 @@
(setq test-pattern nil test-start (float-time))
(let ((process (start-process
"test" (and (bufferp printer) printer) "sh"
- "-c" "od -v /dev/zero|dd bs=1 count=100k")))
+ "-c" "od -v /dev/zero| dd bs=100k count=1")))
(set-process-filter process `(lambda (process string)
(test-filter process string
',printer)))

this is what I thought you were really doing with this script, not the
other way around ;).

The reason you get the 1 char reads in your version is because dd will
only write 1 char at time to emacs. This has nothing to do with emacs,
this is about dd writing 1 char at time. If you don't write 1 char at
time, emacs won't read 1 char at time.

The only thing you could do to decrease the cxt switch flood is to put a
buffer with timeout in between, but by default having a buffer with
timeout in the kernel would be an overkill overhead and depending on the
timeout it could be visible for normal shells. So the kernel behaviour
is right and it isn't going to change.

If one important app of yours is dumb and writes flood of data 1 char at
time then just write a buffer in userspace yourself, and in 99% of cases
a dd bs=4k will just work perfectly (you'll need a timeout-stdout-flush
version one only if the pipe keeps staying open i.e. if the app doesn't
quit).

Andrea
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/