Monday, October 31, 2011

CVS


Syllabus:
Introduction

Why CVS?

Definition of CVS

Features of CVS

Terminology
Repository

Sandbox

Check out

Commit (check in)

Update

History

Revision
Software Description

Software Installation

Working with CVS
Server software CVS NT

IDE : MyEclipse

SCJP


Syllabus:
Language Fundamentals 

Declarations and Access Control

Interfaces

 Operators 

 Flow Control 

 Exception Handling 

 Asserions 

 Garbage Collections 

 OOPs 

 Multi-Threading 

 java.lang Package: String,StringBuffer,StringBuilder,Wrapper Classes,Object,Autoboxing

 java.io package

Serialization 

 Collections  Framework

 Generics 

 Inner Classes 

 Internationalization 

 Development 

 Regular Expressions 

 enum

C Language



Duration: 30-45 days (Daily one and half hour)           
Syllabus:

1. Declarations and Initializations
2. Control Instructions
a) if
b) if-else
c) Dangling else
d) if – else dummies
e) switch
f) while
g) for
h) do-while
i) loop dummies
j) break
k) continue
l) goto

3. Expressions

4. Data Types

5. Floating Point Issues

6. Functions
a) User defined functions
b) Pre defined functions
c) storage class specifiers
i) auto
ii) static
iii) extern
iv) regiester
v) typedef
d) Recursion

7. C Preprocessor
a) macros
b) conditional compilation
c) file inclusion
d) #pragma

8. Pointers
a) Introduction to pointers
b) Jargon of pointers
c) Double and triple pointers
d) dangling pointer
c) null pointer
d) void pointer
f) function pointers

9. Arrays
a) Introduction of arrays
b) 1D array
c) 2D Array
d) 3D and Multi Dimension Arrays
e) Array of pointers
f) Pointer to an array
e) Functions using array & pointers

10. Strings
a) Introduction to strings
b) 1D string
c) 2D string
d) Character array Vs String
e) Character pointer Vs String
f) Predefined String functions.

11. structures, unions, enums
a) Introduction to structures
b) Nested structures/ Containers
c) Self Referential structures
d) unions
e) enums
f) bit fields

12. File Input / Output
a) text files
b) audio files
c) video files

13. Command Line Arguments

14. Bitwise Operators

15. typedef

16. const

17. Dynamic memory Allocation
a) malloc
b) calloc
c) realloc
e) free

Highlights:

1. Printed Material
2. Online exams on each and every topic (www.durgaexams.com )
3. Class room notes
4.1000+ programs are covered in class room discussion.
5. Tips to crack written test & interviews.

Exit Profile:
1. Student can crack any written test & interviews

2. Student can develop C code for the given requirement.

Java (JVM) Memory Types


Java (JVM) Memory Types
Java has only two types of memory when it comes to JVM. Heap memory and Non-heap memory. All the other memory jargons you hear are logical part of either of these two.
Heap Memory
Class instances and arrays are stored in heap memory. Heap memory is also called as shared memory. As this is the place where multiple threads will share the same data.http://javapapers.com/wp-content/uploads/2011/01/memory.jpg
Non-heap Memory
It comprises of ‘Method Area’ and other memory required for internal processing. So here the major player is ‘Method Area’.
Method Area
As given in the last line, method area is part of non-heap memory. It stores per-class structures, code for methods and constructors. Per-class structure means runtime constants and static fields.
The above three (heap memory, non-heap memory and method area) are the main jargon when it comes to memory and JVM. There are some other technical jargon you might have heard and I will summarize them below.
Memory Pool
Memory pools are created by JVM memory managers during runtime. Memory pool may belong to either heap or non-heap memory.

Runtime Constant Pool
A run time constant pool is a per-class or per-interface run time representation of the constant_pool table in a class file. Each runtime constant pool is allocated from the Java virtual machine’s method area.jvm memory
Java Stacks or Frames
Java stacks are created private to a thread. Every thread will have a program counter (PC) and a java stack. PC will use the java stack to store the intermediate values, dynamic linking, return values for methods and dispatch exceptions. This is used in the place of registers.
Memory Generations
HotSpot VM’s garbage collector uses generational garbage collection. It separates the JVM’s memory into and they are called young generation and old generation.
Young Generation
Young generation memory consists of two parts, Eden space and survivor space. Shortlived objects will be available in Eden space. Every object starts its life from Eden space. When GC happens, if an object is still alive and it will be moved to survivor space and other dereferenced objects will be removed.
Old Generation – Tenured and PermGen
Old generation memory has two parts, tenured generation and permanent generation (PermGen). PermGen is a popular term. We used to error like PermGen space not sufficient.
GC moves live objects from survivor space to tenured generation. The permanent generation contains meta data of the virtual machine, class and method objects.
Discussion:
Java specification doesn’t give hard and fast rules about the design of JVM with respect to memory. So it is completely left to the JVM implementers. The types of memory and which kind of variable / objects and where they will be stored is specific to the JVM implementation.
Key Takeaways
  • Local Variables are stored in Frames during runtime.
  • Static Variables are stored in Method Area.
  • Arrays are stored in heap memory.
References:

Differentiate JVM JRE JDK JIT



