Tuesday 25 February 2014

Why not to use + operator for String concatenation ?

It is not a good practice to use + operator for string concatenation because of performance overhead.

For example :--

String fruit  = "Apple";

fruit = fruit + "world";

As Strings are Immutable so either StringBuffer (JDK 1.4) or StringBuilder (JDK 5.0) objects are created internally to perform this concatenation.

When +  used for String concatenation, following steps happens internally for above example :--

1. StringBuffer (JDK 1.4)/StringBuilder (JDK 5.0) object is created internally.
2. "Apple" String  referenced by fruit is copied to newly created StringBuffer/StringBuilder object.
3. Then "world" String is appended to above StringBuilder/StringBuffer object.
4. The result is converted back to String object.
5. fruit reference is made to point to that new String.
6. Old String that fruit references earlier is made NULL.

 Hence a single concatenation using + operator involves uses so many steps, hence it is considered a performance hit. Instead of using + operator, use concat() method.
   

Monday 24 February 2014

Object Oriented Paradigm

Object Oriented Programming (OOP) is an programming paradigm/ approach for program organization and development, which attempts to eliminate some of the drawbacks of conventional programming methods by incorporating the best of structured programming features with several new concepts.
OOP allows us to decompose a problem into number of entities called objects and then build data and methods (functions) around these entities.The data of an object can be accessed only by the methods associated with the object. 
 
Objects correspond to things found in the real world which have state (data) and behavior (methods). Objects, are usually instances of classes, are used to interact with one another to design applications and computer programs. 
C++, Java, PHP, Ruby , Python, Perl are common object oriented languages.
Object interaction diagram :--

Below are the key points related to OOPs:--
1. Programs are divided into objects.
2. Emphasis is on data rather than procedure. 
3. Data Structures are designed such that they characterize the objects. 
4. Methods that operate on the data of an object  are tied together in the data structure.
5. Data is hidden and can not be accessed by external functions. 
6. Objects may communicate with each other through methods.

Object Oriented concepts are :--

1. Class
2. Objects
3. Encapsulation
4. Abstraction
5. Polymorphism
6. Inheritance
7. Message passing.
 
The above object oriented concepts are discussed here.




 
 
 
 

Tuesday 18 February 2014

Why Strings are immutable in Java ?

As in Java, String literals are placed in String pool and whenever the compiler encounters a String literal, it checks the pool to see if an identical String already exists. If a match is found, the reference to the new literal is directed to the existing String, and no new String literal object is created and existing string has additional reference.

For example :--

String string1 = "abcd"; //This statement will keep a string literal in String pool on heap.

String string2 ="abcd"; // When this statement is executed, JVM again encountered a string literal, so JVM will check the pool to see if an an identical string literal already exist. In this case match is found. So instead of returning new reference, string2 variable holds the same reference as of string1 variable but string literal "abcd" has multiple references through string1, and string2.





As program grows, several references may refer to same string literal object in pool without knowledge of each other. If string is not immutable, changing the string with one reference will lead to the wrong value for the other references which might lead to undesired results.

Hence String was made immutable. String pool concept would not have been feasible if String were mutable. 
 


What is String Pool in Java ? Why String pool needed ?

In Java, String handling is based on a concept called string interning. I computer science, String Interning is a method of storing only a single copy of each distinct string value which must be immutable.

This single copy of each string is called "intern" and the distinct values are stored in a string pool. This method of string interning is supported by some modern object-oriented programming languages including Python, Ruby,Java, .NET, Smalltalk etc. 

String interning makes some string processing tasks more time- or space-efficient at the cost of requiring more time when the string is created.

String Pool

String pool a special memory area with in heap where all string literals are stored.When the compiler encounters a String literal, it checks the pool to see if an identical String already exists. If a match is found, the reference to the new literal is directed to the existing String, and no new String literal object is created and existing string has additional reference.

String  s1 =  "Hello";   //This statement will keep a string literal in String pool on heap.

String s2 = "Hello";  

When this statement is executed, JVM has again encountered a string literal, so JVM will check the pool to see if an an identical string literal already exist. In this case match is found, hence s2 will have same reference as of S1.  With this, "Hello" string literal has multiple references.
   
String s3= s1; //same reference

 

Now what will happen when String objects are created using new operator ?
 
String s4 = new String("Hello"); //String object created using new

