Introduction to Threads - BunksAllowed

BunksAllowed is an effort to facilitate Self Learning process through the provision of quality tutorials.

Community

Introduction to Threads

Share This

Each process in conventional operating systems has its own address space and control thread. In actuality, that is almost how a process is defined. However, there are numerous circumstances where it is preferable to operate multiple threads of control in a quasi-parallel fashion as if they were different processes (apart from the common address space).

Program text, data, and other resources are stored in an address space for a process. These resources could include open files, child processes, pending alarms, signal handlers, accounting information, and other things. If they are incorporated into a process, they can be handled more easily.

Threads are the entities scheduled for CPU execution; processes are utilized to combine resources together.

Through the use of threads, several executions are made possible within the same process environment that are largely independent of one another. Similar to the way that many processes can run simultaneously on one computer, many threads can run simultaneously in one process. 

Threads are referred to as "lightweight processes" since they have some characteristics of processes. The practice of permitting several threads in a single process is sometimes referred to as multithreading.



Figure (a) represents three processes, where each process is associated with one thread. Figure (b) represents one process with tree threads.


The first column lists some items shared by all threads in a process. The second one lists some items private to each thread.




Happy Exploring!

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.