Having threads around is not "expensive." Of course, it depends on what we are talking about here. I suspect billions of threads will be a problem. I think that in general, having a large number of threads is considered expensive, because you can do more parallel work, so the processor rises, memory rises, etc. But if they are managed correctly (for example, to protect system resources), this is normal. The JVM does not necessarily use native threads, so a Java thread does not necessarily map to OS native threads (for example, look at green threads, for example, or light threads). In my opinion, there are no indirect threading costs in the JVM. Cost comes from poor flow management and overuse of resources, carelessly assigning jobs to them.
mprivat
source share