[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

100% cpu with: while true ;do read < /dev/null ;done

From: Jo King
Subject: 100% cpu with: while true ;do read < /dev/null ;done
Date: Wed, 21 Oct 2009 21:15:29 +0000 (GMT)

Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' 
-DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -g -O2
uname output: Linux puppypc #1 SMP Tue Sep 1 15:48:26 GMT-8 2009 i686 
Machine Type: i686-pc-linux-gnu

Bash Version: 3.2
Patch Level: 48
Release Status: release

        [See subject for test case. 
Many scripts sit in a loop asking for user input - if script is
run in bg/without tty (by mistake) then high cpu usage results]

        [while true ;do read </dev/null ;done]

        [ bash/the read code could
 detect there's no stdin and sleep for 1-2 seconds]

reply via email to

[Prev in Thread] Current Thread [Next in Thread]