Thursday, April 2, 2015

THREAD

               A thread is a single sequential flow of control within a program.

 With respect to computer programming, a thread is a portion of code that may be executed independently of the main program. 

EXAMPLE
A program may have an open thread waiting for a specific event to occur or running a separate job, allowing the main program to perform other tasks. A program is capable of having multiple threads open at once and will either terminate or suspend them after a task is completed, or the program is closed.

     A thread is a flow of execution through the process code, with its own program counter, system registers and stack. A thread is also called a light weight process. Threads provide a way 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.
         A thread of execution is the smallest sequence of programmed instructions that can be managed independently by a scheduler, a thread is a component of a process. Multiple threads can exist within the same process and share resources such as memory, while different processes do not share these resources.

  1. Difference between Thread and Process
    Threads differ from traditional multitasking operating system processes in that:
    • processes are typically independent, while threads exist as subsets of a process
    • processes carry considerably more state information than threads, whereas multiple threads within a process share process state as well as memory and other resources
    • processes have separate address spaces, whereas threads share their address space
    • processes interact only through system-provided inter-process communication mechanisms
    • context switching between threads in the same process is typically faster than context switching between processes.
    MULTITHREADING

         Multithreading is the ability of a program or an operating system to serve more than one user at a time and to manage multiple simultaneous requests without the need to have multiple copies of the programs running within the computer. To support this, central processing units have hardware support to efficiently execute multiple threads. This approach is distinguished from multiprocessing systems (such as multi-core systems) in that the threads have to share the resources of a single core: the computing units, theCPU caches and the translation lookaside buffer (TLB).

    Where multiprocessing systems include multiple complete processing units, multithreading aims to increase utilization of a single core by using thread-level as well as instruction-level parallelism. As the two techniques are complementary, they are sometimes combined in systems with multiple multithreading CPUs and in CPUs with multiple multithreading cores.
    One example of multithreading is downloading a video while playing it at the same time. Multithreading is also used extensively in computer-generated animation.
    Among the widely-used programming languages that allow developers to work on threads in their program source code are Java, Python and .NET.

  2.                           Image result for multithreading

  3. REFRENCES
  4. http://en.wikipedia.org/wiki/Multithreading_(computer_architecture)


No comments:

Post a Comment