Multithreading in Real World
Threads are lightweight sub-processes, they share the common memory space.
When we write a program, each line is executed by JVM one by one, There is always at least one thread running internally in every program and this thread is used by JVM to execute statements in the program. Like in Java “main” is the thread executing the main class.
When we create more than one thread in a program, each thread has its own path of execution and all the threads share the same memory address space, data, and code in a program, this is known as Multithreading.
Multithreading Realtime Examples: