From owner-freebsd-ports@FreeBSD.ORG Sun Oct 14 09:54:07 2012 Return-Path: Delivered-To: ports@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 19981AF6 for ; Sun, 14 Oct 2012 09:54:07 +0000 (UTC) (envelope-from jau@iki.fi) Received: from jau.iki.fi (ip193-64-26-117.cust.eunet.fi [193.64.26.117]) by mx1.freebsd.org (Postfix) with ESMTP id 607CA8FC0C for ; Sun, 14 Oct 2012 09:54:04 +0000 (UTC) Received: from [192.168.1.131] (sleipnir.thunderbolt.fi [192.168.1.131]) by jau.iki.fi (8.14.5/8.14.5) with ESMTP id q9E9rsZ6020949 for ; Sun, 14 Oct 2012 12:53:57 +0300 (EEST) (envelope-from jau@iki.fi) Message-ID: <507A8BAD.5070803@iki.fi> Date: Sun, 14 Oct 2012 12:53:49 +0300 From: "Jukka A. Ukkonen" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:16.0) Gecko/20121013 Thunderbird/16.0.1 MIME-Version: 1.0 To: ports@FreeBSD.org Subject: simh-3.9.0 is busy looping Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.7 (jau.iki.fi [192.168.1.42]); Sun, 14 Oct 2012 12:53:57 +0300 (EEST) X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Oct 2012 09:54:07 -0000 Howdy, It seems that simh-3.9.0 is busy looping and as a result also hogs one CPU to the max and prevents the system lowering the CPU clock frequency when there is actually nothing to do. According to ps the simh vax emulator runs in 3 thread contexts one of which is constantly accumulating CPU time while there is no activity in the emulated VAX environment as all. (sleipnir:pts/0) 12:17 /usr/src# ps -lxH -p 26474 UID PID PPID CPU PRI NI VSZ RSS MWCHAN STAT TT TIME COMMAND 0 26474 25489 0 30 10 97276 53044 select SN+ 1 0:00.04 vax netbsd-boot 0 26474 25489 0 30 10 97276 53044 uwait IN+ 1 0:00.00 vax netbsd-boot 0 26474 25489 0 113 10 97276 53044 - RN+ 1 10:30.87 vax netbsd-boot To see the system calls involved and the frequency how often they are called I tried "truss -dp 26474" which showed me an endless stream of this... 0.767961184 read(0,0x7fffffffb5a7,1) = 0 (0x0) 0.777930338 read(0,0x7fffffffb5a7,1) = 0 (0x0) 0.787928823 read(0,0x7fffffffb5a7,1) = 0 (0x0) 0.798066631 read(0,0x7fffffffb5a7,1) = 0 (0x0) 0.808115468 read(0,0x7fffffffb5a7,1) = 0 (0x0) 0.818127641 read(0,0x7fffffffb5a7,1) = 0 (0x0) 0.828177944 read(0,0x7fffffffb5a7,1) = 0 (0x0) 0.838150031 gettimeofday({1350206997.452731 },0x7fffffffb590) = 0 (0x0) 0.838251712 read(0,0x7fffffffb5a7,1) = 0 (0x0) 0.848100120 read(0,0x7fffffffb5a7,1) = 0 (0x0) 0.857971503 read(0,0x7fffffffb5a7,1) = 0 (0x0) 0.866981530 select(7,{6},0x0,0x0,{0.250000 }) = 0 (0x0) 0.868017407 read(0,0x7fffffffb5a7,1) = 0 (0x0) 0.877921055 read(0,0x7fffffffb5a7,1) = 0 (0x0) 0.887809548 read(0,0x7fffffffb5a7,1) = 0 (0x0) 0.897808033 read(0,0x7fffffffb5a7,1) = 0 (0x0) 0.907802119 read(0,0x7fffffffb5a7,1) = 0 (0x0) 0.917770784 read(0,0x7fffffffb5a7,1) = 0 (0x0) 0.927764869 read(0,0x7fffffffb5a7,1) = 0 (0x0) 0.937774109 read(0,0x7fffffffb5a7,1) = 0 (0x0) 0.947755973 read(0,0x7fffffffb5a7,1) = 0 (0x0) 0.957762280 read(0,0x7fffffffb5a7,1) = 0 (0x0) This looks very much like the busy looping thread is repeating polling/non-blocking read to wait for some event. I can only imagine that there could be far better methods to wait for almost anything. (kqueue, linux epoll, even a blocking read or timed select, if blocking is not an option) I hope this helps. --jau