What is Threading ?

  • A thread is a flow of execution through the process code, with its own program counter that keeps way of which instruction to execute next, system registers which hold its existing working variables, and a stack which contains the execution history. A thread is also called as lightweight process.
  • A thread shares with its peer threads few information like code segment, data segment and open files.
  • To improve application performance through parallelism.
  • Threads represent a software approach to improving performance of operating system by reducing the overhead thread is equivalent to a classical process.
  • Each thread has exactly one process and no thread can exist outside a process. Each thread signifies a separate flow of control.
  • Implementing network servers and web server.
  • They are also offer a suitable foundation for parallel execution of applications on shared memory multiprocessors.
  • The working process of a single-threaded and a multithreaded are shows in the following figure.
 Thread

What is Threading

Advantages of Thread

  • The context switching time minimize in thread concepts.
  • Use of threads offers concurrency within a process.
  • Efficient communication.
  • It is more economical to create and context switch threads.
  • Threads allow utilization to a greater scale and efficiency of multiprocessor architectures.

Types of Thread

  • There are two types of thread,
    • User Level Threads.
    • Kernel Level Threads.

User Level Threads

  • In this case, the thread management kernel is not aware of the existence of threads.
  • The thread library contains code for creating and destroying threads, for transient message and data between threads, for scheduling thread execution and for saving and reestablishing thread settings.
  • From the single thread start the application.
User Level Thread

User Level Thread

Kernel Level Threads

  • Kernel is done thread management.
  • In the application area there is no thread management code.
  • The operating system directly supported Kernel threads.
  • Multithreaded can be programmed in an any application.
  • An application is supported within a single process.

Categorized in:

Tagged in:

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,