Ads Sponsored By Google :)

Friday, 18 January 2013

Multithreading|Concurrent Threads in java with example programs pdf|ppt


Multithreading in java Multithreading in java with examples Multithreading in java with examples programs
Multithreading in java pdf Multithreading in java ppt Concurrent threads in java


Multi Threading:
                  The languages like C,C++,Pascal ,Cobol etc are treated as single threaded      
  modeling language’s because their execution environment contains single flow of control.
  In general each and every single threaded modeling language provides only sequential   
  execution but not concurrent execution, and they does not concurrent execution ,they 
  does not contain any effective API.
              The languages like java and DotNet are comes under multithreading modeling   
  language’s because their execution environment contains multiple flow of controls. In 
  general each and every multithreaded modeling language provides both sequential and 
  concurrent executions and contains an effective API for development of multithreading 
  application.
  But in java what is thread.

   Definition of Thread:
         A flow of control is known as Thread. The purpose of thread is to execute the logic of 
     program which is written in the form of user defined methods.

  Definition Of Multi Threading:
        Multi Threading is one of the distinct feature in java. By using multithreading to provide   
   concurrent execution among all threads. Flow of Control is known as thread. If a java
   program is containing multiple flow of controls (threads) then that java program is known
   as multi Threads.
     In java programming we have the following API for development of multithreading 
     applications.
                 a)      Java.Lang.Thread (class)
                 b)      Java.Lang.Runnable (Interface)

      Whenever we write a java program by default their exists two types of threads. 
      They are
          a)      Foreground / Child Thread
          b)      Background / Parent Thread

    A foreground thread is one which is always executing the logic of the java program 
   which is written in the form of user defined methods.
   
   By default their exist single foreground thread and programmatically there is possibility 
   of existing multiple foreground threads (flow of controls).

    A Background thread is one which is always monitoring the execution status of fore
    ground threads. By their exists single back ground thread and programmatically also   
    recommended the create only one background thread. The real world implementation 
   of multithreading is to develop real world server software’s such as tomcat(Apache),
   Web logic glassfish(Sun) etc……..

   How do you justify each and every java program is multi threaded ?
   
  Whenever we start executing any java program, by default the logic of the java program
  is executed by one of the thread and it is known as foreground thread.
  Internally to monitor the execution status of foreground thread their exist another thread
  known as back ground thread.
  so a java program is containing by default two types of threads hence every java program 
  is  multi-threaded.

   How do you justify “threads of java executes concurrently” ?

   If threads are executed hour by hour , minute by minute and second by second then 
  such type of threads execution will be considered  as sequential execution. Whereas if   
  threads are executing  in the difference of millisecond by millisecond then those threads       
  execution will be considered as concurrent execution.

  Thread Based Applications:

1)         In Thread based applications their exists multiple flow of controls. All java and
       DotNet applications are comes under thread Based Applications.
2)             In thread based applications context switch is very less. Context switch is a 
       mechanism of switching the control from one address space to  another address 
       space is known as context switch must be less. Address space is an amount of     
       temporary memory space is created by operating system on the stack memory for its 
       temporary execution.
3)             Execution time of thread based application is less ,In thread based applications 
      irrespective of the number of sub programs ,their exist a single address space.
4)             All thread based applications are treated as light weight components ,Heavy weight components are those whose processing time is more whereas light weight component are those whose processing time is less.
                
     The following concepts are supports Multi threading
  •       Life Cycle Of Threads
  •       Ways of Creating Threads
  •       Java.Lang.Thread
  •       Java.Lang.Runnable
  •       Internal Flow Of Thread
  •       Synchronization
  •       Inter Thread Communication
  •       Multi Threading PPT

        

No comments:

Post a Comment

LinkWithin