In the answer of this, it mentioned:
People also hear that X uses the "network" and think this is going to be a performance bottleneck. "Network" here means local UNIX domain socket, which has negligible overhead on modern Linux. Things that would bottleneck on the network, there are X extensions to make fast (shared memory pixmaps, DRI, etc.). Threads in-process wouldn't necessarily be faster than the X socket, because the bottlenecks have more to do with the inherent problem of coordinating multiple threads or processes accessing the same hardware, than with the minimal overhead of local sockets.
I don't get it. I always think that multiple threads communicate by shared variables should be faster than multiple processes communicate by Unix domain socket. So...am I wrong? Is that coordinating multiple threads such a time consuming job? And the order of how processes get scheduled does not affect the performance of the Unix domain socket at all?
Any idea? Please...
Sorry, I didn't make the question clear. What I wanted to ask is about IPC efficiency rather than X Window/Wayland system.
I just want to know why UNIX domain socket can be faster than shared memory? AFAIK, shared memory is the most primitive way to communicate between processes and threads isn't it? So UNIX domain socket should be built on top of shared memory mechanism (accompany with proper locking). How come a student (i.e. Unix domain socket) can outperform his teacher (i.e. shared memory)?