Java Inter Process communication and Inter Thread communication?

后端 未结 4 1352
遇见更好的自我
遇见更好的自我 2020-12-29 14:56

What is the difference between a Thread and a Process in the Java context? How is inter-Process communication and inter-Thread communication achieved in Java? Please point m

4条回答
  •  梦谈多话
    2020-12-29 15:44

    Inter-Thread Communication = threads inside the same JVM talking to each other

    Inter-Process Communication (IPC) = threads inside the same machine but running in different JVMs talking to each other

    Threads inside the same JVM can use pipelining through lock-free queues to talk to each other with nanosecond latency.

    Threads in different JVMs can use off-heap shared memory (usually acquired through the same memory-mapped file) to talk to each other with nanosecond latency.

    Threads in different machines can use the network to talk to each other with microsecond latency.

    For a complete explanation about lock-free queues and IPC you can check CoralQueue.

    Disclaimer: I am one of the developers of CoralQueue.

提交回复
热议问题