What is a Thread?

A fundamental unit of CPU utilization, that forms the basis of multithread computer system. A thread is a basic unit of CPU utilization, it comprises a thread ID, a program counter, a register set, and a task. Most of the software packages running on today's desktop PCs are multithreaded. A process can be single threaded or multithreaded.

Process creation is time consuming and resources intensive. So it is generally more efficient to use one process that contains multiple threads.

A Process has its own memory space, runtime environment and process ID. A Thread run inside a Process and shares its resources with other threads. A thread is a unit of execution inside a Process. Threads are a way for a program to split itself into two or more simultaneously (or pseudo-simultaneously) running tasks. Context switching between threads in the same process is typically faster than context switching between processes.

A process is the "heaviest" unit of kernel scheduling. Processes own resources allocated by the operating system. Resources include memory, file handles, sockets, device handles, and windows. Processes do not share address spaces or file resources except through explicit methods such as inheriting file handles or shared memory segments, or mapping the same file in a shared way. Processes are typically pre-emptively multitasked. However, Windows 3.1 and older versions of Mac OS used co-operative or non-preemptive multitasking.

A thread is the "lightest" unit of kernel scheduling. At least one thread exists within each process. If multiple threads can exist within a process, then they share the same memory and file resources. Threads are pre-emptively multitasked if the operating system's process scheduler is pre-emptive. Threads do not own resources except for a stack and a copy of the registers including the program counter.

A thread is a flow of control within a process. A multithreaded process contains several different flow of control within the same address space. The benefits of multithreading includes increased responsiveness to the user, resources sharing within the process, economy, and the ability to take advantage of multiprocessor architectures.

 


Newsforall | MyClickworld | Javasociety | ReviewBus | ReviewBuz | Cargpsfaqs | DealChart | Flatten Belly | HealthBeauty Care