Re: Dumping /dev/zero to the console

Systemkennung Linux (linux@mailhost.uni-koblenz.de)
Mon, 22 Jul 1996 01:26:55 +0200 (MET DST)


Hi,

> Well...I also tried the dd trick on my humble little 486-33, and other
> than eat about 85% of the CPU time, slowing things down even more,
> nothing terrible happened.

The problem is *not* dumping /dev/zero to the console but the bs=1024k
argument to dd. Therefore the kernel will print more than one million
chars with one single syscall to the screen. The Linux kernel isn't
preemptible and therefore the write operation to the console will be
completed - no matter how long it takes. Fixing is trivial, something
like the following untested patch to console.c should do the job.

disable_bh(CONSOLE_BH);
while (!tty->stopped && count) {
+ if(need_resched)
+ schedule();
enable_bh(CONSOLE_BH);
c = from_user ? get_user(buf) : *buf;
buf++; n++; count--;

Ralf