From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,c5f9e99c31349bda,start X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1994-03-03 09:19:36 PST Path: gmd.de!xlink.net!howland.reston.ans.net!pipex!uunet!Germany.EU.net!Munich.Germany.EU.net!sekas.de!sparc!bip From: bip@sekas.de (Paul Bininda) Newsgroups: comp.unix.osf.osf1 Subject: init cpu usage around 50% Message-ID: Date: 3 Mar 94 17:19:36 GMT Sender: bip@sekas.de Nntp-Posting-Host: alfalfa Something very strange is going on on my Alpha (OSF1 V1.3 111). It seems, the init process gets a SIGCHLD whenever the Bourne shell opens a pipe. It then re-reads the /etc/inittab. I have found this using the trace command: $ trace -p 1 in one terminal window and saying $ echo | echo in another. The following is the output from the trace command (the arrow indicates where we are before issuing the command in sh:) | ... v sigsuspend (0x0) = -1, (Interrupted system call) SIGNAL [20 SIGCHLD] wait4 (-1, 0x11ffff6a0, 1, 0x0) = 2248 wait4 (-1, 0x11ffff6a0, 1, 0x0) = 0 sigreturn (0x11ffff6f8) sigprocmask (3, 0x0, 0x0) = -65793 open ("/etc/inittab", O_RDONLY, 0666) = 0 ioctl (0, 1074164744, 0x11ffff398) = -1, (Not a typewriter) read (0, 0x4000ddc0, 8192) = 2320 [, "# \n# ***********************************" ..., ] read (0, 0x4000ddc0, 8192) = 0 [, "", ] lseek (0, 0, SEEK_CUR) = 2320 close (0) = 0 open ("/etc/inittab", O_RDONLY, 0666) = 0 ioctl (0, 1074164744, 0x11ffff3b8) = -1, (Not a typewriter) read (0, 0x4000ddc0, 8192) = 2320 [, "# \n# ***********************************" ..., ] read (0, 0x4000ddc0, 8192) = 0 [, "", ] lseek (0, 0, SEEK_CUR) = 2320 close (0) = 0 sigprocmask (3, 0xffffffffffffffff, 0xffffffffffffffff) = 0 sigsuspend (0x0) = The interesting thing is, that only sh shows this behavior. When I use bash, csh or ksh instead, init remains quiet. What is going on? What started to make me curious, was a cpu usage of over 50% for the init process whenever I use a software package which makes heavy use of shell scripts in some phases. I am now dreaming, that this funny behavior is a bug which will be fixed soon and that my software package will then execute twice as fast. If you do not have the trace program you can at least see init working itself to death with the syd command from the freeware disk. Start syd in one terminal window and issue the following sh command in another: $ while true; do echo | echo >/dev/null; done In the syd output I typically get: PID USERNAME NI BP PR S SLP VSZ RSS SYSTEMTIME USERTIME CPU COMMAND 1 root 0 44 51 R 0 552K 480K 1.423 21.593 41% init 7401 bip 0 44 50 R 0 1960 296K 2.229 0.038 32% sh 0 root 0 32 32 R 0 289M 12M 4687.357 0.000 13% 2332 bip 0 44 45 R 0 2040 656K 10.356 4.700 4% syd ... (you may notice, that the accumulated CPU time for init is relatively low. This is because I just rebooted the machine in the hope that the problem would go away.) Can anybody reproduce this behavior? Is it a bug that will be fixed or is it something completely normal that is explained on page 10 of "UNIX for Beginners"? I am looking forward to some comments. Paul -- -- ----- Paul Bininda ----- bip@sekas.de