Process And Thread
When program runs under the concurrency environment, Then Thread will be in lead roles. Environment which manages some threads called process.
Threads – Thread are light weight piece of code which runs under the concurrent environment. Many threads can run concurrently and share the same heap memory but every thread has its own stack allocation area. Threads can run under the process.
Process – Process is an execution of program and has its own memory allocation areas. A JVM runs in a single process and threads runs under the JVM and share a single heap memory allocation area.
Threads exist within a process — every process has at least one. Threads share the process's resources, including memory and open files. This makes for efficient, but potentially problematic, communication.