It is especially common with
daemons and server processes that spawn child processes to handle client connections. IPC comes
in three varieties: shared memory, semaphores, and message queues.
Shared memory??”Shared memory is just what the name suggests: a region or segment
of memory specifically set aside for use by multiple processes. Because shared memory is
never paged out to disk, it is an extremely fast way for two processes to exchange data.
Semaphores??”Semaphores, briefly mentioned in the ???Preemptive Multitasking??? section,
serve as flags that indicate a condition controlling the behavior of processes. For example,
one process can set a semaphore to indicate a specific file is in use. Before other processes
attempt to access that file, they check the semaphore??™s status and don??™t (or shouldn??™t)
attempt to access the file if the flag is set.
Message queues??”Message queues are first-in-first-out (FIFO) data structures that make
it possible for processes to exchange short messages in a structured, orderly manner.
Message queues are not necessarily accessed in FIFO data structures. System V UNIXstyle
message queues are, but POSIX message queues enable readers to pull messages
out of a queue in an arbitrary order.
Shared memory, semaphores, and message queues are idiomatic in the Linux development environment.
Pages:
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380