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

Automatic Multi-Threading  RSS feed

 
Scott Selikoff
author
Bartender
Posts: 4087
21
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a multiple processor environment, will the JVM of an application ever allow non-multi-threaded applications to utilize both processors for any or all tasks at the same time?

I was noticing some old C++ code I had from years back ran completely at 50% CPU utilization on a dual core system (not surprising) and I was wondering if the same would be true of most java applications, or whether the JVM implementation might allow it to sometimes go over this value such as during object creation or file reading/writing. Any thoughts?
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well for starters the JVM has several management threads. So when you run a Java program with a "Standard Edition" JVM you are always running a multi-threaded program.

If your program has a GUI, thats another thread. However, if its a basic single threaded written program, the core of your program will run on only one thread at a time. So no, there will be no concurrency unless you design it in.

C++ is different in that you don't get any free services like GC.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!