It's more a question of design, than speed (Shared Memory is faster), domain sockets are definitively more UNIX-style, and do a lot less problems. In terms of choice know beforehand:

Domain Sockets advantages

  • blocking and non-blocking mode and switching between them

  • you don't have to free them when tasks are completed

Domain sockets disadvantages

  • must read and write in a linear fashion

Shared Memory advantages

  • non-linear storage

  • will never block

  • multiple programs can access it

Shared Memory disadvantages

  • need locking implementation

  • need manual freeing, even if unused by any program

That's all I can think of now. However, I'd go with domain sockets any day -- not to mention that it's a lot easier then to reimplement them to do distributed computing. The speed gain of Shared Memory will be lost because of the need of a safe design. However, if you know exactly what you're doing, and use the proper kernel calls, you can achieve greater speed with Shared Memory.

mmap is only good for constant size shared structures, not for variable communications.

i'm not sure why named pipes would be faster than Unix Domain Sockets but if its true i doubt by much (named pipes go through the VFS layer)

depending on the work being done Unix domain sockets would have the benifit of allowing you to move to normal sockets should you want to "cluster" the application on a network.