String s5 =  new String("Hello");
As new operator always creates object on heap. In both these cases,each statement creates two String objects one in non pool area on heap and "Hello" string literal is also placed in pool also but only one reference is returned.


why String pool ?

String pool is used to make efficient use of memory and to speed up string related operations like String comparison. As applications grows, it's very common for String literals to occupy large
amounts of a program's memory, and there is often a lot of redundancy within the universe of String literals for a program. To make Java more memory efficient, the JVM sets aside a special area of memory called the "String constant pool."




 

 

Monday 17 February 2014

java.lang.String, StringBuffer and StringBuilder

String:

String objects are immutable. This means even if you have reference to any String object, contents of that object can't be modified or altered. If you perform any operation like concat(), replace (), substring() etc on String object, a new String  object reference is returned.

For example :--

String s = "abcd"; //a new String object is created with value "abcd" on string pool in heap. See below diagram:





Now lets do concat operation string object s which we created earlier.

s =  s.concat("ef");

Here on doing contact operation, a new object reference is returned with value "abcdef "and reference is assigned to s. Now s holds a reference to a new String object in String pool whose value is "abcdef" and earlier String literal is still present in String pool.

This means String objects are immutable means when ever you do any manipulation with Strings, result of that operation will always be a new String object. 

Points to Note:-

1.  Here String Object is immutable not the reference.

2. String class is made final to avoid String class being extended to override behavior of String methods.

3. String s  = new String("abcd");

This statement will create two String object. The new operator will create a new object in non pool area on heap and  literal "abcd"  will also be placed on String pool.
 

StringBuffer:

why StringBuffer class when Java  already have String class ?

As mentioned above, String class is immutable and if you need to do lots of manipulations with String objects, then lots of unused abandoned objects will be created in String pool. Hence StringBuffer is added. 

 StringBuffer objects are mutable, so they can be modified. StringBuffer class provides methods which can directly manipulate underlying string object. Hence, any manipulation of underlying string doesn't result in to creation of new String Object.

Points related to StringBuffer size :--

1. In general a StringBuffer object will be created with a default capacity of 16 characters.

StringBuffer sb =  new StringBuffer(); // 16 characters

2. We can set the size as :--

StringBuffer sb = new StringBuffer (30); //30 characters
In this case, StringBuffer object is created as an empty object with a capacity for storing 30 characters

Even if we declare the capacity as 30, it is possible to store more than 30 characters into StringBuffer. To store characters, we can use append () method as:
sb.append (“XYZSSS”);

StringBuffer is thread safe means, all the methods of StringBuffer are synchronized hence only one thread at a time can access the StringBuffer instance for manipulations.
  
StringBuilder:

StringBuilder was added in Java 1.5 to provide String manipulations as compared to StringBuffer.

StringBuilder has exactly same methods as StringBuffer class but these methods are not synchronized hence StringBuilder provides faster String manipulations.    

  



  


How to create Immutable objects in Java

We can divide objects broadly as mutable and immutable objects.

Mutable Objects:

Mutable objects are those objects whose contents can be modified. Means if you have reference of an object, contents of the object can be altered. For example:--

If we have a Person class with firstName, lastName fields and corresponding getter and setter methods and  constructor. Then we can create an instance as :

Person p = new Person("Baljeet", "Singh");  //Created a person object with first name and last name

Now we can alter the contents of instance p of Person class as below
p.setFirstName("XYZ"); //Here we have altered the p instance of class Person and first name is now set to "XYZ" insteab of  "Baljeet"

Immutable Objects:

Immutable objects are those objects, once created can not be modified. Means even if you have reference to an object, contents of that object can't be modified or altered. String objects are immutable.

For example :--

String s = "abcd"; //a new String object is created with value "abcd" on string pool in heap. See below diagram:



Now lets do concat operation string object s which we created earlier.
s = s + "ef"; // Here on doing contact operation, a new object reference is returned with value "abcdef "and reference is assigned to s. Now s holds a reference to a new String object in String pool whose value is "abcdef" and earlier String literal is still present in String pool.

 See below diagram for more clarification.



This means String objects are immutable means when ever you do any manipulation with Strings, result of that operation will always be a new String object. 

Steps to achieve immutability in Java:

1. Make all the fields of the class as private and final.
    
