Number of concurrent threads with ZGC

Per Liden per.liden at
Tue Oct 1 09:10:21 UTC 2019


The number of ZWorkers started is max(ParallelGCThreads, ConcGCThreads). 
This set of worker threads is then used for both stop-the-world 
operations and for concurrent operations. But if ConcGCThreads < 
ParallelGCThreads, then only a subset of the ZWorkers are used in 
concurrent GC operations.

The number of ZRuntimeWorkers started is ParallelGCThreads. These 
threads are not really involved in GC work. Instead they help out doing 
various safepoint cleanup tasks (deflate monitors, cleans various data 
structures, etc).

If you use -Xlog:gc+init (or -Xlog:gc*), then ZGC will at startup print 
number of threads configured for various tasks.


On 9/30/19 8:12 PM, Sundara Mohan M wrote:
> Hi,
>     When i configure my concurrent gc thread count as 5 using
> -XX:ConcGCThreads=5.
> I still see 40 threads (thread named ZWorkers, 40 is my cpu count) are
> running in jvm.
> Also i see 40 RuntimeWorkers thread running (assuming this is for
> concurrent processing).
> Assuming "ZWorkers" thread for concurrent processing and "RuntimeWorkers"
> for parallel processing or stw phase threads. Looks this assumption is not
> correct.
> Can you help me understand why we create more than 5 "ZWorkers" if i
> configure my concurrent thread count is 5.
> Sundar

More information about the zgc-dev mailing list