• ravitejajyothula

Threads Processes And Multi-Threading


Process

Thread


A program loaded into memory with all the resources it needs

An executable unit within a process .

Allocated their own memory space.

Threads of a process operate within the address space of the process

More expensive to create as memory needs to be allocated

Easier to create since they do not require a separate memory space

Context switching between processes is more expensive

Context-switching between threads is less expensive .

Process are heavy-weight operations

Threads are lighter weight operations .

The process doesn't share a memory with other processes. They are independent of each other.

Threads share memory with other threads of the same process. Operating in the same space, threads are interdependent. Threads separate concurrency from protection

Inter process communication is expensive

Inter thread communication can be faster as they share memory space


Multi-threading


In multi-threading,Interprocess a process has multiple threads and tries to execute multiple parts of a program (threads) at the same time. It allows for maximum utilization of the CPU


Benefits of Multi-threading

Reduced Resource usage All threads in a process share resources such as memory, data, files etc Threads require less overhead to create, maintain and manage than processes.


Maximum utilization of CPU Exploits parallelism in a multi-processor system Simultaneous and symmetric use of multiprocessors for computation and I/O

Responsiveness Large or complex requests don't block other requests for services


Improved throughput Many compute operations and I/O requests are executed within a single process


Program structure simplification Complex program structures can be simplified as simple routines can be written for each activity Allows for more adaptiveness to wide variation in user demands


Improved Communication Useful in coordinating programs. Multiple threads of a process sharing memory allow for or low latency communication between separate tasks within a process

0 views0 comments

Recent Posts

See All