multithreading
multithread is a java feature
the process by which this is achieved is called synchronization
creation of thread
thread life cycle
thread priorities and scheduling
thread synchonization
daemon thread
communication of threads
scheduling of cpu
it has inter thread communication
daemon thread is a type of thread that does not prevent the JVM from exiting when the program finished but the thread is still running.
2. SYNOPSIS:
MUTITHREADING
CREATION OFTHREAD
THREAD LIFE CYCLE
THREAD PRIORITIESAND SCHEDULING
THREAD SYNCHRONIZATION
DAEMONTHREAD
THREAD GROUPS
COMMUNICATION OFTHREADS
3. MULTITHREADING:
Multithreading is a Java feature that allows
concurrent execution of two or more parts of
a program for maximum utilization of CPU.
Each part of such program is called a thread.
So, threads are light-weight processes within
a process.
4. CREATION OF THREAD
Java is inherently multi-threaded. A
single Java program can have many different
threads executing independently and
continuously.Three Java applets on the same
page can run together with each getting
equal time from the CPU with very little extra
effort on the part of the programmer
6. THREAD PRIORITIES AND
SCHEDULING:
Scheduling of the CPU is fully preemptive. If
a thread with a higher priority than the
currently executing thread needs to execute,
the higher priority thread isimmediately
scheduled.The Java runtime will not preempt
the currently runningthread
for another thread of the same priority.
7. THREAD SYNCHRONIZATION:
At times when more than one thread try to
access a shared resource, we need to ensure
that resource will be used by only one thread
at a time.The process by which this is
achieved is called synchronization.
Thesynchronization keyword in java creates
a block of code referred to as critical section.
8. DAEMON THREAD:
A daemon thread is a thread that does not
prevent the JVM from exiting when the
program finishes but the thread is still
running. An example for a daemon thread is
the garbage collection.You can use the
setDaemon(boolean) method to change
the Thread daemon properties before
the threadstarts.
10. COMMUNICATION OF THREAD:
Inter thread Communication. Java provide
benefits of avoiding thread pooling using
inter-thread communication.The wait(),
notify() and notify all() methods of Object
class are used for this purpose.These method
are implemented as final methods in Object,
so that all classes have them.