本文主要是介绍Thread VS Process,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1) Both process and Thread are independent path of execution but one process can have multiple Threads.
2) Every process has its own memory space, executable code and a unique process identifier (PID) while every thread has its own stack in Java but it uses process main memory and share it with other threads.
3) Threads are also refereed as task or light weight process (LWP) in operating system
4) Threads from same process can communicate with each other by using Programming language construct like wait and notify in Java and much simpler than inter process communication.
5) Another difference between Process and Thread in Java is that it's How Thread and process are created. It's easy to create Thread as compared to Process which requires duplication of parent process.
这篇关于Thread VS Process的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!