2

In Linux there are various ways for inter process communication, for example, shared memory, (named) pipe, socket, message queue.

What are equivalent or similar ways in which Linux kernel and processes communicate? Are the following some of the ways?

Is it correct that interprocess communication can transfer arbitrary data between processes, while the forms of data which can be transferred between kernel and process are more limited (according to the ways that I list)?

Thanks.

  • Please ask about a specific case you want to know. There are always sort of permission check for userland accessing data, no matter where ever the data is. – 炸鱼薯条德里克 Mar 26 at 12:13
2

Inter-process communications are in some respect a special case of communications between user-space and the kernel, since inter-process communications are always mediated by the kernel (at least for setup and teardown).

Note that when a process calls into the kernel, the process is still running, but in kernel mode. So distinguishing between a process and the kernel, while convenient, is somewhat inaccurate and can lead to misunderstandings. The events you’ve listed do cause data to be passed from user-space to the kernel, and processing to be performed in kernel mode; other examples include

  • ioctl (which is really a system call, but is so generic that it’s useful to consider it separately);
  • memory-mapped files (memory-mapping also being one way of implementing shared memory between processes);
  • netlink sockets.

The nature of the data which can be transferred between user-space and the kernel isn’t inherently limited in any way; for example, write allows you to write anything to a file, and send allows you to write anything to a socket. Whether the data is meaningful depends on what you’re doing; see your own Must an application-layer protocol exist for communication between any two programs using sockets? question (which applies to any form of communication).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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