[lkml]   [1996]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: Dumping /dev/zero to the console
    - From Webmaster (
    Thu, 18 Jul 1996 15:22:58 +0000

    >> On linux console, even as a non-priv user, do a:
    >> % dd if=/dev/zero bs=1024k
    >That's basically the same as the "grep whatever /dev/zero" discussed
    >on this list a while back.

    No it is not the same. The "grep whatever /dev/zero" sucks up all mem
    if you don't have sensible limits, but the above doesn't. In fact it
    doesn't require /dev/zero at all. A 1MB zeroed block works equally as well.
    This simple program does the same thing: running it on a virtual
    console means I can barely type anything on another VC (one charater
    per 15sec or so) or barely move the mouse under X. Yet switching VC's or
    toggling a keyboard LED is instantaneous (Stuck in console_bh?). It is not
    an "out of RAM" issue, I can assure you of that. The same program can be
    run in an xterm with no effect. System is 2.0.7-aout with gcc2.7.2-aout
    and libc-4.7.5. No little elves in sight. I don't have the time to chase
    the source of the problem down at the moment, but sending large blocks
    of nulls to the console driver via stdout seems to do bad things.

    #include <sys/types.h>
    #include <unistd.h>
    #include <fcntl.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>

    void main(int argc, char **argv) {

    int count=atoi(argv[1]);
    char buf[1024*1024];

    memset(buf, 0, 1024*1024);
    fprintf(stderr,"Writing %d 1MB blocks of nulls to stdout\n",count);
    while (count--)
    write(1, buf, 1024*1024);

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