30/09/2018, 20:54

[KhongCoVietKey] I need an explaination for Definitions in System V IPC (Linux)

I’m sorry for using english here, but it’s better than vietnamese without “accent”?.
I’ve read definitions of

http://fscked.org/writings/SHM/shm-5.html

Shared segments

Overview

Shared segments in System V are a bit different than those obtained
with BSD’s mmap. First of all, while you do need a key for a segment
which is usually obtained by running ftok(2) on some file in the
filesyetem, System V shared segments exist only in memory. Because of
this, System V shared segments must persist after the termination of a
process. It is the responsibility of the programmer to ensure that all
of his segments are removed from the system, otherwise his memory
leaks become system wide.

Message Queues

Overview

Message queues provide a memory based FIFO between two processes. The
primary difference between a System V message queue and a socket or
named pipe is that message queues may have multiple processes reading
and writing from and to them, or no readers at all.

Semaphores

Overview

Semaphores are data structures that are used for synchronization
between two or more processes. Basically they can be viewed as a
single integer that represents the amout of resources avaialable. When
a process wants a resource, it checks the value of the semaphore, and
if it it nonzero, it decrements the appropriate number from the
semaphore in accordance to the amout of resources it wishes to use.
The kernel will block the process if the semaphore is zero or doesn’t
have a value high enough for the decrement. In System V IPC, you may
request a set or an array of semaphores at once.

Can you explain for me in vietnamese those definitions, application and how it works by some exemple or simply recommend me some documents.

Bài liên quan
0