This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Can I know and regulate the thread-mode of JVM?  RSS feed

 
Li Shangqiang
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can i know the JVM use green thread or native thread?
Can i regulate the JVM to use a specific thread-mode?
 
Yuri Gadow
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is implementation specific. Some VMs are constrained to a specific type, others do both (Linux and SCO for instance.) Check the implementation documentation for the command line arguments to switch. You will not, I don't think, have a standard way to access this from within the JVM, though a VM may provide read-only access to it via System.properties().
 
Li Shangqiang
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have know that if the VM use green thread, then the application in Java can't benefit from Multi-CPU, but if the VM use native thread, then the application can make use of Multi-CPU. But, I'm very confused that i can't know anything from the VM that if it is using native thread mode. Can Yuri Gadow or other give me a more clear answer?
 
Yuri Gadow
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The point is just that you will have to look in the documentation for the specific VM implementation you are using to find out which is used. Most current VM's use native threads, but some provide both if the native implementation is considered flaky. I've never payed any attention to green threads, so I couldn't say if threads can be scheduled across CPU's in "green mode" or not. But it would certainly make sense if that were the case.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!