🔥 Burn Fat Fast. Discover How! 💪

What is the difference between a Process and a Thread? #thread | Java Tech News

What is the difference between a Process and a Thread?
#threads #processes #os
OS Process
Only one process can be in running state on a single core. Processes communicate either with message passing or shared memory sectors. A context switch is a process of switching the CPU from one process to another, and is a relatively expensive operation. The kernel must manage and schedule processes.
Kernel Threads
Kernel thread, also known as a lightweight process, is a thread that the operation system knows about. Since threads are sharing an address space their context switch is faster than processes'. But still, the kernel must manage and schedule threads.
User-level Threads
This kind of threads is not known to the OS so the scheduling of these threads is done via some library thread-scheduler. Java threads are actually user-level threads, they don't require system calls to create them or context switches to move between them. They can be much faster and lighter than kernel threads.