Threading in OOPs

 A thread is a smallest unit present In a operating System allocated to run a computer program every application on which we run in a computer while have at least one thread called main thread.However when we develop a large computer application and if we run them with one single main thread then not only the performance of the application Will be slow but even  we are not utilize the real power of the processor Hence now a days whenever the large applications  are created they ensure that if runs  on multi threaded systems.

        Multi threading is nothing but specialized form of multi tasking when we open more than one computer application word,power point, chrome all the same time in any operating System like windows then the concept is called as multi tasking because each application whichever open are considers as one task by the operating system and every task will run an at least one main thread and one are more worker threads.

when we use the concept of multi threading they will be one main thread and there will at least one or more worker thread which will be parlally  executing more than one port of independent executable port

 when there is no dependencies in the program

    When we use the concept of threading in C# it is devided into 2 parts that is 

1. forground thread

2.background thread

     In case of forground thread the worker thread will continue to perform even when man thread has already has finished  its executions.

      When we use background thread concept the worker thread will automatically stop the execution the movement the main thread stops.

In Java also Multi threading concept is dividing in to 2 categories 

1.Class based thread 

2. interface based thread(by using runnable interface)

  usage of runnable in threading becomes necessary when we the class on which we want implement multi threading  has already inherited another class


Comments

Blogs