Java Architecture Features and TradeOff's
Java has become a very popular programming language due to its capability of executing the program on any machine irrespective of where its compilation is being done.There are three main features offered by Java Architecture.
The support for platform Independence is spread across all four components of the Java architecture.All these components were told in previous tutorial.
The Java platform:- The Java platform insulates the Java program from the hardware and operating system on the target machine.Java program are compiled to execute on the JVM.The Java API enables programs to use system resources.All Java program can only interact with the JVM,that is why it can be executed on any machine that hosts JVM.
The Java Language:- The Java Language defines the range and behaviour of primitive data types.For example in C and C++ ,the target machine platform determines the size of the data types.For Example int in C and C++ may occupy 2 bytes in one platform and 4 bytes in the other.This results in unpredictable results across the various platforms.But in Java ,the primitive data type are the same across all platforms.This is all due to the JVM.Since JVM uses the data types defined by the language and therefore,the data type behaviour remains same on all platforms .
The Java class file:-The Java class file is a binary standard for files that can be executed by the JVM.The bytecode(class file) which is produced after compilation is platform independent.
NOTE:-There are specifications that you can use native libraries in Java but using Native methods affects the platform independence of Java.If a Java program invokes a native method,the program becomes platform specific.Native methods are used when the certain conditions are there:-
Security:-Java is perfect language for networks.Any network-oriented software must deal with security.Java's security model makes it appropriate for network-oriented programming.Java code is loaded, for example an applet loaded by a browser may contain a virus or malicious code.Java protects its end users from such threats by using a sandbox model.
There are some restrictions imposed on untrusted code(applet)
The Java Sandbox:- The sandbox allows code to be downloaded from any source but imposing some restrictions on it.A Java sandbox is an area in memory outside which the Java programs cannot make calls .This prevents Java programs from being able to call low level system functions that may cause data corruption or other damages.The Java
Sandbox has three components:-
1.The ByteCode Verifier:-The first level of Java security is Bytecode verifier.The bytecode is verified before it is allowed to run on the users machine.It is checked to authenticate its creation by a Java compiler.ByteCode verifier make sure that the format of the bytecode fragment is correct.A algorithm is applied to chck that the bytecode does not violate access restrictions or try to access object using incorrect or bad information.The bytecode verification is done in two phases .In first phase the verifier checks for the validity of the bytecode when it is loaded,this is done by checking the structure of the .class file.In second phase verifier checks for the validity of the classes,the variables,and the methods used in the program.This is done because Java programs are dynamically linked.
2.The Applet Class Loader :-The second level of security is in the applet call loader.All java objects belong to classes and the applet class loader determines how and when an applet is allowed to add classes to a running Java environment.It also makes sure that important parts of JRE are not replaced by any applet code.
3.The Security Manager:-The third and most important level of Java sandbox,is security manager.The security manager defines the boundary of a sandbox.The Java API refers to the security manager before it allows any access to resource.While loading classes ,the class loaded always follow the security managers decisions.Built-in classes are given preferences over classes loaded over the Network.This sandbox can be used to run untrusted code on the user's machine.
NOTE:-
Java Protected Domain:- It is an extension of Java sandbox in a file system.Java protected domains enable use of permissions for providing access to function calls outside the sandbox.
Network mobility:-Java offers platform independence and security two essential parameters that make a program network-oriented.One program can serve the entire network that comprises of machines using different operating systems.
Another issue in network mobility is amount of time it take to download a program for the network.As Java is dynamically linked,you need not wait for all the .class files to be loaded before you execute a program.The .class file is compact and travels quickly across the network.Only classes that are used in the course of the program execution are downloaded.Class loaders also help in extending the program dynamically.
Java Architecture Trade off
Java offers many features for a networked programmer.The price paid for these feature is a trade off on the execution speed of Java programs.It is well known that C++ programs are faster than Java programs due to following reasons:-
<
Java Architecture
Earn money Quick
Open your Online Store now!!!!
- Platform Independence.
- Security.
- Network Mobility.
The support for platform Independence is spread across all four components of the Java architecture.All these components were told in previous tutorial.
The Java platform:- The Java platform insulates the Java program from the hardware and operating system on the target machine.Java program are compiled to execute on the JVM.The Java API enables programs to use system resources.All Java program can only interact with the JVM,that is why it can be executed on any machine that hosts JVM.
The Java Language:- The Java Language defines the range and behaviour of primitive data types.For example in C and C++ ,the target machine platform determines the size of the data types.For Example int in C and C++ may occupy 2 bytes in one platform and 4 bytes in the other.This results in unpredictable results across the various platforms.But in Java ,the primitive data type are the same across all platforms.This is all due to the JVM.Since JVM uses the data types defined by the language and therefore,the data type behaviour remains same on all platforms .
The Java class file:-The Java class file is a binary standard for files that can be executed by the JVM.The bytecode(class file) which is produced after compilation is platform independent.
NOTE:-There are specifications that you can use native libraries in Java but using Native methods affects the platform independence of Java.If a Java program invokes a native method,the program becomes platform specific.Native methods are used when the certain conditions are there:-
- The resources of the machine cannot be accessed through Java API.
- A set of methods exists in non-Java API.
- The speed of the program needs to be increased.
Security:-Java is perfect language for networks.Any network-oriented software must deal with security.Java's security model makes it appropriate for network-oriented programming.Java code is loaded, for example an applet loaded by a browser may contain a virus or malicious code.Java protects its end users from such threats by using a sandbox model.
There are some restrictions imposed on untrusted code(applet)
- It cannot neither read nor write the local files.
- It can make a connection only to the machine from where it was downloaded.
- It cannot load new dynamic linked libraries.
- It cannot call a native method.
The Java Sandbox:- The sandbox allows code to be downloaded from any source but imposing some restrictions on it.A Java sandbox is an area in memory outside which the Java programs cannot make calls .This prevents Java programs from being able to call low level system functions that may cause data corruption or other damages.The Java
Sandbox has three components:-
1.The ByteCode Verifier:-The first level of Java security is Bytecode verifier.The bytecode is verified before it is allowed to run on the users machine.It is checked to authenticate its creation by a Java compiler.ByteCode verifier make sure that the format of the bytecode fragment is correct.A algorithm is applied to chck that the bytecode does not violate access restrictions or try to access object using incorrect or bad information.The bytecode verification is done in two phases .In first phase the verifier checks for the validity of the bytecode when it is loaded,this is done by checking the structure of the .class file.In second phase verifier checks for the validity of the classes,the variables,and the methods used in the program.This is done because Java programs are dynamically linked.
2.The Applet Class Loader :-The second level of security is in the applet call loader.All java objects belong to classes and the applet class loader determines how and when an applet is allowed to add classes to a running Java environment.It also makes sure that important parts of JRE are not replaced by any applet code.
3.The Security Manager:-The third and most important level of Java sandbox,is security manager.The security manager defines the boundary of a sandbox.The Java API refers to the security manager before it allows any access to resource.While loading classes ,the class loaded always follow the security managers decisions.Built-in classes are given preferences over classes loaded over the Network.This sandbox can be used to run untrusted code on the user's machine.
NOTE:-
Java Protected Domain:- It is an extension of Java sandbox in a file system.Java protected domains enable use of permissions for providing access to function calls outside the sandbox.
Network mobility:-Java offers platform independence and security two essential parameters that make a program network-oriented.One program can serve the entire network that comprises of machines using different operating systems.
Another issue in network mobility is amount of time it take to download a program for the network.As Java is dynamically linked,you need not wait for all the .class files to be loaded before you execute a program.The .class file is compact and travels quickly across the network.Only classes that are used in the course of the program execution are downloaded.Class loaders also help in extending the program dynamically.
Java Architecture Trade off
Java offers many features for a networked programmer.The price paid for these feature is a trade off on the execution speed of Java programs.It is well known that C++ programs are faster than Java programs due to following reasons:-
- Interpreting bytecode is slower than executing the machine code for C++.
- Checks on array bounds are made for each and every array.
- The garbage collector needs to be more efficient and faster than it is at present.
- Java programs are dynamically linked and therefore,the programs has to wait for bytecode to get downloaded.
- All the variables are checked for types at runtime.
<
Java Architecture
Earn money Quick
Open your Online Store now!!!!


















0 comments:
Post a Comment
Post a Comment