Make the fields private so that fields are not accessible directly and hence can't be modified if there are no setters for those fields. Fields are marked as final so that fields can't be modified even through reflection in Java.  

2. Don't provide setters for class fields.

Don't  provide any public method that can any how modify the fields.

3.  Make sure methods of a class can't be overridden.

To protect fields from modification, make sure methods of class are not overridden. This is because child class can override some method behavior and update some of the fields of the parent class. So either make class itself as final or make each method of class as final so that methods can't be overridden.

4.  Build your class from primitive types or immutable fields.
Try to use immutable fields such as Strings or primitive types in your class. If any of class field includes  references any mutable object, don't allow those objects to be changed by following below approaches :--

1. Don't provide methods that modify the mutable objects. Means don't even provide getter for that field because if you provide any getter, which returns the reference to the mutable object and object can be modified.

2. Don't share references to the mutable objects. Never store references to external, mutable objects passed to the constructor; if necessary, create copies, and store references to the copies. Similarly, create copies of your internal mutable objects when necessary to avoid returning the originals in your methods.


See below class to create immutable object.

import java.util.Date;

public final class  Person {
 
    //Fields are marked as private and Final
  
    final private String firstName;
  
    final private String lastName;
  
    final private Date dob;
  
  
    //public constructor to set the values while creating instance of the class
    public Person(String firstName, String lastName, Date dob)
    {
        this.firstName =  firstName;
        this.lastName = lastName;
        this.dob = dob;
    }

  
    //getters only for immutable fields only. No setters at all
    public String getFirstName() {
        return firstName;
    }

    public String getLastName() {
        return lastName;
    }

 /*As dob is of type Date, which holds the reference to a Date object. If we provide getters for dob field,  which will return the reference to Date instance, through which Person class instance can be altered. Hence even getter for dob is commented out.  
*/
  
/*public Date getDob() {
        return dob;
 }*/
  
}




   
 





Thursday 13 February 2014

java.lang.Object class

As we know every class in Java inherits from java.lang.Object class.  But why ? 

There could be lots of reasons to support this argument:--

1.  As per java recommendations, every class must have some common features like every class must be able to represent itself in human readable form which is a string, (toString()) , every object must be able to check it's identity ( equals() ), clone() etc. So Java designers have put common methods  like toString(), clone(), equals() etc in Object class, and every other class inherits from Object class.

2. wait(), notify(), notifyAll() play a very crucial role in thread synchronizing in  multithreading. Every object must have these methods. Hence Java designers have put these methods in Object class and every class inherits from Object class.

3. As we know java collections holds only Objects, and hash code and equality is very important for collections to work. Hence equals() and hashcode()  methods are part of Object class.

4. For garbage collection, finalize() method is invoked, which is part of Object class.     

 5. Every object must know about it's class at runtime. getClass() method gives the details about the class at run time.


Also It is said that Java supports only single inheritance, then what would happen in case if class A is extending from class B?

If you create a new class in Java and you specify that it "extends" from some other class say class B, then your class inherits from class B  and so on and class B in turn inherits from class Object.

If you create a new class in java and don't an "extends", then your class implicitly extends from Object class.You don't have to write any code for this. Java compiler and JVM run time  will automatically treat your class a direct sub class of Object class.


Java Memory management

Memory management is the process of allocating memory/space to newly created objects and recognizing the objects which are no longer needed and freeing memory used by such objects and making it available for subsequent allocation.

Explicit memory management :

In some programming languages like C/ C++, memory management is the programmer's responsibility. For example in C, malloc() function is used to allocate memory and free() function is used to free the memory. This memory management is very complex task and may lead to many common errors that can cause unexpected or erroneous program behavior and crashes. As a result, a large proportion of developer time is often spent debugging and trying to correct such errors.

Below are two major problems which could occur due to explicit memory management :--

1.  Dangling References
2.  Space Leaks

Dangling References :
Dangling reference is the scenario when space is freed from an object to which some other object still has reference. If the object that has a reference tries to access the original object (for which memory is deallocated programmatically) , but the space has been allocated to new object, may lead to undesired behavior.

Space Leaks:
Space leaks occurs when memory is allocated but object is no longer needed and memory is not released.

Automatic memory management:

To deal with problems which are mentioned above,  modern day programming languages uses automatic memory management through garbage collector. Garbage collection avoids the dangling reference problem, because an object that is still referenced somewhere will never be garbage collected and so will not be considered free. Garbage collection also solves the space leak problem described above since it automatically frees all memory no longer referenced.

