Processes and Threads

Processes

A process is defined as an instance of a program running in an operating system 

If we were to think of an activity in normal life, like washing the dishes for example. The actions we that need to be made to clean the dishes (We can imagine all the steps collectively, like picking up the dish, using the cloth to clean the dish appropriately to its design, rinsing the dish off and placing it in the dry rack) is what we can compare a process to in the programming world.

It is the collection of actions that take place in order for a program to deliver the expected result or outcome. This plays a big role in concurrency(multitasking)

Distinctions of a process

• A process is compiled of multiple threads

• Makes use of a counter to identify where in the process (which thread) is currently running

• Does not share memory

Threads

A thread is a component of a process running in an operating system.

In the example above, the process of cleaning a dirty dish has a desired result - which is to have a clean dish from a dirty dish. 

A thread would be considered the execution of each stage of getting those dishes clean, and achieving that clean dish really relies on ensuring that the steps to get the dirty dish clean takes place as it was intended. If you were to forget to rinse the dish for example, the outcome would not be the clean dish you wanted. 

Distinctions of a thread

• A thread is a single process or a unit of execution within a process

• Shares memory and can interact with one another to share information


For a more comprehensive explanation on Threads, Processes and the difference:

Click here

Comments

Popular posts from this blog