Before the inception of multithreading in processors, they had a hardwired architecture to execute one task after another. In other words, it's that each task needed to wait for the previous one to be completed. The single-core processing was for its time efficient, but just could not handle the increasing demands of modern computing. Now we have moved to cool multi-core processors that can execute multiple tasks concurrently by using what is called multiprocessing. This post will address what signalling is, and its types and explain the concept to the reader in an easy way.
What is Multiprocessing?
Multiprocessing is the ability of a CPU to process two or more tasks concurrently. Computers are now multi-core, meaning that they can do more than one thing simultaneously. This feature allows the CPU bandwidth to be used to its maximum extent resulting in superior performance and efficiency.
Types of Multiprocessing
There are 2 main types of multiprocessing, process-based and thread-based. In this case, both work to achieve multiple task programs simultaneously but in little bit different way.
Process-based Multiprocessing
Process-based multiprocessing- Several processes run simultaneously. A process is a program running on a computer. Each process gets its own memory space, a complete set of system resources.
Example
import java.io.IOException;
public class ProcessExample {
public static void main(String[] args) throws IOException, InterruptedException {
// Start Process 1
Process process1 = Runtime.getRuntime().exec("echo Hello Baibhav from C# Corner!");
// Start Process 2
Process process2 = Runtime.getRuntime().exec("echo Hello Baibhav from MCN Solutions!");
// Wait for the processes to complete
process1.waitFor();
process2.waitFor();
System.out.println("Both Process are done");
}
}
Output

Key characteristics of process-based multiprocessing
- Separate address spaces: Each process operates in its own memory space, meaning it does not share memory with other processes.
- Higher resource consumption: Because each process requires its own memory and resources, process-based multiprocessing can be more demanding on system resources.
- Greater isolation: Processes are isolated from each other, which enhances stability and security. If one process crashes, it generally does not affect the others.
Thread-based Multiprocessing
Thread-based multiprocessing, on the other hand, involves multiple threads running within the same process. A thread is the smallest unit of execution within a process. Threads share the same memory space and resources but can run independently and simultaneously.
Example
public class ThreadExample {
public static void main(String[] args) {
Thread thread1 = new Thread(() -> {
for (int i = 0; i < 3; i++) {
System.out.println("Thread 1: " + i);
try {
Thread.sleep(800);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
Thread thread2 = new Thread(() -> {
for (int i = 0; i < 3; i++) {
System.out.println("Thread 2: " + i);
try {
Thread.sleep(800);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
thread1.start();
thread2.start();
}
}
Output
Key characteristics of Thread-based Multiprocessing
- Shared address space: All threads within a process share the same memory space.
- Lower resource consumption: Threads use fewer resources compared to processes because they share the same address space and resources.
- Faster communication: Threads can communicate more efficiently since they share the same memory, resulting in faster execution.


Join the conversation! Your thoughts help the community grow.