The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: John Labovitz <johnl@johnlabovitz.com>
To: The Eunuchs Hysterical Society <tuhs@tuhs.org>
Subject: [TUHS] Re: Research Datakit notes
Date: Tue, 28 Jun 2022 19:43:44 +0200	[thread overview]
Message-ID: <E5C7AE7F-73CF-43B7-8546-ABE8BEC0BBA0@johnlabovitz.com> (raw)
In-Reply-To: <76DD5063-3817-4550-980A-66E728DFD634@gmail.com>

I’m generally a lurker here, but this has been an interesting conversation to observe. I often hesitate to post, as to not offend you folks who literally invented this stuff, but I thought it might be helpful to share some experiences with socket-based I/O.

For the first time in ~20 years, I’ve recently been writing low-level (eg, not through a library layer/framework) socket code in straight C, for an art project based on an ESP32 embedded/SoC. I first played around with the socket API in the mid-80s, and then wrote a lot of socket-using code in the 1990s for the Watchguard Firebox, the first Linux-based appliance firewall.

I have to say that I really enjoying programming with sockets. I feel that it *does* make a lot of sense if I'm thinking directly about the TCP/IP stack, *and* if my code has a good 'impedance match' to the protocols. If I’m writing a server, I’m dealing with connections and queues and various-sized packets/messages/blocks, which have to fit into some decision of memory usage (often true in embedded systems). Usually I’m not simply writing, say, a file server that simply reads from disc and sends bytes out through a stream and then calls close().

I also believe that the sockets API really comes into its own with high-capacity, non-threaded, non-blocking servers or clients — that is, ones that use select() or poll() and then recv() and send() or their variants. I’m sure that if I didn’t have a sockets API and only had open(), read(), write(), etc., I could make it work, but there’s something almost beautiful that happens at a large scale with many non-blocking sockets (see: the reactor pattern) that I don’t think would translate as well with a typical everything-is-a-file model.

My opinion solely, of course. But I’m simply happy that both socket- and file-based APIs exist. Each has their purpose.

—John


> On Jun 28, 2022, at 19:05, Adam Thornton <athornton@gmail.com> wrote:
> 
> 
> 
>> On Jun 28, 2022, at 6:13 AM, Marc Donner <marc.donner@gmail.com> wrote:
>> 
>> What I don't understand is whether Rob's observation about networking is *fundamental* to the space or *incidental* to the implementation.  I would love to be educated on that.
> 
> And there it is!  THAT was the sentence--well, ahort paragraph--that jogged my memory as to why this seemed familiar.
> 
> If you go back to _The Unix-Hater's Handbook_ (I know, I know, bear with me), one of the things I noticed and pointed out in my review (https://athornton.dreamwidth.org/14272.html) is how many of the targets of hatred, twenty years down the line, turned out to be unix-adjacent, and not fundamental.
> 
> In the book, these were things like Usenet and sendmail.cf (indeed, those were the two big ones).
> 
> But the current discussion: is the thing we don't like Berkeley Sockets?  Is it TCP/IP itself?  Is the the lack of a Unixy abstraction layer over some lower-level technology?  To what degree is it inherent?
> 
> I mean, obviously, to some degree it's all three, and I think a large but fairly unexamined part of it is that TCP/IP these days almost always at least pretends to be sitting on top of Ethernet at the bottom...but of course Classic Ethernet largely died in the...early 2000s, I guess?...when even extremely cheap home multiple-access-devices became switches rather than hubs.
> 
> Some sort of inter-machine networking is clearly inherent in a modern concept of Unix.  I think we're stuck with the sockets interface and IP, whether we like them or not.  They don't bother me a great deal, but, yes, they do not feel as unixy as, say, /dev/tcp does.  But the interesting thing is that I think that is Unix-adjacent or, like the UHH distate for Unix filesystems, it's at least incidental and could be replaced if the desire arose.  And I think we already have the answer about what the abstraction is, albeit at an application rather than the kernel level.
> 
> To answer Rob's question: I think the abstraction is now much farther up the stack.  To a pretty good first approximation, almost all applications simply definte their own semantics on top of HTTP(S) (OK, OK, Websockets muddy the waters again) and three-to-five verbs.  There's an incantation to establish a circuit (or a "session" if you're under the age of 50, I guess), and then you GET, DELETE, and at least one of PUT/POST/PATCH, for "read", "unlink", and "write".  This does seem to be a more record-oriented (kids these days get snippy if you call them "records" rather than "objects" but w/e) format than a stream of bytes (or at least you put an abstraction layer in between your records and the stream-of-octets that's happening).
> 
> This is certainly not efficient at a wire protocol level, but it's a fairly small cognitive burden for people who just want to write applications that communicate with each other.
> 
> Adam


  reply	other threads:[~2022-06-28 17:44 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-25 23:01 [TUHS] " Paul Ruizendaal
2022-06-25 23:09 ` [TUHS] " Larry McVoy
2022-06-25 23:57   ` Rob Pike
2022-06-26  1:17     ` Paul Ruizendaal
2022-07-02  2:51       ` Grant Taylor via TUHS
2022-07-02  2:57         ` Larry McVoy
2022-06-28 10:38     ` Derek Fawcus
2022-06-28 12:36       ` Rob Pike
2022-06-28 12:45         ` Rob Pike
2022-06-28 13:33           ` Dan Cross
2022-06-28 21:19             ` Lawrence Stewart
2022-06-28 21:34               ` Richard Salz
2022-06-29  6:07                 ` Stuart Remphrey
2022-06-28 16:11           ` Tom Teixeira
2022-06-28 18:28           ` John Floren
2022-06-28 12:47         ` Rich Morin
2022-06-28 13:13           ` Marc Donner
2022-06-28 14:41             ` Clem Cole
2022-06-28 15:54               ` Tom Teixeira
2022-06-28 17:05             ` Adam Thornton
2022-06-28 17:43               ` John Labovitz [this message]
2022-06-28 22:45               ` [TUHS] HTTP (was Re: Re: Research Datakit notes) Derek Fawcus
2022-06-26  1:41 ` [TUHS] Re: Research Datakit notes Anthony Martin
2022-06-26  9:52   ` Ralph Corderoy
2022-06-26 11:04   ` Paul Ruizendaal
2022-06-29 20:21   ` Paul Ruizendaal
2022-06-26  2:19 Noel Chiappa
2022-06-26  9:46 ` steve jenkin
2022-06-26 20:35   ` Erik Fair
2022-06-26 21:53     ` Steve Jenkin
2022-06-26 10:16 ` Paul Ruizendaal via TUHS
2022-06-26 13:07 ` John Cowan
2022-06-26 13:35   ` Larry McVoy
2022-06-26 13:58     ` John Cowan
2022-06-27  0:43 Noel Chiappa
2022-06-27  3:00 ` Erik Fair
2022-06-27 21:40 Noel Chiappa
2022-06-27 22:40 ` George Michaelson
2022-06-28 15:50 Noel Chiappa
2022-06-28 21:32 ` Lawrence Stewart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E5C7AE7F-73CF-43B7-8546-ABE8BEC0BBA0@johnlabovitz.com \
    --to=johnl@johnlabovitz.com \
    --cc=tuhs@tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).