JVM Specification
·
A
language is platform independent if it does not have any dependency on the
operating system.
Usually dependency on the O/S is
created:-
Ø At the time of
development by invoking O/S library functions from the application,
Ø At the time of
compilation by following O/S specific format in compiled code, and
Ø At the time of
execution by using the O/S for launching the application.
That is, a Language is platform
independent if:-
Ø It is compiled in a
platform neutral manner.
Ø Language provides its
own runtime environment for the execution of its application.
Ø Language provides a
comprehensive library for the application developers to develop all types of
application without using the O/S concern.
Question:-
Due to security.
Figure 1 is compiler-based program which directly calls O/S
functions during execution.
Figure 2 is interpreter-based program which is executed by
JRE. Java application has no direct connectivity with O/S.
JRE checks whether the application is violating any rules already
mentioned in JRE or not. Thus it is a secured application than any other
language’s application.
- SUN, IBM
and Oracle did some Research & Development on JIT regarding
performance tuning i.e. to increase the performance while interpreting the
byte code.
While the performance of interpreted bytecodes is usually more
than adequate, there are situations where higher performance is required.
The bytecodes can be translated on the fly (at run time) into machine code
for the particular CPU the application is running on.
If we
use an interpreter to execute the bytecodes, “high performance” is not the
term that we would use. However, on many platforms, there is also another
form of compilation, the justin-time (JIT) compilers. These work by compiling the bytecodes into
native code once, caching the results, and then calling them again if
needed. This approach speeds up commonly used code tremendously since one
has to do the interpretation only once. Although still slightly slower than
a true native code compiler, a just-in-time compiler can give us a 10- or
even 20-fold speedup for some programs and will almost always be
significantly faster than the Java interpreter. This technology is being
improved continuously and may eventually yield results that cannot be
matched by traditional compilation systems. For example, a justin-time
compiler can monitor which code is executed frequently and optimize just
that code for speed.
|
See the figure
below to understand this concept.
No comments:
Post a Comment