Solved

Flavors of JVM

Posted on 2014-03-25
4
413 Views
Last Modified: 2014-04-24
Hi,

I read there are two flavors of JVM one is client mode and other is server mode.

I would like to know advantages, disadvantage, practical uses of each of them.

please advise
Any links resources ideas highly appreciated. Thanks in advance
0
Comment
Question by:gudii9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 36

Expert Comment

by:mccarl
ID: 39954789
one is client mode and other is server mode
Essentially, the difference between the two is in how your code gets optimized. Optimization can occur in different ways, in order to maximise different things.

client mode assumes that the application is something that an actual user is running and interacting with as so it will optimize for the fastest possible response time, ie. get something in front of the users face as quick as possible, this might be at the expense of a slower total time to process (or whatever the app is doing). This is useful as generally a human will perceive this faster response time as better overall performance, even if it does take a little longer.

server mode assumes that the application is something that might be sitting in the background, maybe doing something like a batch job, etc. For this, response time means little and so the code will be optimized for the best overall total time to process. For example, it may take a little bit longer to start the application, so that it can get everything set up so that the actually batch run completes in the fastest total time.


http://www.oracle.com/technetwork/java/hotspotfaq-138619.html#compiler_types


One thing that I would add though, in most real world applications, I highly doubt that you would see much difference at all between the two.
0
 
LVL 7

Author Comment

by:gudii9
ID: 40005301
how do i know which mode my jvm is running. How  to switch from one mode to other mode on my laptop jvm. please advise
0
 
LVL 36

Accepted Solution

by:
mccarl earned 500 total points
ID: 40005618
how do i know which mode my jvm is running
Well, the link that I provided in my first post should have given you some pretty good hints but to make it explicit... If you are on 32-bit windows and have only installed the JRE (not the JDK) then you only have the "client" mode available to you. For other cases, it is not quite as clear, but you can find out what mode is used by default in YOUR environment, by just running "java -version". In the resulting output, you will see something like "Java HotSpot(TM) Client VM ....." or "Java HotSpot(TM) Server VM .....", from which you can see what your default is.

How  to switch from one mode to other mode on my laptop jvm.
That JVM doesn't always run in one mode or the other, you can tell it which mode to start in when you start the JVM by specifying command line options. eg, if you use the following command line... "java -server -cp ..... MyMainClass" it will run your MyMainClass class using the Server VM. There is also a "-client" command line option to force the Client VM.

If you are talking about something that has a more advanced method of starting, ie. Eclipse is just started from an icon on your desktop, then these applications using have .ini files (or some other way to configure their startup) in which you can ususally specify command line options to be used when starting. It is here where you would use either -client or -server.

Also, see this link for some more reference information...
http://docs.oracle.com/javase/7/docs/technotes/guides/vm/
0
 
LVL 7

Author Comment

by:gudii9
ID: 40006909
If you are on 32-bit windows and have only installed the JRE (not the JDK) then you only have the "client" mode available to you.

how about 64 bit windows like my laptop. There also if only JRE isntalled mode is only 'client'
Please advise

I ran
java -version

i see server mode like below
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)

what is build and what is mixed mode as it showed.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question