Submitted by heartin on Tue, 02/05/2013 - 19:22
When several threads try to access a single resource, there is a chance that it might corrupt that data. Synchronization is the process which ensures that, when several threads want to access a single resource, only one thread can access it at any given time; other threads trying to access will have to wait for its turn.
Important points about Synchronization
A synchronized region is guarded by a lock object.
Submitted by heartin on Tue, 02/05/2013 - 19:06
Thread class has many important methods like init, start, stop, run, getName(), getPriority(), isAlive() and join(), and also few static methods like sleep(), yield() etc.
Submitted by heartin on Tue, 01/22/2013 - 09:47
The producer consumer problem describes two processes, the producer and consumer, who share a common fixed size buffer used as a queue. The producer generates data and put data into buffer continuously. At the same time, the consumer will be consuming the data continuously. The problem is to make sure that producer won’t try to add data into buffer if it is full and that the consumer won’t try to remove data from an empty buffer.
Submitted by heartin on Sat, 01/19/2013 - 20:25
In this article, we start by discussing the difference between multithreading and multitasking (or difference between threads and processes), then discussing the thread states, different ways of creating threads and a simple thread example to make things clear. We will also learn what are deamon threads.
Submitted by heartin on Sat, 12/08/2012 - 19:40
The JDBC API is comprised of two Java packages: java.sql and javax.sql. The following are core JDBC classes, interfaces, and exceptions in the java.sql package: