Logo

dev-resources.site

for different kinds of informations.

Why do we need threads along with processes?

Published at
12/20/2021
Categories
thread
process
concurrency
Author
wasinaseer
Categories
3 categories in total
thread
open
process
open
concurrency
open
Author
10 person written this
wasinaseer
open
Why do we need threads along with processes?

Let’s first define what a process is. A process is an independent isolated program to which an OS gives resources, file handles, or credentials. An OS can have many processes with its own address space, heap, or stack. When processes need to communicate, they need to use coarse-grained communication mechanisms such as a socket, shared memory, files, etc. Nothing is directly shared among processes.

A process can have many threads. A thread is like a lightweight process but with a major difference of sharing state. Threads share process-wide resources like files or memory which enables fine-grained communication. All threads within a process have their own stack, program counter, and local variables except heap. This sharing of state among multiple threads leads to concurrency problems which we’ll discuss in our upcoming posts.

Along with the benefits of multiprocessing(resource utilization, convenience, fairness), threads enable us to use the same process-wide resources without using any communication mechanisms.

REFERENCE

Topic#1.1: https://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601

thread Article's
30 articles in total
Favicon
This Small Python Script Improved Understanding of Low-Level Programming
Favicon
How to Run an Asynchronous Task in Spring WebFlux Without Blocking the Main Response?
Favicon
Quem comeu o meu CompletableFuture?
Favicon
Concurrency and Parallelism in PHP
Favicon
Thread fundamentals in Java
Favicon
Node Boost: Clusters & Threads
Favicon
Executando processos paralelos com Flutter/DART
Favicon
Multithreading - Dining Philosophers Problem in Java
Favicon
Multi-Threaded Programs in Python Using threading Module
Favicon
newSingleThreadContext() causes outofmemoryexeception in my service on Android
Favicon
A Battle of Words: Twitter vs Threads App
Favicon
Make Ruby code thread-safe
Favicon
Process and Thread
Favicon
Asynchronous Daily Thread Automation
Favicon
How Home Assistant found my Thread Thermostats
Favicon
Web Worker, Service Worker, and Worklets: A Comprehensive Guide
Favicon
O que é processo e um thread?
Favicon
The experiment of SPVM::Thread is started today.
Favicon
Multi-Threaded FizzBuzz
Favicon
Tweet YouTube video with Google Chrome Extension
Favicon
Internals of goroutines and Channels
Favicon
Thread Synchronization within Linux Operating System.
Favicon
Java Thread Sınıfı
Favicon
Why do we need threads along with processes?
Favicon
Java Thread Programming (Part 1)
Favicon
Notes on Thread and threading module in python
Favicon
Java Thread Programming: Lesson 3
Favicon
Java Thread Programming: Lesson 1
Favicon
Java Thread Programming: Lesson 2
Favicon
How to create a new Thread in java ?

Featured ones: