Member-only story

Java Threading

Cahit Barkin Ozer
10 min readNov 19, 2021

--

Introduction to multithreading in Java.

Concurrency is the generic term for two or more things happening at the same time.

For Access: https://cbarkinozer.medium.com/java-threading-32ac5f8c9423?source=friends_link&sk=666094d00fcb2581c779e003fb8daa53

Multitasking

Multitasking is the technique of performing numerous activities at the same time to maximize the CPU’s efficiency.[1]

There are two ways for multitasking. Process-based Multitasking (Multiprocessing) and Thread-based Multitasking (Multithreading).[1]

We use multithreading than multiprocessing because threads use a shared memory area. They save memory by not allocating separate memory regions, and context switching between threads takes less time than processing.[1]

Multithreading

In Java, multithreading is the process of running several threads at the same time. A thread is the smallest unit of processing and is a lightweight sub-process. [1]

Multithreading vs multiprocessing

Figure-1: The relationship between OS, process, and threads[1]

As shown in Figure 1; there are multiple processes, multiple threads inside those processes, and each thread requires at least one process.[1]

--

--

Cahit Barkin Ozer
Cahit Barkin Ozer

Written by Cahit Barkin Ozer

Üretken YZ başta olmak üzere teknoloji alanındaki yenilikleri öğrenip sizlerle paylaşıyorum. Youtube Kanalım: https://www.youtube.com/@cbarkinozer

No responses yet