({{, (RefLink[$KernelCount, paclet:ref/$KernelCount]) 
gives the number of subkernels available for parallel computations.}})

OpenersNotesSection(Spacer1)Details

(RefLink[$KernelCount, paclet:ref/$KernelCount]) is equivalent to (RefLink[Length, paclet:ref/Length])[(RefLink[Kernels, paclet:ref/Kernels])[]].

When evaluated in a subkernel of a particular master kernel, (RefLink[$KernelCount, paclet:ref/$KernelCount]) gives the number of subkernels available to the master kernel.

OpenersPrimaryExamplesSection(Spacer1)Examples  (3)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

$KernelCount

Kernels[]

OpenersExampleSection2(Spacer1)Applications  (1)

Run a search for a random prime on each parallel kernel:

With[{base=10^1000,r=10^10},WaitAll[Table[ParallelSubmit[
While[!PrimeQ[p=RandomInteger[{base,base+r}]],Null];p],{$KernelCount}]]-base]

OpenersExampleSection3(Spacer1)Properties & Relations  (1)

(RefLink[$KernelCount, paclet:ref/$KernelCount]) is effectively a shared variable:

$KernelCount

ParallelEvaluate[$KernelCount]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Kernels, paclet:ref/Kernels])  ▪  (RefLink[LaunchKernels, paclet:ref/LaunchKernels])  ▪  (RefLink[CloseKernels, paclet:ref/CloseKernels])  ▪  (RefLink[$ProcessorCount, paclet:ref/$ProcessorCount])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Parallel Computing, paclet:guide/ParallelComputing])}, {▪(RefLinkPlain[Parallel Computation Setup & Configuration, paclet:guide/ParallelComputationSetupAndConfiguration])}, {▪(RefLinkPlain[Concurrency, paclet:guide/Concurrency])}})}})