I'm reading Docker in Action and there is this sentence:

Docker creates a unique IPC namespace for each container by default. The Linux IPC namespace partitions share memory primitives such as named shared memory blocks and semaphores, as well as message queues.

Despite the examples, I can't figure out what is the concept behind memory primitives, would you please explain this term?

man namespaces has a section on IPC namespaces.

IPC namespaces isolate certain IPC resources, namely, System V IPC objects (see svipc(7)) and (since Linux 2.6.30) POSIX message queues (see mq_overview(7)). The common characteristic of these IPC mechanisms is that IPC objects are identified by mechanisms other than filesystem pathnames.

man svipc says it has three types of objects; shared memory objects, message queues, and semaphore sets (a semaphore is a more general case of a mutex). Instead of a filesystem path, each object has a numeric ID.

And POSIX message queues are identified by a name, similar to a filename. (The Linux implementation uses virtual files accessed through /dev/mqueue/).

System V IPC should be considered obsolescent and difficult to use.

Notice that Linux IPC namespaces do not isolate POSIX SHM. The Linux implementation accesses the objects through /dev/shm/, which is a tmpfs virtual filesystem. If you want to isolate POSIX SHM, you use mount namespaces to change the filesystem that is mounted at /dev/shm/.

Machine problem will exercise primitives for process control, signal management, pipes, and shared memory. The primitives in Unix are listed as follows:

 • Process Control
     fork:
     exec:
 • Signal Management
     sigset:
     kill:
 • Pipes and Files
     pipe:
     mknod:
     unlink:
     read/write:
 • Shared Memory
     shmget:
     shmat:
 • Semaphores (System V style)
     semget:
     semop:
 • ipcs: This command reports on the status of inter-process communication facilities. Allows you to monitor the correct use and operation of the interprocess communication primitives in your program.

• ipcrm: Remove a message queue, semaphore set, or shared memory ID. This comes in handy if your program does not clean up things correctly.

• kill: Terminate or signal a process. Comes in handy to clean up your processes.

• ps: Report on process status. This at least lists all your processes.

Reference

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.