DEV Community

Md Shahab Uddin
Md Shahab Uddin

Posted on

Let's know about Process, thread, and Synchronicity

Process and Thread

Process and thread: It's a program in execution. Generally, the creation of a process is resource-consuming. That's why we split our process into multiple unit's which is called a thread. It's of two types:
Single thread: If there is one thread in a process
Multithread: if more than one thread in a process

Every thread is assigned to do a specific task. The single thread executes the full process without being interrupted by a thread but in multithread it allows other threads to executed independently but shares their resources. Also, in a single thread, one thing is done at a time. But the multithread process allows multiple parts of a program to be executed at the same time.

Although most of the programming languages are single-threaded, they support libraries and other functionality that enable us to use multithreading. JavaScript is a single-threaded language. Go and Rust is the multithreaded language.

What is Synchronous and asynchronous

In Programming, two operations are very significant is Synchronous and Asynchronous.

Synchronous operation is also called blocking operation because it blocks instruction until the task is completed. you can execute only one task at a time, after finishing the current task then the next task starts.

Asynchronous operation is called non-blocking operation because you can execute multiple things at a time and it's not necessary to finish execution of the current program in order to execute the next one. It can execute multiple programs at a time. Every program does its job independently without blocking others and they share resources among them.

Top comments (0)