Java Virtual Machine (JVM) is an abstract computing machine. Java Runtime Environment (JRE) is an implementation of the JVM. Java Development Kit (JDK) contains JRE along with various development tools like Java libraries, Java source compilers, Java debuggers, bundling and deployment tools.
JVM becomes an instance of JRE at runtime of a java program. It is widely known as a runtime interpreter. The Java virtual machine (JVM) is the cornerstone on top of which the Java technology is built upon. It is the component of the Java technology responsible for its hardware and platform independence. JVM largely helps in the abstraction of inner implementation from the programmers who make use of libraries for their programmes from JDK.
Diagram to show the relations between JVM JRE JDK
Diagram to show the relations between JVM JRE JDK
JVM Internals
Like a real computing machine, JVM has an instruction set and manipulates various memory areas at run time. Thus for different hardware platforms one has corresponding implementation of JVM available as vendor supplied JREs. It is common to implement a programming language using a virtual machine. Historicaly the best-known virtual machine may be the P-Code machine of UCSD Pascal.
A Java virtual machine instruction consists of an opcode specifying the operation to be performed, followed by zero or more operands embodying values to be operated upon. From the point of view of a compiler, the Java Virtual Machine (JVM)is just another processor with an instruction set, Java bytecode, for which code can be generated. Life cycle is as follows, source code to byte code to be interpreted by the JRE and gets converted to the platform specific executable ones.
Sun’s JVM
Sun’s implementations of the Java virtual machine (JVM) is itself called as JRE. Sun’s JRE is availabe as a separate application and also available as part of JDK. Sun’s Java Development Tool Kit (JDK) comes with utility tools for byte code compilation “javac”. Then execution of the byte codes through java programmes using “java” and many more utilities found in the binary directory of JDK. ‘java’ tools forks the JRE. Implementation of JVMs are also actively released by other companies besides Sun Micro Systems.
JVM for other languages
A JVM can also be used to implement programming languages other than Java. For example, Ada source code can be compiled to Java bytecode, which may then be executed by a Java virtual machine (JVM). That is, any language with functionality that can be expressed in terms of a valid class file can be hosted by the Java virtual machine (JVM). Attracted by a generally available, machine-independent platform, implementors of other languages are turning to the Java virtual machine (JVM) as a delivery vehicle for their languages. PHP with Quercus is such an example.
Just-in-time Compiler (JIT)
JIT is the part of the Java Virtual Machine (JVM) that is used to speed up the execution time. JIT compiles parts of the byte code that have similar functionality at the same time, and hence reduces the amount of time needed for compilation. Here the term “compiler” refers to a translator from the instruction set of a Java virtual machine (JVM) to the instruction set of a specific CPU.

Java garbage collection



Garbage collection in Java is to discard objects that are no longer needed and to reclaim their resources. A Java object is subject to garbage collection when it is out of scope of the control flow of the program.

Does Java garbage collection guarantee that a program will not run out of memory?

No. Java Programs may use up memory resources faster than they are garbage collected. A Java program can create objects that are not subject to garbage collection.

System.gc() is just a convenience for Runtime.getRuntime().gc().
However, if you are genuinely a beginner, you should never be calling either of these methods.
99.9% of the time, Java will garbage-collect as appropriate and does not need you to tell it to do so. Calling one of the gc() methods does not force garbage collection to happen, either; it only suggests to the JVM that now might be a good time for some garbage collection.


Example
·  Usually if an object doesnot have any references then it is eligible for Garbage collection.
Sometimes, even though object having some reference still eligible for garbage collection
(The best example for above situation is Island Of Isolation)
Here is a sample code
Class Test
{
Test t;
public static void main(String args[]){
Test t1=new Test();
Test t2=new Test();
Test t3=new Test();
//No Object Is Eligible for GC
t1.t=t2; //No Object Is Eligible for GC
t2.t=t3; //No Object Is Eligible for GC
t3.t=t1; //No Object Is Eligible for GC
t1=null;
//No Object Is Eligible for GC (Coz t2 still have a reference)
t2=null;
//No Object Is Eligible for GC (Coz t3 still hava a reference)
t3=null;
//All the 3 Object Is Eligible for GC (None of them have a reference)
}
Thought of explaning pictorially but am unable to paste a pic here…. :(

Island of Isolation…
Now carrying forward your sample code (with few addition) to better understand the garbage collection.
here in the above code(previous code) if we want to check how many objects are eligible for Garbage Collection (practically) then we can add finalize method in the above code, as…
/******** Garbage collection *********/
Class Test
{
Test t;
static int i=1;
protected void finalize()
{
System.out.println(“Garbage collected from object” + i);
i++;
}
public static void main(String args[]){
Test t1=new Test();
Test t2=new Test();
Test t3=new Test();
//No Object Is Eligible for GC
t1.t=t2; //No Object Is Eligible for GC
t2.t=t3; //No Object Is Eligible for GC
t3.t=t1; //No Object Is Eligible for GC
t1=null;
//No Object Is Eligible for GC (Coz t2 still have a reference)
t2=null;
//No Object Is Eligible for GC (Coz t3 still hava a reference)
t3=null;
//All the 3 Object Is Eligible for GC (None of them have a reference)
System.gc();
}
}
/************************************/
output:
Garbage collected from object1
Garbage collected from object2
Garbage collected from object3
……………………………..
So, from the output we can clearly see that when JVMs run its garbage collector, garbage is collected from the 3 objects(t1, t2, t3 : as they dont hav any external refrence) and finalize method is called thrice.