Date: Thu, 12 Nov 2015 18:25:58 +0200 From: Achilleas Mantzios <achill@matrix.gatewaynet.com> To: freebsd-java@freebsd.org Subject: Re: Thread.sleep is very incorrect on kern.hz FreeBSD-10 + openjdk8. Message-ID: <5644BD96.9000005@matrix.gatewaynet.com> In-Reply-To: <5644BB9A.4060807@smartspb.net> References: <5644BB9A.4060807@smartspb.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On 12/11/2015 18:17, Sergey Potapov wrote: > Hello! > > FreeBSD-10.1 without tunning. > openjdk8 without tunning (pkg install). > > > Thread.sleep depends on kern.hz sysctl variable. > > Simple program and more detailed version information attched. > openjdk7 tested with kern.hz=2000 -- same results. > > kern.hz: 100 > > 1000 times Thread.sleep(1) 19994 milliseconds > 1000 times Thread.sleep(2) 19997 milliseconds > 1000 times TimeUnit.MICROSECONDS.sleep(100) 20000 milliseconds > > kern.hz: 1000 > > 1000 times Thread.sleep(1) 2002 milliseconds > 1000 times Thread.sleep(2) 3000 milliseconds > 1000 times TimeUnit.MICROSECONDS.sleep(100) 2001 milliseconds > > > kern.hz: 2000 > > 1000 times Thread.sleep(1) 1500 milliseconds > 1000 times Thread.sleep(2) 2500 milliseconds > 1000 times TimeUnit.MICROSECONDS.sleep(100) 1500 milliseconds > How about using even larger values for kern.hz ? > Linux and Windows are much better (but don't support anything less 1ms too). > > Linux: > > sysctl: cannot stat /proc/sys/kern/hz: No such file or directory. > > 1000 times Thread.sleep(1) 1077 milliseconds > 1000 times Thread.sleep(2) 2078 milliseconds > 1000 times TimeUnit.MICROSECONDS.sleep(100) 1079 milliseconds > > Windows (with sysctl command removed): > > 1000 times Thread.sleep(1) 1002 milliseconds > 1000 times Thread.sleep(2) 2000 milliseconds > 1000 times TimeUnit.MICROSECONDS.sleep(100) 1002 milliseconds > > -- > Sergey Potapov. > > > > > _______________________________________________ > freebsd-java@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-java > To unsubscribe, send any mail to "freebsd-java-unsubscribe@freebsd.org" -- Achilleas Mantzios IT DEV Lead IT DEPT Dynacom Tankers Mgmt
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5644BD96.9000005>