Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Oct 2012 12:53:49 +0300
From:      "Jukka A. Ukkonen" <jau@iki.fi>
To:        ports@FreeBSD.org
Subject:   simh-3.9.0 is busy looping
Message-ID:  <507A8BAD.5070803@iki.fi>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?507A8BAD.5070803>