[concurrency-interest] Latency in starting threads

Aleksey Shipilev aleksey.shipilev at oracle.com
Tue Apr 16 09:06:53 EDT 2013


On 04/16/2013 04:54 PM, Dr Heinz M. Kabutz wrote:
> The question that I wanted to
> answer was: How many microseconds does it take on average to start a
> simple thread and what is the maximum time it could take?

We even have the related sample for this, as if this is a major
benchmarking pain point in many concurrent benchmarks:

http://hg.openjdk.java.net/code-tools/jmh/file/tip/jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_07_FixtureLevelInvocation.java

> java version "1.7.0_06"
> heinz$ java ThreadLeakMac2
> time = 1, threads = 6
> time = 2, threads = 256
> time = 6, threads = 373
> *snip*
> time = 111, threads = 42592
> time = 200, threads = 49419
> time = 333, threads = 58976
> *snip*
> time = 3245, threads = 202336
> time = 3706, threads = 203702
> *snip*
> time = 5835, threads = 267872
> time = 6455, threads = 269238
> time = 9170, threads = 270603

This looks suspiciously as if some internal data structure holding the
threads (not cleaned up properly), and we traverse it linearly. I wonder
if that is at OS scheduler side, since Linux is not affected.

-Aleksey.


More information about the Concurrency-interest mailing list