Wednesday, June 27, 2012

Technical Tips-1 About Java Version

To Check the Java Version in Your System Run The Following Command in Command Line or Terminal

java -version    java version "1.6.0_26"  Java(TM) SE Runtime Environment (build 1.6.0_26-b03)  Java HotSpot(TM) Server VM (build 20.1-b02, mixed mode)    
Notes:
Hotspot Virtual Machine
Both the client and server Hotspot compilers are included in the Java Runtime Environment.
By default the client compiler is enabled, but for intense server-side applications, you can run the server compiler with the -server runtime option. The Hotspot virtual machine normally runs in a mixed mode, as seen in the -version output. Mixed mode means Hotspot dynamically compiles Java bytecodes into native code when a number of criteria have been met, including the number of times the method has been run through the interpreter. Mixed runtime mode normally results in the best performance.

About Linux Threads

One major difference between developing on Linux from other Unix operating systems is the system threads library. In Java 2 releases prior to 1.3, the Java virtual machine uses its own threads library, known as green threads, to implement threads in the Java platform. The advantage here is that green threads minimize the Java virtual machine's exposure to differences in the Linux threads library and makes the port easier to complete. The downside is that using green threads means system threads on Linux are not taken advantage of and so the Java virtual machine is not scalable when additional CPUs are added.
In Java 2 Release 1.3, the Hotspot virtual machine uses system threads to implement Java threads. Because Linux threads are implemented as a cloned process, each Java thread shows up in the process table if you run the ps command. This is normal behavior on Linux.
java -jar Notepad.jar  ps -eo pid,ppid,command       PID  PPID COMMAND                              11667 28367 /usr/java/jdk1.3/bin/i386/native_threads/java -jar Notepad.jar  11712 11667 /usr/java/jdk1.3/bin/i386/native_threads/java -jar Notepad.jar     11713 11712 /usr/java/jdk1.3/bin/i386/native_threads/java -jar Notepad.jar  11714 11712 /usr/java/jdk1.3/bin/i386/native_threads/java -jar Notepad.jar  11715 11712 /usr/java/jdk1.3/bin/i386/native_threads/java -jar Notepad.jar  11716 11712 /usr/java/jdk1.3/bin/i386/native_threads/java -jar Notepad.jar  11717 11712 /usr/java/jdk1.3/bin/i386/native_threads/java -jar Notepad.jar  11718 11712 /usr/java/jdk1.3/bin/i386/native_threads/java -jar Notepad.jar  11722 11712 /usr/java/jdk1.3/bin/i386/native_threads/java -jar Notepad.jar  11723 11712 /usr/java/jdk1.3/bin/i386/native_threads/java -jar Notepad.jar  11724 11712 /usr/java/jdk1.3/bin/i386/native_threads/java -jar Notepad.jar  11726 11712 /usr/java/jdk1.3/bin/i386/native_threads/java -jar Notepad.jar  

In the above listing, the process ID 11712 shown in the left-most PID column is the invoked Java virtual machine. The other processes that show process ID 11712 in the PPID column have process ID 11712 as their parent process. These children to process ID 11712 are Java threads implemented by the Linux system threads library. Each Linux thread is created as a process clone operation, which leaves the scheduling of threads to be a task of the process scheduler.
By comparison, on Solaris the Java threads are mapped onto user threads, which in turn are run on Lightweight processes (LWP). On Windows the threads are created inside the process itself. For this reason, creating a large number of Java threads on Solaris and Windows today is faster than on Linux. This means you might need to adjust programs that rely on platform-specific timing to take a little longer on startup when they run on Linux.
Thanks 


No comments:

Post a Comment