UNIX Domain sockets vs Shared Memory (Mapped File)

后端 未结 4 471
心在旅途
心在旅途 2020-12-13 00:17

Can anyone tell, how slow are the UNIX domain sockets, compared to Shared Memory (or the alternative memory-mapped file)?

Thanks.

4条回答
  •  不思量自难忘°
    2020-12-13 00:30

    Both are inter process communication (IPC) mechanisms. UNIX domain sockets are uses for communication between processes on one host similar as TCP-Sockets are used between different hosts. Shared memory (SHM) is a piece of memory where you can put data and share this between processes. SHM provides you random access by using pointers, Sockets can be written or read but you cannot rewind or do positioning.

提交回复
热议问题