Can't get past 2542 Threads in Java on 4GB iMac OSX 10.6.3 Snow Leopard (32bit)

前端 未结 4 1989
天命终不由人
天命终不由人 2020-11-30 10:34

I am running the following program trying to figure out how to configure my JVM to get the maximum number of threads my machine can support. For those that might not know, S

4条回答
  •  南方客
    南方客 (楼主)
    2020-11-30 11:27

    Do you think you will have these much thread concurrently up to 1 hour? I don't think so. I have worked in application which processed hundreds of documents, convert them from and to diff. format, generates proper logs in DB and stores specific info also. Then also it finished in seconds.

    The thing you should take care about it, code wisely to avoid making too much threads. Instead use a ThreadPool provided by Java, so that same threads can be utilized when needed. that will provide better performance. Also keep synchronization on minimal blocks to avoid bottle necks in your execution.

    thanks.

提交回复
热议问题