by GeorgeTirebiter · 4y ago · 0 comments
Similar thing for ranges of IP address, except in that case, the 'listener' has to figure out which 'virtual uart' to act upon. In that case, the OS splits the 'virtual uart' assignment with the server listening to a range of address.
Sockets seem unnaturally messy to me. Maybe I'm ignorant.
The merge work was driven by Bill Joy and Blaine Garst.
https://www.computerhistory.org/collections/catalog/10271717...
A socket is reachable from other computers, so it must have a network address of some kind associated with it. The process that owns the port may want to refuse connections from another computer, so there has be a step in which the receiver accepts an attempted connection.
COM4 can essentially never reject either a reader or a writer.
There were two components, Receive-Side Scaling and some special user-mode thing. RSS would load-balance 5-tuples onto different cores somehow, triggering interrupts on the right core for that stream. If you were careful with the driver stack you could have zero-copy all the way to user mode, where there was some magic that let you dispatch into user mode and read packet data from a ring buffer.
Gave me an appreciation for how a single machine is made of lots of pieces, and how frustrating it is to chase perf.
It's not, though. A single destination can have an arbitrary number of sockets/uarts connected to it. You can server on port 80, and accept a connection from 127.0.0.1 and from 192.168.100.23 and from 10.98.54.4 and from anywhere else on the internet and have them all operating simultaneously. And in fact each destination port can have many connections to the same IP and port combination, discriminated by the source port which is a number the programmer generally never sees (unless you bind it specifically, it's automatically assigned).
It's exactly that kind of almost-right-but-not-quite mental misrepresentation that the article is trying to address.
The fact that a tuple (my IP, my socket, your ip, your socket, protocol) is used instead of COM4 is just a detail.
write(fd, "hello", 5);
write into a connected tcp socket looks like this: write(fd, "hello", 5);
Sounds like you have what you want?Sockets don’t look too bad compared to that
I don't care about the specific uart-level detail here.
Of course you have datagram protocols and recvmsg() & co, which are useful precisely when you're dealing with something that does not looks like a uart.