This content has been marked as final. Show 3 replies
Threads that are waiting for I/O, or doing wait()/notify(), or Thread.sleep(), do not consume CPU time. (Assuming a normal, non-silly operating system.)
Threads do consume memory. Each thread needs a stack, and the operating system kernel may have non-pageable data structures for each thread.
I would try to re-think the program design rather than have thousands of threads. I've seen bad things start to happen at less than 1000 threads on a common operating system.