I was playing about with buffering and discovered this:
If I pipe a writer, which doesn't newline terminate, into a reader on linux, most often the box freezes as the swap gets sucked up. (observe with top)i tried in C also on solaris, using printf with gets and the buffer flushes occasionally even without the newline.
So maybe there is a perl feature that allows you to fill up buffers and a linux bug which allows a process to freeze the system../buffer_write.pl -loop |  buffer_read.pl
#!/bin/perl -s $main::size ||= 10_000; $count; sub do_write { $buf = chr int(rand(25)+65); $message = $buf x $size; $message .= "\n" if $line;; print "$message"; $count += length $message; warn "$count bytes\n"; } while ($loop || <>) { do_write; }
#!/bin/perl -n print length($_), "\n"; print;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: who's bug is it anyway? (how to bring a linux box to it's knees)
by rhesa (Vicar) on Mar 28, 2007 at 13:31 UTC | |
|
Re: who's bug is it anyway? (how to bring a linux box to it's knees)
by graff (Chancellor) on Mar 29, 2007 at 01:36 UTC |