Lautaro Cozzani
Lautaro Cozzani

Reputation: 1808

Can Runtime.getRuntime().availableProcessors() return 0?

Is there a particular condition in which Runtime.getRuntime().availableProcessors() returns 0? Maybe when all proccessors are busy?

Upvotes: 1

Views: 1893

Answers (2)

Nick Bartlett
Nick Bartlett

Reputation: 4975

No. According to the docs, Runtime.availableProcessors() can never return less than one.

Returns: The maximum number of processors available to the virtual machine; never smaller than one

https://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#availableProcessors()

Upvotes: 1

jaco0646
jaco0646

Reputation: 17144

No.
http://docs.oracle.com/javase/8/docs/api/java/lang/Runtime.html#availableProcessors--

"the maximum number of processors available to the virtual machine; never smaller than one"

Upvotes: 2

Related Questions