A garbage collector is responsible for following tasks :--

1. Allocating memory
2. Ensuring that any referenced object remains in memory
3. Recovering memory used by objects that are no longer reachable from references in executing code.

In Java, JVM divides memory in to 5 parts including Heap. The heap is created when JVM starts up and it may increase or decrease while application execution. Objects are created on heap and when heap is full, garbage is collected.

Note :--  Whenever we talk about JVM, what comes to our mind is that there is only one vendor (supplier) of JVM and that is the Oracle HotSpot JVM (formerly Sun JVM), but that is not the case. apart from Sun there are other vendors of JVM like IBM, Oracle etc.  In fact, the two most popular application servers, IBM WebSphere and Oracle WebLogic, each come with their own JVM.  There are 3 most prominent JVMs, Oracle HotSpot JVM (formerly Sun JVM), he IBM WebSphere JVM, and the Oracle JRockit JVM. 

In Oracle JRockit JVM, Heap is divided in to two areas/generations called the nursery (or young space) and the old space. The nursery is a part of the heap reserved for allocation of new objects. When nursery becomes full, garbage is collected by a process called Young collection which moves objects which have lived long enough in young memory to old space of heap, freeing space for new allocations. When old space becomes full, garbage is collected by a process called Old collection.  
 
In Oracle HotSpot JVM (formerly Sun JVM), the Heap is is organized into three generations: a young generation, an old generation, and a permanent generation. In permanent generation space, holds objects that the JVM finds convenient to have the garbage collector manage, such as objects describing classes and methods,as well as the classes and methods themselves.

The reason behind keeping nursery is that while program execution most objects are new and short lived and thus Young generation collections occur relatively frequently and are efficient and fast because the young generation space is usually small.

There are various types of garbage collection algorithms:--
  
1. Mark and sweep garbage collection algorithm
2. Generational garbage collection algorithm.
3. Compaction garbage collection algorithm

Mark and Sweep garbage collection mechanism:--

A mark and sweep garbage collection consists of two phases, the mark phase and the sweep phase. During the mark phase all objects that are reachable (reachable though references from Java threads, Native methods etc) are marked as alive and remaining objects can be considered as garbage.

During Sweep phase, all identified garbage is reclaimed.

Oracle's JRockit JVM uses two improved versions of mark and sweep garbage collection mechanism:--
1. Mostly Concurrent Mark and Sweep
2. Parallel Mark and Sweep

  
Generational garbage collection mechanism:--

Generational garbage collection mechanism is used when heap memory is divided in to different areas /generations. Different algorithms can be used to perform garbage collection in the different generations, each algorithm optimized based on commonly observed characteristics for that particular generation. 

As like Oracle's JRockit JVM divides heap in to two areas, called Young space (nursery) and Old space. when young space (nursery) becomes full, Young collection process moves objects which have lived long enough in young memory to old space of heap, freeing space for new allocations.


Compaction garbage collection mechanism:--
 
In memory, Objects that are allocated next to each other will not necessarily become unreachable and garbage collected at the same time. Some objects are garbage collected at one time, others are garbage collected later on, thus heap memory becomes fragmented after garbage collection.This fragmented heap memory after garbage collection have many empty space which is scattered may not even sufficient for allocation to large objects. 

Compaction is the mechanism moving all the live objects together and completely reclaiming the remaining memory, thus removing fragmentation from heap. 
. To reduce fragmentation, the Oracle' JRockit JVM compacts a part of the heap at every garbage collection (old collection).
   
The above garbage collection mechanism can be used together for better performance in  a particular JVM implementation.


Thursday 6 February 2014

Object Oriented Concepts

Below are main features of object oriented programming language :--

1. Class : 

Class is a programming language construct / a template that describes the data and the behavior associated with an instance of that class. Class act as a blueprint /specification to create objects.

Class contains the attributes and methods that all the created objects of that class share.

Fundamentally, class encapsulates the state and behavior of the objects. Class encapsulates the state through data placeholders called member variables and behavior is encapsulated through methods. 

Thus member variables value define the state of the object and methods defines the behavior of the class.

 UML class diagram:-



    

General Form of the class:

Class Class_Name
{
      //Properties/Variables

    // Methods
}

