Date: Sat, 10 May 1997 01:00:21 -0700 (PDT) From: Alex Belits <abelits@phobos.illtel.denver.co.us> To: Joerg Wunsch <joerg_wunsch@uriah.heep.sax.de> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: socketpair() Message-ID: <Pine.LNX.3.95.970510004612.25910C-100000@phobos.illtel.denver.co.us> In-Reply-To: <19970510085902.LT52179@uriah.heep.sax.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 10 May 1997, J Wunsch wrote: > > What are the advantages (if any) of using socketpair(PF_LOCAL, ... > > as compared with pipe()? > > socketpair() is guranteed to create a bidirectional connection. > pipe() incidentally does this in 4.4BSD, and i think also in FreeBSD > (which is now different from 4.4BSD since it has John D's revamped > pipe code), i think also in SVR4. > > pipe() is way faster in FreeBSD, since it avoids the overhead from the > network layers. I don't think that PF_LOCAL implements OOB data, so > you don't lose anything by using pipe() except portability when it > comes to a bidirectional connection. Actually no sane person will use pipe() and expect bidirectional connection to be created in any portable program -- all standards and most of implementations have unidirectional pipes. And having pipe() using AF_LOCAL/AF_UNIX is stupid in the first place unless the whole system is STREAMS-based. The advantage of BSD pipe() is lost on those systems, and STREAMS offer other features that may make program faster if it will utilize them. Fast pipes and slow pipes/sockets with STREAMS produce two mutually exclusive ways to optimize a program (thanks, AT&T! :-\), just like processes with fast context switching and threads with slow context switching for processes (thanks, Sun and M$! :-\). -- Alex
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.3.95.970510004612.25910C-100000>