UNIX网络编程(卷2):进程间通信(英文版·第2版)

Part 1 Introduction 1
简介
Chapter 1 Introduction 3
简介
1.1 Introduction 3
概述
1.2 Processes, Threads, and the Sharing of Information 5
进程、线程与信息共享
1.3 Persistence of IPC Objects 6
IPC对象的持续性
1.4 Name Spaces 7
名字空间
1.5 Effect of fork, exec, and exit on IPC Objects 9
fork、exec和exit对IPC对象的影响
1.6 Error Handling: Wrapper Functions 11
错误处理:包装函数
1.7 Unix Standards 13
Unix标准
1.8 Road Map to IPC Examples in the Text 15
本书中IPC示例的路线图
1.9 Summary 16
小结
Chapter 2 Posix IPC 19
2.1 Introduction 19
概述
2.2 IPC Names 19
IPC名字
2.3 Creating and Opening IPC Channels 22
创建与打开IPC通道
2.4 IPC Permissions 25
IPC权限
2.5 Summary 26
小结
Chapter 3 System V IPC 27
3.1 Introduction 27
概述
3.2 key_t Keys and ftok Function 28
key_t键和ftok函数
3.3 ipc_perm Structure 30
ipc_perm结构
3.4 Creating and Opening IPC Channels 30
创建与打开IPC通道
3.5 IPC Permissions 32
IPC权限
3.6 Identifier Reuse 34
标识符重用
3.7 ipcs and ipcrm Programs 36
ipcs和ipcrm程序
3.8 Kernel Limits 36
内核限制
3.9 Summary 38
小结
Part 2 Message Passing 41
消息传递
Chapter 4 Pipes and FIFOs 43
管道和FIFO
4.1 Introduction 43
概述
4.2 A Simple Client-Server Example 43
一个简单的客户-服务器示例
4.3 Pipes 44
管道
4.4 Full-Duplex Pipes 50
全双工管道
4.5 popen and pclose Functions 52
popen和pclose函数
4.6 FIFOs 54
4.7 Additional Properties of Pipes and FIFOs 58
管道和FIFO的额外属性
4.8 One Server, Multiple Clients 60
单服务器,多客户
4.9 Iterative versus Concurrent Servers 66
迭代服务器与并发服务器的比较
4.10 Streams and Messages 67
流与消息
4.11 Pipe and FIFO Limits 72
管道和FIFO限制
4.12 Summary 73
小结
Chapter 5 Posix Message Queues 75
Posix消息队列
5.1 Introduction 75
概述
5.2 mq_open, mq_close, and mq_unlink Functions 76
mq_open、mq_close和mq_unlink函数
5.3 mq_getattr and mq_setattr Functions 79
mq_getattr和mq_setattr函数
5.4 mq_send and mq_receive Functions 82
mq_send和mq_receive函数
5.5 Message Queue Limits 86
消息队列限制
5.6 mq_notify Function 87
mq_notify函数
5.7 Posix Realtime Signals 98
Posix实时信号
5.8 Implementation Using Memory-Mapped I/O 106
使用内存映射I/O实现
5.9 Summary 126
小结
Chapter 6 System V Message Queues 129
System V消息队列
6.1 Introduction 129
概述
6.2 msgget Function 130
msgget函数
6.3 msgsnd Function 131
msgsnd函数
6.4 msgrcv Function 132
msgrcv函数
6.5 msgctl Function 134
msgctl函数
6.6 Simple Programs 135
简单的程序
6.7 Client-Server Example 140
客户-服务器示例
6.8 Multiplexing Messages 142
多路复用消息
6.9 Message Queues with select and poll 151
消息队列上使用select和poll
6.10 Message Queue Limits 152
消息队列限制
6.11 Summary 155
小结
Part 3 Synchronization 157
同步
Chapter 7 Mutexes and Condition Variables 159
互斥锁和条件变量
7.1 Introduction 159
概述
7.2 Mutexes: Locking and Unlocking 159
互斥锁:加锁与解锁
7.3 Producer-Consumer Problem 161
生产者 消费者问题
7.4 Locking versus Waiting 165
加锁与等待
7.5 Condition Variables: Waiting and Signaling 167
条件变量:等待与信号发送
7.6 Condition Variables: Timed Waits and Broadcasts 171
条件变量:定时等待和广播
7.7 Mutexes and Condition Variable Attributes 172
互斥锁和条件变量的属性
7.8 Summary 174
小结
Chapter 8 Read-Write Locks 177
读写锁
8.1 Introduction 177
概述
8.2 Obtaining and Releasing Read-Write Locks 178
获取与释放读写锁
8.3 Read-Write Lock Attributes 179
读写锁属性
8.4 Implementation Using Mutexes and Condition Variables 179
使用互斥锁和条件变量实现
8.5 Thread Cancellation 187
线程取消
8.6 Summary 192
小结
Chapter 9 Record Locking 193
记录加锁
9.1 Introduction 193
概述
9.2 Record Locking versus File Locking 197
记录加锁与文件加锁
9.3 Posix fcntl Record Locking 199
Posix fcntl记录加锁
9.4 Advisory Locking 203
劝告性加锁
9.5 Mandatory Locking 204
强制性加锁
9.6 Priorities of Readers and Writers 207
读出者和写入者的优先级
9.7 Starting Only One Copy of a Daemon 213
只启动守护进程的一个副本
9.8 Lock Files 214
锁文件
9.9 NFS Locking 216
NFS加锁
9.10 Summary 216
小结
Chapter 10 Posix Semaphores 219
Posix信号量
10.1 Introduction 219
概述
10.2 sem_open, sem_close, and sem_unlink Functions 225
sem_open、sem_close和sem_unlink函数
10.3 sem_wait and sem_trywait Functions 226
sem_wait和sem_trywait函数
10.4 sem_post and sem_getvalue Functions 227
sem_post和sem_getvalue函数
10.5 Simple Programs 228
简单的程序
10.6 Producer-Consumer Problem 233
生产者-消费者问题
10.7 File Locking 238
文件加锁
10.8 sem_init and sem_destroy Functions 238
sem_init和sem_destroy函数
10.9 Multiple Producers, One Consumer 242
多生产者,单消费者
10.10 Multiple Producers, Multiple Consumers 245
多生产者,多消费者
10.11 Multiple Buffers 249
多缓冲区
10.12 Sharing Semaphores between Processes 256
进程间共享信号量
10.13 Semaphore Limits 257
信号量限制
10.14 Implementation Using FIFOs 257
使用FIFO实现
10.15 Implementation Using Memory-Mapped I/O 262
使用内存映射I/O实现
10.16 Implementation Using System V Semaphores 271
使用System V信号量实现
10.17 Summary 278
小结
Chapter 11 System V Semaphores 281
System V信号量
11.1 Introduction 281
概述
11.2 semget Function 282
semget函数
11.3 semop Function 285
semop函数
11.4 semctlFunction 287
semctl函数
11.5 Simple Programs 289
简单的程序
11.6 File Locking 294
文件加锁
11.7 Semaphore Limits 296
信号量限制
11.8 Summary 300
小结
Part 4 Shared Memory 301
共享内存
Chapter 12 Shared Memory Introduction 303
共享内存简介
12.1 Introduction 303
概述
12.2 mmap, munmap, and msync Functions 307
mmap、munmap和msync函数
12.3 Increment Counter in a Memory-Mapped File 311
内存映射文件中的计数器递加
12.4 4.4BSD Anonymous Memory Mapping 315
4.4BSD匿名内存映射
12.5 SVR4 /dev/zero Memory Mapping 316
SVR4 /dev/zero内存映射
12.6 Referencing Memory-Mapped Objects 317
引用内存映射的对象
12.7 Summary 322
小结
Chapter 13 Posix Shared Memory 325
Posix共享内存
13.1 Introduction 325
概述
13.2 shm_open and shm_unlink Functions 326
shm_open和shm_unlink函数
13.3 ftruncate and fstat Functions 327
ftruncate和fstat函数
13.4 Simple Programs 328
简单的程序
13.5 Incrementing a Shared Counter 333
共享计数器递加
13.6 Sending Messages to a Server 336
向服务器发送消息
13.7 Summary 342
小结
Chapter 14 System V Shared Memory 343
System V共享内存
14.1 Introduction 343
概述
14.2 shmget Function 343
shmget函数
14.3 shmat Function 344
shmat函数
14.4 shmdt Function 345
shmdt函数
14.5 shmctl Function 345
shmctl函数
14.6 Simple Programs 346
简单的程序
14.7 Shared Memory Limits 349
共享内存限制
14.8 Summary 351
小结
Part 5 Remote Procedure Calls 353
远程过程调用
Chapter 15 Doors 355
门
15.1 Introduction 355
概述
15.2 door_call Function 361
door_call函数
15.3 door_create Function 363
door_create函数
15.4 door_return Function 364
door_return函数
15.5 door_cred Function 365
door_cred函数
15.6 door_info Function 365
door_info函数
15.7 Examples 366
示例
15.8 Descriptor Passing 379
描述符传递
15.9 door_server_create Function 384
door_server_create函数
15.10 door_bind, door_unbind, and door_revoke Functions 390
door_bind、door_unbind和door_revoke函数
15.11 Premature Termination of Client or Server 390
客户或服务器的过早终止
15.12 Summary 397
小结
Chapter 16 Sun RPC 399
16.1 Introduction 399
概述
16.2 Multithreading 407
多线程技术
16.3 Server Binding 411
服务器绑定
16.4 Authentication 414
鉴别
16.5 Timeout and Retransmission 417
超时和重传
16.6 Call Semantics 422
调用语义
16.7 Premature Termination of Client or Server 424
客户或服务器的过早终止
16.8 XDR: External Data Representation 426
XDR:外部数据表示
16.9 RPC Packet Formats 444
RPC分组格式
16.10 Summary 449
小结
Epilogue 453
后记
Appendix A Performance Measurements 457
性能测量
A.1 Introduction 457
概述
A.2 Results 458
结果
A.3 Message Passing Bandwidth Programs 467
消息传递带宽程序
A.4 Message Passing Latency Programs 480
消息传递延迟程序
A.5 Thread Synchronization Programs 486
线程同步程序
A.6 Process Synchronization Programs 497
进程同步程序
Appendix B A Threads Primer 501
线程入门
B.1 Introduction 501
概述
B.2 Basic Thread Functions: Creation and Termination 502
基本线程函数:创建和终止
Appendix C Miscellaneous Source Code 505
其他源代码
C.1 unpipc.h Header 505
unpipc.h头文件
C.2 config.h Header 509
config.h头文件
C.3 Standard Error Functions 510
标准错误处理函数
Appendix D Solutions to Selected Exercises 515
精选习题答案
Bibliography 535
参考文献
Index 539
索引
简介
Chapter 1 Introduction 3
简介
1.1 Introduction 3
概述
1.2 Processes, Threads, and the Sharing of Information 5
进程、线程与信息共享
1.3 Persistence of IPC Objects 6
IPC对象的持续性
1.4 Name Spaces 7
名字空间
1.5 Effect of fork, exec, and exit on IPC Objects 9
fork、exec和exit对IPC对象的影响
1.6 Error Handling: Wrapper Functions 11
错误处理:包装函数
1.7 Unix Standards 13
Unix标准
1.8 Road Map to IPC Examples in the Text 15
本书中IPC示例的路线图
1.9 Summary 16
小结
Chapter 2 Posix IPC 19
2.1 Introduction 19
概述
2.2 IPC Names 19
IPC名字
2.3 Creating and Opening IPC Channels 22
创建与打开IPC通道
2.4 IPC Permissions 25
IPC权限
2.5 Summary 26
小结
Chapter 3 System V IPC 27
3.1 Introduction 27
概述
3.2 key_t Keys and ftok Function 28
key_t键和ftok函数
3.3 ipc_perm Structure 30
ipc_perm结构
3.4 Creating and Opening IPC Channels 30
创建与打开IPC通道
3.5 IPC Permissions 32
IPC权限
3.6 Identifier Reuse 34
标识符重用
3.7 ipcs and ipcrm Programs 36
ipcs和ipcrm程序
3.8 Kernel Limits 36
内核限制
3.9 Summary 38
小结
Part 2 Message Passing 41
消息传递
Chapter 4 Pipes and FIFOs 43
管道和FIFO
4.1 Introduction 43
概述
4.2 A Simple Client-Server Example 43
一个简单的客户-服务器示例
4.3 Pipes 44
管道
4.4 Full-Duplex Pipes 50
全双工管道
4.5 popen and pclose Functions 52
popen和pclose函数
4.6 FIFOs 54
4.7 Additional Properties of Pipes and FIFOs 58
管道和FIFO的额外属性
4.8 One Server, Multiple Clients 60
单服务器,多客户
4.9 Iterative versus Concurrent Servers 66
迭代服务器与并发服务器的比较
4.10 Streams and Messages 67
流与消息
4.11 Pipe and FIFO Limits 72
管道和FIFO限制
4.12 Summary 73
小结
Chapter 5 Posix Message Queues 75
Posix消息队列
5.1 Introduction 75
概述
5.2 mq_open, mq_close, and mq_unlink Functions 76
mq_open、mq_close和mq_unlink函数
5.3 mq_getattr and mq_setattr Functions 79
mq_getattr和mq_setattr函数
5.4 mq_send and mq_receive Functions 82
mq_send和mq_receive函数
5.5 Message Queue Limits 86
消息队列限制
5.6 mq_notify Function 87
mq_notify函数
5.7 Posix Realtime Signals 98
Posix实时信号
5.8 Implementation Using Memory-Mapped I/O 106
使用内存映射I/O实现
5.9 Summary 126
小结
Chapter 6 System V Message Queues 129
System V消息队列
6.1 Introduction 129
概述
6.2 msgget Function 130
msgget函数
6.3 msgsnd Function 131
msgsnd函数
6.4 msgrcv Function 132
msgrcv函数
6.5 msgctl Function 134
msgctl函数
6.6 Simple Programs 135
简单的程序
6.7 Client-Server Example 140
客户-服务器示例
6.8 Multiplexing Messages 142
多路复用消息
6.9 Message Queues with select and poll 151
消息队列上使用select和poll
6.10 Message Queue Limits 152
消息队列限制
6.11 Summary 155
小结
Part 3 Synchronization 157
同步
Chapter 7 Mutexes and Condition Variables 159
互斥锁和条件变量
7.1 Introduction 159
概述
7.2 Mutexes: Locking and Unlocking 159
互斥锁:加锁与解锁
7.3 Producer-Consumer Problem 161
生产者 消费者问题
7.4 Locking versus Waiting 165
加锁与等待
7.5 Condition Variables: Waiting and Signaling 167
条件变量:等待与信号发送
7.6 Condition Variables: Timed Waits and Broadcasts 171
条件变量:定时等待和广播
7.7 Mutexes and Condition Variable Attributes 172
互斥锁和条件变量的属性
7.8 Summary 174
小结
Chapter 8 Read-Write Locks 177
读写锁
8.1 Introduction 177
概述
8.2 Obtaining and Releasing Read-Write Locks 178
获取与释放读写锁
8.3 Read-Write Lock Attributes 179
读写锁属性
8.4 Implementation Using Mutexes and Condition Variables 179
使用互斥锁和条件变量实现
8.5 Thread Cancellation 187
线程取消
8.6 Summary 192
小结
Chapter 9 Record Locking 193
记录加锁
9.1 Introduction 193
概述
9.2 Record Locking versus File Locking 197
记录加锁与文件加锁
9.3 Posix fcntl Record Locking 199
Posix fcntl记录加锁
9.4 Advisory Locking 203
劝告性加锁
9.5 Mandatory Locking 204
强制性加锁
9.6 Priorities of Readers and Writers 207
读出者和写入者的优先级
9.7 Starting Only One Copy of a Daemon 213
只启动守护进程的一个副本
9.8 Lock Files 214
锁文件
9.9 NFS Locking 216
NFS加锁
9.10 Summary 216
小结
Chapter 10 Posix Semaphores 219
Posix信号量
10.1 Introduction 219
概述
10.2 sem_open, sem_close, and sem_unlink Functions 225
sem_open、sem_close和sem_unlink函数
10.3 sem_wait and sem_trywait Functions 226
sem_wait和sem_trywait函数
10.4 sem_post and sem_getvalue Functions 227
sem_post和sem_getvalue函数
10.5 Simple Programs 228
简单的程序
10.6 Producer-Consumer Problem 233
生产者-消费者问题
10.7 File Locking 238
文件加锁
10.8 sem_init and sem_destroy Functions 238
sem_init和sem_destroy函数
10.9 Multiple Producers, One Consumer 242
多生产者,单消费者
10.10 Multiple Producers, Multiple Consumers 245
多生产者,多消费者
10.11 Multiple Buffers 249
多缓冲区
10.12 Sharing Semaphores between Processes 256
进程间共享信号量
10.13 Semaphore Limits 257
信号量限制
10.14 Implementation Using FIFOs 257
使用FIFO实现
10.15 Implementation Using Memory-Mapped I/O 262
使用内存映射I/O实现
10.16 Implementation Using System V Semaphores 271
使用System V信号量实现
10.17 Summary 278
小结
Chapter 11 System V Semaphores 281
System V信号量
11.1 Introduction 281
概述
11.2 semget Function 282
semget函数
11.3 semop Function 285
semop函数
11.4 semctlFunction 287
semctl函数
11.5 Simple Programs 289
简单的程序
11.6 File Locking 294
文件加锁
11.7 Semaphore Limits 296
信号量限制
11.8 Summary 300
小结
Part 4 Shared Memory 301
共享内存
Chapter 12 Shared Memory Introduction 303
共享内存简介
12.1 Introduction 303
概述
12.2 mmap, munmap, and msync Functions 307
mmap、munmap和msync函数
12.3 Increment Counter in a Memory-Mapped File 311
内存映射文件中的计数器递加
12.4 4.4BSD Anonymous Memory Mapping 315
4.4BSD匿名内存映射
12.5 SVR4 /dev/zero Memory Mapping 316
SVR4 /dev/zero内存映射
12.6 Referencing Memory-Mapped Objects 317
引用内存映射的对象
12.7 Summary 322
小结
Chapter 13 Posix Shared Memory 325
Posix共享内存
13.1 Introduction 325
概述
13.2 shm_open and shm_unlink Functions 326
shm_open和shm_unlink函数
13.3 ftruncate and fstat Functions 327
ftruncate和fstat函数
13.4 Simple Programs 328
简单的程序
13.5 Incrementing a Shared Counter 333
共享计数器递加
13.6 Sending Messages to a Server 336
向服务器发送消息
13.7 Summary 342
小结
Chapter 14 System V Shared Memory 343
System V共享内存
14.1 Introduction 343
概述
14.2 shmget Function 343
shmget函数
14.3 shmat Function 344
shmat函数
14.4 shmdt Function 345
shmdt函数
14.5 shmctl Function 345
shmctl函数
14.6 Simple Programs 346
简单的程序
14.7 Shared Memory Limits 349
共享内存限制
14.8 Summary 351
小结
Part 5 Remote Procedure Calls 353
远程过程调用
Chapter 15 Doors 355
门
15.1 Introduction 355
概述
15.2 door_call Function 361
door_call函数
15.3 door_create Function 363
door_create函数
15.4 door_return Function 364
door_return函数
15.5 door_cred Function 365
door_cred函数
15.6 door_info Function 365
door_info函数
15.7 Examples 366
示例
15.8 Descriptor Passing 379
描述符传递
15.9 door_server_create Function 384
door_server_create函数
15.10 door_bind, door_unbind, and door_revoke Functions 390
door_bind、door_unbind和door_revoke函数
15.11 Premature Termination of Client or Server 390
客户或服务器的过早终止
15.12 Summary 397
小结
Chapter 16 Sun RPC 399
16.1 Introduction 399
概述
16.2 Multithreading 407
多线程技术
16.3 Server Binding 411
服务器绑定
16.4 Authentication 414
鉴别
16.5 Timeout and Retransmission 417
超时和重传
16.6 Call Semantics 422
调用语义
16.7 Premature Termination of Client or Server 424
客户或服务器的过早终止
16.8 XDR: External Data Representation 426
XDR:外部数据表示
16.9 RPC Packet Formats 444
RPC分组格式
16.10 Summary 449
小结
Epilogue 453
后记
Appendix A Performance Measurements 457
性能测量
A.1 Introduction 457
概述
A.2 Results 458
结果
A.3 Message Passing Bandwidth Programs 467
消息传递带宽程序
A.4 Message Passing Latency Programs 480
消息传递延迟程序
A.5 Thread Synchronization Programs 486
线程同步程序
A.6 Process Synchronization Programs 497
进程同步程序
Appendix B A Threads Primer 501
线程入门
B.1 Introduction 501
概述
B.2 Basic Thread Functions: Creation and Termination 502
基本线程函数:创建和终止
Appendix C Miscellaneous Source Code 505
其他源代码
C.1 unpipc.h Header 505
unpipc.h头文件
C.2 config.h Header 509
config.h头文件
C.3 Standard Error Functions 510
标准错误处理函数
Appendix D Solutions to Selected Exercises 515
精选习题答案
Bibliography 535
参考文献
Index 539
索引
W.Richarqd Stevens,国际知名的LINIX和网络专家,备受赞誉的技术作家。他1951年2月5日出生于赞比亚,后随父母回到美国。中学时就读于弗吉尼亚菲什伯恩军事学校,1973年获得密歇根大学航空和航天工程学士学位。1975年至1982年,他在亚利桑那州图森市的基特峰国家天文合从事计算机编程工作,业余时间喜爱飞行运动,做过兼职飞行教练。这期间他分别在1978年和1982年获得亚利桑那大学系统工程硕士和博士学位。此后他去康涅狄格州纽黑文的健康系统国际公司任主管计算机服务的副总裁。1990年他回到图森,从事专业技术写作和咨询工作。写下了多种经典的传世之作,包括《TCP/IP详解》(三卷)、《UNIX环境高级编程》和《UNIX网络编程》(两卷)。Steverls于1999年9月1日去世,年仅48岁。2000年他被国际权威机构USENIX追授“终身成就奖”。
《UNIX网络编程 卷2:进程间通信(英文版·第2版)》是一部UNIX网络编程的经典之作。进程间通信(IPC)几乎是所有Unix程序性能的关键,理解IPC也是理解如何开发不同主机间网络应用程序的必要条件。《UNIX网络编程 卷2:进程间通信(英文版·第2版)》从对Posix IPC和System V IPC的内部结构开始讨论,全面深入地介绍了4种IPC形式:消息传递(管道、FIFO、消息队列)、同步(互斥锁、条件变量、读写锁、文件与记录锁、信号量)、共享内存(匿名共享内存、具名共享内存)及远程过程调用(Solaris 门、Sun RPC)。附录中给出了测量各种IPC形式性能的方法。
《UNIX网络编程 卷2:进程间通信(英文版·第2版)》内容详尽且具权威性,几乎每章都提供精选的习题,并提供了部分习题的答案,是网络研究和开发人员理想的参考书。
《UNIX网络编程 卷2:进程间通信(英文版·第2版)》内容详尽且具权威性,几乎每章都提供精选的习题,并提供了部分习题的答案,是网络研究和开发人员理想的参考书。
比价列表
公众号、微信群

微信公众号

实时获取购书优惠