For Example :--

Class Person
{
      private String firstName; //Variable to hold the firstName of the Person class object
    
      private String lastName;  //Variable to hold the lastName of the Person class object

     public void display()
     {
            System.out.println("Displaying person name");  //Method defines the behavior of class
      }



  
2. Object :

An object is an instance of the class which represents a real time entity. (Instance means physically happening).

Object is created based on the class definition. An object has some properties and it can perform some actions.

In Java an object of class is created using new operator. For example :   

Person p =  new Person();  // Here an instance of Person class is being created.


3. Encapsulation :

Wrapping up / bundling up data (variables) and methods  in to  a single unit is called Encapsulation. Class is a an example of encapsulation which  holds the variables and function together as a single entity.

Encapsulation can be described as a protective barrier that prevents the code and data being randomly accessed by other code defined outside the class. Encapsulation is the technique of making the fields in a class private and providing access to the fields via methods. If a field is declared private, it cannot be accessed by anyone outside the class.   

Note : Making class variables/fields private and  providing access to fields through methods is not Information Hiding.  

Defining a class with fields and functions is an example of encapsulation.

class Student
{
       private int rollNo;
      private String name;

     void display ()
     {
             System.out.println ("Student Roll Number is: " + rollNo);
             System.out.println ("Student Name is: " + name);
     }
}


4. Abstraction :

Abstraction is a phenomenon of providing essential features without inner details or hiding internal implementation is called Abstraction.  

Abstraction helps in enhancing internal implementation details without affecting outside world and it also provides security. 

A class might contain lots of data and a user might not interested in entire data. So methods in a class can be implemented in such as way that user can do it's processing passing required data as input and without knowing internal details of the method and unnecessary data. For example :--

A bank clerk should see the customer details like account number, name and balance amount in the account. He should not be entitled to see the sensitive data like the staff salaries, profit or loss of the bank etc. So such data can be abstracted from the clerks view.    

class Bank
{
      private int accno;
      private String name;
      private float balance;
      private float profit;
      private float loan;

     void display_to_clerk ()
    {
         System.out.println ("Accno = " + accno);
         System.out.println ("Name = " + name);
         System.out.println ("Balance = " + balance);
    }
}

In the preceding class, inspite of several data items, the display_to_clerk () method is able to access and display only the accno, name and balance values. It cannot access profit and loan of the customer. This means the profit and loan data is hidden from the view of the bank clerk.


5.  Inheritance :

It is a phenomenon by which a class inherit the behavior and data from another class.
                  Or
It is a phenomenon of producing a new class from already existing class is called Inheritance.

Note : -- Private member variables and methods are not inherited by child class.  

UML inheritance diagram :



In Java, extends keyword is used used to implement inheritance.  Inheritance example :--

class Person()
{
      private String firstName;
      private String lastName;

     public void display()
   {
         ---------
         ------
    }
}

class Employee extends Person      /* Here Employee class inherits from  Person class */ 
{
         ------
        -------     
  //private member variables  firstName & lastName from Person class  will  not be inherited      
 //by Employee class but display() method is inherited
}

class Customer extends Person   /* Here Customer class inherits from  Person class */ 
{
 ---------
  --------
  //private member variables  firstName & lastName from Person class  will  not be inherited       
  //by Customer class but display() method is inherited

}

6. Polymorphism :

The word polymorphism came from two Greek words ‘poly’ means ‘many’ and ‘morphos’ means ‘forms’. Thus, polymorphism represents the ability to assume several different forms. The ability to define more than one function with the same name is called Polymorphism.

Method overloading is a common example of polymorphism.

e.g.: int add (int a, int b);
       float add (float a, int b);
       float add (int a , float b);
       void add (float a);
       int add (int a);

 7. Message Passing :

Invoking a method in class is known as message passing. In Java, any public method of  a class is  invoked by using class object with . (dot) operator as:--

Person p1 =  new Person(); //Creating an instance of the class Person

p1.display(); // Invoking the display() method of Person class on p1 instance




Java Virtual Machine (JVM) Architecture / Java Memory Structure

Java Virtual Machine (JVM) is the heart of entire Java program execution process. 

JVM has 3 major modules:

1. Class Loader subsystem module
2. Run time data areas
3. Execution Engine

Java compiler at the time of compilation converts the .java program in to a .class file which consists of byte code instructions. Remember, the  Java compiler is part of Java Development Kit (JDK)  and not of JVM.

JVM loads and interprets the .class file which is generated by Java Compiler. The .class files are loaded in to JVM by a module of JVM  called  Class Loader Sub System.

Class Loading mechanism will be discussed in more details in other post.

Class loader performs following actions :--

1. First, it loads the .class files in memory.
2. Then  it verifies if all the byte codes instructions are proper or not. If any instruction is found suspicious then execution is terminated immediately.
3. If all the byte code instructions are proper, then necessary memory to execute the program is allocated.

JVM divides the memory in to 5 parts, called  run time data areas which contains the data and results while running the program. Please refer the following figure :--


1. Method Area : Method area is the memory block which stores the class code, variables code and code of the functions in Java program.

2. Heap: Heap is the memory area where object are created when program executes.

Note :-- Method areas and Heap areas are created immediately whenever class loader loads the .class file in memory.

3. Java Stacks : As method code / function code in Java program is stored on method area, but when a method is executed, it needs some more memory to the data and results which is allotted on Java Stacks. Thus java stacks are memory area where methods  are exectued.

4. PC(Program Counter) Registers: These are the memory areas which stores the memory address of the instructions of the methods. If there are 5 methods, 5 PC registers are used to track the instructions of the method.

5. Native Method stacks : As Java methods are executed on Java stacks memory area, native methods (C/C++ functions)  are executed on native method stacks.  Note : Java can execute native methods written in C/ C++ through native method  interface.


Execution Engine Module:

It contains the interpreter and JIT (Just in Time) compiler which translates the byte code instructions from .class files in to machine instructions which are executed by the microprocessor.  Loops and iterations (hot areas) in .class files are executed by JIT compiler whereas normal statements and instructions of the Java program are executed by Java interpreter. 

 

   



    


 

Why Java ? / Advantages of Java

Java has significant advantages over other programming languages like C/C++.  Below are the advantages of using Java :--


1. Simple to learn and practice

Learning and practicing Java is easy because of  it's resemblance with C and C++  basic programming    languages.

2.  Purely OOP (Object Oriented Programming)

Java is purely Object Oriented Programing language. In Java, both data and functions are bundled together in a class. C++ is also considered as Object oriented language but C++ also supports procedural programming language like C. You are not required to use classes in C++ to program something.   


3. Java is platform independent, hence portable

One of the most significant advantages of Java is its ability to move easily from one computer system to another. Java code can be compiled on one platform like windows etc and can be executed on other platform like Linux etc. 

Before going in  to details, first lets understands what is meaning of platform. Platform consists of computer hardware (architecture of the microprocessor) plus Operating System. Thus platform is :--
    
Platform  =  Computer hardware + Operating System.

Anything that is platform independent can run on any operating system and hardware.

When java code is compiled, byte code is generated which is machine independent and can run on any machine with any processor and with any OS.  Below diagram shows java compilation process:--

                
                                              Java Compilation Process

This byte code is interpreted by JVM (Java Virtual Machine). So , JVM reads the byte code and executes it. Different JVM are designed for different OS and thus byte code is able to execute on different machine. C/C++ compilers generates the machine native code which is machine dependent and not the byte code.





Thus, it the JVM that is installed in any machine makes Java Platform Independent.  JVM is part of JRE (Java Runtime Environment) and not part of  OS.

What If JVM is not installed in ?
 To run any any java code, JRE libraries are needed and JRE libraries provides the JVM implementation.

JDK provides tools to develop java  programs like java compiler (javac) and debugging tools where as JRE provides tools for running Java code.

4. Robust 

In computer science, robustness is the ability of a computer system to cope with errors during execution or the ability of an algorithm to continue to operate despite abnormalities in input, calculations, etc.

Java puts lots of emphasis on early checking of possible errors at compile time. Java compilers are able to detect many errors at compile time.  

Java programs are crash resistant because of its exception handling and its memory management features such as garbage collection and possibility of identifying many possible errors at compile time.

 5. Distributed

Java is designed for use on network; it has an extensive library which works in agreement with TCP/IP.

6. Secure

Java is designed for use on Internet. Java enables the construction of virus-free, tamper free systems.

7.Multithreaded

Executing different parts of program simultaneously is called multithreading. This is an essential feature to design server side programs.