共享内存与消息传递 Shared memory versus message passing
2017-07-18 09:54
656 查看
Shared memory versus message passing
Tasks can use two different methods to communicate with each other. The first one is shared memory, and normally it is used when the tasks are running in the same computer. The tasks use the same memory area where they write
and read values. To avoid problems, the access to this shared memory has to be in a critical section protected by a synchronization mechanism.
The other synchronization mechanism is message passing and normally is used when the tasks are running in different computers. When a task needs to communicate with another, it sends a message that follows a predefined protocol. This communication can be synchronous
if the sender is blocked waiting for a response or asynchronous if the sender continues with their execution after sending the message.
任务可以使用两种不同的方法进行通信。 第一种是共享内存,通常当任务在同一台计算机上运行时使用。 任务使用相同的内存区域来写入和读取值。 为了避免问题,对共享内存的访问必须位于受同步机制保护的关键部分。
另一种同步机制是消息传递,当任务在不同的计算机上运行时通常使用。 当任务需要与另一个进行通信时,它会发送遵循预定义协议的消息。 如果发送方在发送消息后继续执行,发送方被阻塞等待响应或异步,则该通信可以是同步的。
Tasks can use two different methods to communicate with each other. The first one is shared memory, and normally it is used when the tasks are running in the same computer. The tasks use the same memory area where they write
and read values. To avoid problems, the access to this shared memory has to be in a critical section protected by a synchronization mechanism.
The other synchronization mechanism is message passing and normally is used when the tasks are running in different computers. When a task needs to communicate with another, it sends a message that follows a predefined protocol. This communication can be synchronous
if the sender is blocked waiting for a response or asynchronous if the sender continues with their execution after sending the message.
任务可以使用两种不同的方法进行通信。 第一种是共享内存,通常当任务在同一台计算机上运行时使用。 任务使用相同的内存区域来写入和读取值。 为了避免问题,对共享内存的访问必须位于受同步机制保护的关键部分。
另一种同步机制是消息传递,当任务在不同的计算机上运行时通常使用。 当任务需要与另一个进行通信时,它会发送遵循预定义协议的消息。 如果发送方在发送消息后继续执行,发送方被阻塞等待响应或异步,则该通信可以是同步的。
相关文章推荐
- 共享内存和消息队列,FIFO,管道传递消息的区别
- Qt中共享内存的实现--- QSharedMemory
- [eAccelerator] Can not create shared memory 共享内存不足
- Anonymous Shared Memory android 匿名共享内存
- 线程通信机制:共享内存 VS 消息传递
- 共享内存和消息传递
- 多线程进程间通讯共享内存(Shared Memory with IPC with threads)
- 线程通信机制:共享内存 VS 消息传递
- STORM_0010_Message passing implementation/消息传递的实现
- QtSharedMemory——Qt程序之间的内存共享机制
- QT 共享内存 QSharedMemory 和 内存映射
- VCL定义和使用CM_Message的原因(主要是内部控制,同时可简化参数传递,还可截住消息,统一走消息路线,还可省内存)
- 线程通信机制---共享内存:消息传递
- 线程通信机制:共享内存 VS 消息传递
- QSharedMemory 共享内存 进程间通信
- 线程通信机制:共享内存 VS 消息传递
- Handler消息(Message)传递机制详解
- 【linux开发】进程间通信命名管道-共享内存-内存映射-消息队列-信号量
- Boost.Interprocess使用手册翻译之四:在进程间共享内存 (Sharing memory between processes)
- linux 消息队列 和 内存共享的简短说明