IPC(一)
来源:互联网 发布:java根据ip获取经纬度 编辑:程序博客网 时间:2024/04/29 10:55
Communication Facilities
We can break the communication facilities into two categories:
Datatransfer facilities: The key factor distinguishing these facilities is the notion of writing and reading. Inorder to communicate, one process writes data to the IPC facility, and another process reads the data. These facilities require two data transfers between user memory and kernel memory: one transfer from user memory to kernel memory during writing, and another transfer from kernel memory to user memory during reading.
Shared memory: Shared memory allows processes to exchange information byplacing it in a region of memory that is shared between the processes. A process can make data available to other processes by placing it in the shared memory region. Because communication doesn’t require system calls or data transfer between user memory and kernel memory, sharedmemory can provide very fast communication.
Data transfer
We can further break data-transfer facilities into the following subcategories:
Byte stream: The data exchanged via pipes, FIFOs, and stream sockets is an undelimited byte stream. Each read operation may read an arbitrary number of bytes from the IPC facility, regardless of the size of blocks written by the writer.This model mirrors the traditional UNIX “file as a sequence of bytes” model.
Message: The data exchanged via System V message queues, POSIX messagequeues, and datagram sockets takes the form of delimited messages. Each readoperation reads a whole message, as written by the writer process. It is not possible to read part of a message, leaving the remainder on the IPC facility; nor is it possible to read multiple messages in a single read operation.
Pseudoterminals: A pseudoterminal is a communication facility intended for use in specialized situations.
A few general features distinguish data-transfer facilities from shared memory:
1) Although a data transfer facility may have multiple readers, reads are destructive.A read operation consumes data, and that data is not available to any other process.
2) Synchronization between the reader and writer processes is automatic. If a reader attempts to fetch data from a data-transfer facility that currently has no data, then (by default) the read operation will block until some process writes data to the facility.
3) Although shared memory provides fast communication, this speed advantageis offset by the need to synchronize operations on the shared memory. Forexample, one process should not attempt to access a data structure in theshared memory while another process is updating it. A semaphore is the usualsynchronization method used with shared memory.
4) Data placed in shared memory is visible to all of the processes that share that memory. (This contrasts with the destructive read semantics described above for data-transfer facilities.)
以上内容均来自:《The Linux Programming interface - A Linux and UNIX System Programming Handbook》
- IPC(一)
- IPC机制(一)
- IPC机制(一)
- 读书笔记--IPC机制(一)
- android IPC机制(一)
- Android IPC机制(一)
- android IPC学习 (一)
- ipc(一)
- IPC简单介绍(一)消息队列
- IPC (一) 使用WM_COPYDATA 实现
- Android中的IPC通信(一)
- Android IPC 之 AIDL(一)
- 【2016.04.11】IPC机制(一)
- 安卓IPC机制(一)
- IPC-进程间通信(一)Messager
- IPC机制--开发艺术探索(一)
- ipc(一)无名管道示例
- Android IPC机制学习笔记(一)
- Linux下5种动态库运行时搜索路径的方法
- 表变量和临时表的比较
- Android如何进行进程间通信之——Binder
- 在ubuntu下使用emacs对c++程序进行调试
- Java 如何有效地避免OOM:善于利用软引用和弱引用
- IPC(一)
- vijos1028魔族密码
- 一位想学很多的大一同学
- 强连通分量 CCF201509-4 高速公路
- 5_gdb跟踪分析系统调用system_call的处理过程
- iOS xcode 安装插件 包括---- /// 添加注释 以及 输入代码行提示 等
- 常用关键字和魔术方法
- 一起talk C栗子吧(第一百二十七回:C语言实例--查看main函数的参数)
- 一个 Linux 上分析死锁的简单方法