tags:

views:

189

answers:

2

Ok, this is a stupid question...

Are pipes, FIFOs, and sockets shared memory or message passing..?

At first I thought they were shared memory because pipes use read() and write(), but now I'm just totally confused. Technically the "messages" are stored in the kernal's address space, so is it a message or stored memory? I have an exam for Intro to OS's in a few hours, and I just need this cleared up. Thanks in advance!

+3  A: 

message passing, as they require participation on both sides, sender and receiver in case of sockets for example. they can be implemented using shared memory, but communication pattern is message passing

aaa
+1: The presence or absence of a "shared buffer" has no relevance at all -- it's an implementation detail. A FIFO can certainly work without a shared buffer -- it would be slow, but it would work. Shared memory, on the other hand, can't work without shared memory. The shared memory isn't an implementation detail, that's the function being offered.
S.Lott
A: 

It's message passing. You specify a buffer to write into the socket buffer, and you find out how much space it has available beforehand using getTxAvailable() or whatever. It's not really shared memory as it does a buffer blit operation to help encapsulation of the socket. If you're talking about socket on client to socket on server, that's also message passing. Something like a Java direct buffer or file-mapped memory is shared memory.

Chris Dennett