(0) Threads


Lightweight process (LW)
•Basic unit of CPU utilization
•A thread comprises a thread ID, a program counter, a register set, and a stack
•A thread shares with other threads belonging to the same process its code section, data section, and other OS resources, such as open files and signals•A process with multiple threads can do more than one task at a time


Single and Multithreaded Processes

Single Threaded and Multithreaded Process Models

  • Single Threaded process
    Single threaded programs have one path of execution, Single threaded programs can perform only one task at a time, and have to finish each task in sequence before they can start another. For most programs, one thread of execution is all you need, but sometimes it makes sense to use multiple threads in a program to accomplish multiple simultaneous tasks. In a single processor environment, the processor 'context switches' between different threads. In this case, the processing is not literally simultaneous, for the single processor is really doing only one thing at a time. This switching can happen so fast as to give the illusion of simultaneity to an end user.

  • Multi-Threaded Process
    Multiple threads can be executed in parallel across many computer systems. This is multithreading, and generally occurs by time slicing (similar to time-division multiplexing) across the computer systems. multi-threaded programs have two or more paths of execution.

0 comments:

Post a Comment