Solved

Flavors of JVM

Posted on 2014-03-25
4
346 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
  • 2
  • 2
4 Comments
 
LVL 35

Expert Comment

by:mccarl
Comment Utility
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
Comment Utility
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 35

Accepted Solution

by:
mccarl earned 500 total points
Comment Utility
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
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
SPLUNK REST  API call to Splunk to create and index? 2 65
IT Company 5 67
Modeling a class in java 5 31
create a gui in perl 3 42
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now