In this part I’ll try to make an overview of java.util.concurrent framework that provides high-level building blocks for creating concurrent applications. These building blocks have high performance, thread-safe, widely used in Java world and moreover they have been thoroughly tested.
The reason why this framework was introduced in Java 1.5 is that low-level API such as wait(), notify() and so on are too primitive and force developers to create their own custom high-level libraries.
Continue reading Java Concurrency Overview Part 2
Modern computers can have several processors or several cores in one processor and this offers big opportunities in developing applications. Because traditionally, applications have been developed for consecutive computation and as result to solve many complex problems you had to spend more time, money and other resources. Nowadays such programming languages as Java provides all necessary tools to make a multithreaded application.
Let’s get started from basics and go ahead for more complex things like Java concurrent package, but we will do it serially. Continue reading Java Concurrency Overview Part 1
Unlike C++, Java automatically allocates and deallocates memory so the applications don’t have to do it by its own. But, the way how garbage collection works depends on JVM implementation. In this article I will talk about HotSpot JVM, since it is commonly used in production.
In HotSpot JVM the heap is separated into the generations basing on weak generational hypothesis because empirical analysis of applications has shown that most objects have short life-cycle and there are few old-to-young references. Therefore, the heap is separated into young generation and old generation. This segregation helps to keep a big bunch of dead objects in one place that can be collected very quickly. At the same time the young generation separated into three spaces eden, survivor 0 and survivor 1.
The perm space is the method area that contains information on methods, classes, method’s code etc. One of the biggest improvements in Java 8 is that perm space is removed from the heap. Since in earlier versions if your application loads a lot of classes then you had to tune and optimize this part of the heap. Another interesting improvement is string deduplication it searches for strings which occured more than once and replaces them to pointer that references to a string.
Continue reading Garbage Collection in Java