Difference between Process and Thread in Java

 

ProcessThread
1) Part of Concurrent Programming.1) Integral part of Concurrent Programming.
2) A process has a self-contained execution environment. 2) A thread is a lightweight process.
3) Process has its own memory space.3) Threads share the process's resources, including memory and open files.
4) Processes are synonymous with programs or applications.4) Threads do things such as memory management and signal handling.
5) A Java application can create additional processes using a ProcessBuilder object.5) A Main thread has the ability to create additional threads.
6) To facilitate communication between processes, most operating systems support Inter Process Communication (IPC) resources, such as pipes and sockets.6) Threads exist within a process. This makes for efficient, but potentially problematic, communication.

Processing time for a single core is shared among processes and threads through an OS feature called time slicing.

Time Slice or Preemption : A technique to implement multitasking in operating systems. The period of time for which a process is allowed to run in a preemptive multitasking system is generally called the time slice or quantum. The scheduler is run once every time slice to choose the next process to run.

Source: 1) The Java™ Tutorials
        2) Wikipedia

Facebook Comments

Leave a Reply

Your email address will not be published. Required fields are marked *