<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sospeter Kinyanjui</title>
    <description>The latest articles on DEV Community by Sospeter Kinyanjui (@sospeter).</description>
    <link>https://dev.to/sospeter</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3722041%2Fb6597a66-d9be-4314-ab3a-2c1b350bf309.png</url>
      <title>DEV Community: Sospeter Kinyanjui</title>
      <link>https://dev.to/sospeter</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sospeter"/>
    <language>en</language>
    <item>
      <title>Understanding TCP: The Backbone of Reliable Network Communication</title>
      <dc:creator>Sospeter Kinyanjui</dc:creator>
      <pubDate>Fri, 20 Mar 2026 09:03:41 +0000</pubDate>
      <link>https://dev.to/sospeter/understanding-tcp-the-backbone-of-reliable-network-communication-5684</link>
      <guid>https://dev.to/sospeter/understanding-tcp-the-backbone-of-reliable-network-communication-5684</guid>
      <description>&lt;p&gt;We’re in 2026 and just how fast and convenient it is to share computer resources and information across computer networks often goes unnoticed. It’s what inspired the first wide area network, ARPANET. The desire to share expensive and limited computing resources. The idea of allowing multiple users to access there resources remotely, sharing the processing power and data storage was revolutionary. I want us to look at the one thing that made all these possible, the TCP/IP protocol suite.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Definition of Terms&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Network&lt;/strong&gt;: two or more computers connected for the purpose of communication and sharing resources.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Protocol&lt;/strong&gt;: agreed upon set of rules that make communication between two computers on the same network possible.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TCP&lt;/strong&gt;: a connection-oriented transport layer protocol that ensures reliable, ordered, and error-checked delivery of data packets between applications on an IP network.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IP&lt;/strong&gt;: the foundational set of rules governing how data packets are addressed, routed, and transmitted across networks, enabling global communication.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Internet Protocol Suite&lt;/strong&gt;: is a framework for organizing the communication protocols used in the Internet and similar computer networks according to functional criteria.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;IP&lt;/strong&gt; establishes the ground on how information is carried across the network. &lt;strong&gt;TCP&lt;/strong&gt; &lt;em&gt;wraps around&lt;/em&gt; IP traffic to ensure the data transmitted reached the destination, intact and in the correct order. As a developer it should come without saying that every application must convey this behavior. In the coming paragraphs I want us to analyze the format of a TCP packet, so we can see how it has become reliable to send data, how the data is divided into packets and the packets reach still ordered and reassembled correctly, and finally how to cope with a situation where some bits of data inside a packets disappeared along the way.&lt;/p&gt;

&lt;p&gt;Theoretically a single TCP packet can carry, up to 65KB of data. But in practice due to fragmentation the Maximum Transmission Unit is usually 1.5KB. Just an overview, each packet contains, source port and address, sequence and acknowledgement number and data to be transmitted.&lt;br&gt;
Write on Medium&lt;/p&gt;

&lt;p&gt;In order to a single connection to be established there’s what we call a three way handshake. Let’s face it, two computers, a client and a server want to communicate. Let’s say the client by the help of a browser wants to request some web files. The protocol says, the client initializes the connection. A client sends a synchronization TCP packet with the SYN reserved word set. The server responds with a TCP packet with the ACK reserved word set. Eventually the client responds with SYN/ACK flags set. and the sequence numbers too. Think of the handshake as an introduction to a meeting:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-&amp;gt; Client: “Hi, I’m here.”

-&amp;gt; Server: “Hi, I’m here, nice to meet you.”

-&amp;gt; Client: “Nice to meet you too!”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Now that we’re sure the connection is stable, the server starts sending HTML, CSS, JS, image, videos, music, PDF, and other formatted data.&lt;/p&gt;

&lt;p&gt;In order to ensure all the data reached the destination IP, the sequence number (a unique number) is assigned to each bit of data. This way both sides keep track of what data has been sent and received. If anything goes wrong the packet is re-transmitted while the others wait in the queue for assembling. If the receiver sees a gap between two sequence numbers for two packets, for example 134 and 136, the sender’s timer for 135 expires so it re-sends.&lt;/p&gt;

&lt;p&gt;Before TCP came along, early networks were chaotic: data could arrive out of order, get lost, or be duplicated, leaving users with garbled or incomplete information. There was no built-in way to detect errors, re-transmit missing pieces, or ensure that messages flowed in a steady, reliable stream. TCP changed all of that by introducing sequence numbers, acknowledgments, and retransmissions, which smooth out the bumps in the network. It reorders packets, fills in missing data automatically, and ensures that information reaches its destination accurately and in the right order, making network communication predictable and dependable instead of a messy guessing game.&lt;/p&gt;

&lt;p&gt;My team and I at &lt;a href="https://www.zone01kisumu.ke/" rel="noopener noreferrer"&gt;https://www.zone01kisumu.ke/&lt;/a&gt; had been working on a command line Chat Application Server. Sort of like netcat, apart from it neatly organizes chatters into chat rooms, persists chats for later retrieval, chatters can switch rooms and change their names, see whose in the room and much more. You can check it on github: &lt;a href="https://github.com/sospeter-57/net-cat-server" rel="noopener noreferrer"&gt;https://github.com/sospeter-57/net-cat-server&lt;/a&gt;. When creating the server we used the go’s standard package, net. We created a listener through net.Listener. We also specified that we wanted our server to strictly listen for incoming TCP connections.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;listener&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;net&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"tcp"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;":"&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;configs&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Port&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
 &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It worked because we were confident that every bit of message that the chatters received was in the correct order and complete. Even with interpolation of other language’s features such as goroutines. But let’s be real, the normal user will never care about the technicals of how he/she receives the message. What matters is probably the most convenient way.&lt;/p&gt;

&lt;p&gt;Speaking of such, TCP might be irreplaceable in today’s world, but it has it’s downsides too. To begin with, it’s slow but sure, I know it sounds good, but the bad side still exists, it’s slow. Another protocol designed specifically to solve this was created, &lt;strong&gt;User Datagram Protocol&lt;/strong&gt;. But UDP doesn’t promise you reliability. But wait, we also have &lt;strong&gt;QUIC&lt;/strong&gt; does what TCP and UDP does all at a go. But more on those ones in the coming articles. All in all, there’s a good reason why TCP over IP has has dominated over 75% of the entire traffic on the internet. Right now Transmission Control Protocol is 53 years old, 53 years from how will you and me still be using my beloved TCP. Let me picture that, I’ll be in my 70s or 80s, probably implanted a Neuralink chip now receiving data packets using a century old network protocol. What do you think? You know what? I’d like very much to be part of that future. Sure, it might not be TCP, the the love for keeping everyone connected, and securely, with unlimited access to information, is not stopping soon. In the last article I promised TCP, here is it. Next well look at IP on it’s own.&lt;/p&gt;

&lt;p&gt;You can find me on:&lt;br&gt;
Github: &lt;a href="https://github.com/Sospeter-M-Kinyanjui" rel="noopener noreferrer"&gt;https://github.com/Sospeter-M-Kinyanjui&lt;/a&gt;&lt;br&gt;
LinkedIn: &lt;a href="https://www.linkedin.com/in/sospeter-kinyanjui-6a091b2a5/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/sospeter-kinyanjui-6a091b2a5/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Until next time, peace, focus.&lt;/p&gt;

&lt;p&gt;Happy coding.&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>networking</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>HTTP: the web's protocol</title>
      <dc:creator>Sospeter Kinyanjui</dc:creator>
      <pubDate>Mon, 23 Feb 2026 23:55:08 +0000</pubDate>
      <link>https://dev.to/sospeter/http-the-webs-protocol-1b69</link>
      <guid>https://dev.to/sospeter/http-the-webs-protocol-1b69</guid>
      <description>&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/HTTP" rel="noopener noreferrer"&gt;HTTP&lt;/a&gt; (Hypertext Transfer Protocol) is an application-layer protocol for distributed, collaborative, hypermedia information systems. It is the foundational, stateless protocol used to transfer data (such as HTML documents, images, and videos) on the World Wide Web.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How HTTP Works&lt;/strong&gt;&lt;br&gt;
HTTP is a request-response protocol:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;em&gt;Client Request&lt;/em&gt; - A browser or app sends a request to a server, specifying a method(GET, POST, etc.) and a source path.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Server Response&lt;/em&gt; - The server processes the request and returns a response containing a status code, headers, and an optical body.
Requests and responses are structured as messages, making them human-readable and extensible.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;HTTP Methods&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;GET&lt;/strong&gt; – Retrieve a resource. This method is safe (does not modify the resource) and idempotent (repeating it has the same effect). Typical use: loading a web page or fetching data from an API.&lt;br&gt;
&lt;strong&gt;POST&lt;/strong&gt; – Submit data to a server to create a new resource or trigger processing. Not idempotent. Example: submitting a form or posting a comment.&lt;br&gt;
&lt;strong&gt;PUT&lt;/strong&gt; – Replace a resource entirely with the request payload. Idempotent. Example: updating a file on a server.&lt;br&gt;
&lt;strong&gt;PATCH&lt;/strong&gt; – Apply a partial modification to a resource. Not necessarily idempotent. Example: updating a single field in a database record.&lt;br&gt;
&lt;strong&gt;DELETE&lt;/strong&gt; – Remove a resource. Idempotent. Example: deleting a user account.&lt;br&gt;
&lt;strong&gt;HEAD&lt;/strong&gt; – Same as GET but without the body. Used to fetch metadata (headers) about a resource, like checking if it exists or its size.&lt;br&gt;
&lt;strong&gt;OPTIONS&lt;/strong&gt; – Ask the server which methods are supported on a resource. Commonly used in CORS preflight requests in web applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Headers and Metadata&lt;/strong&gt;&lt;br&gt;
HTTP messages are more than just the request or response body — they carry headers, which provide metadata about the message or instructions on how to handle it. Headers make HTTP flexible and extensible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common Request Headers&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Host&lt;/strong&gt; – Specifies the domain name of the server. Required in HTTP/1.1 to handle virtual hosting.&lt;br&gt;
&lt;strong&gt;User-Agent&lt;/strong&gt; – Identifies the client software (browser, app, or bot). Useful for analytics or server behavior adjustments.&lt;br&gt;
&lt;strong&gt;Accept&lt;/strong&gt; – Indicates the content types the client can process, e.g., text/html or application/json.&lt;br&gt;
&lt;strong&gt;Authorization&lt;/strong&gt; – Carries credentials or tokens for authentication.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cookie&lt;/strong&gt; – Sends previously set cookies to the server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common Response Headers&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;&lt;strong&gt;Content-Type&lt;/strong&gt;&lt;/em&gt; – The MIME type of the response body, e.g., text/html, application/json.&lt;br&gt;
&lt;em&gt;&lt;strong&gt;Content-Length&lt;/strong&gt;&lt;/em&gt; – The size of the response body in bytes.&lt;br&gt;
&lt;em&gt;&lt;strong&gt;Set-Cookie&lt;/strong&gt;&lt;/em&gt; – Instructs the client to store a cookie for future requests.&lt;br&gt;
&lt;em&gt;&lt;strong&gt;Cache-Control&lt;/strong&gt;&lt;/em&gt; – Defines caching policies (e.g., no-cache, max-age=3600).&lt;br&gt;
&lt;em&gt;&lt;strong&gt;Location&lt;/strong&gt;&lt;/em&gt; – Used in redirects to indicate the new URL.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Special Header Categories&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;&lt;strong&gt;Caching Headers&lt;/strong&gt;&lt;/em&gt; – ETag, Last-Modified, Expires. Help clients avoid downloading unchanged resources.&lt;br&gt;
&lt;em&gt;&lt;strong&gt;Security Headers&lt;/strong&gt;&lt;/em&gt; – Strict-Transport-Security, Content-Security-Policy, X-Frame-Options. Protect against attacks like XSS and clickjacking.&lt;br&gt;
&lt;em&gt;&lt;strong&gt;Custom / Application Headers&lt;/strong&gt;&lt;/em&gt; – Many APIs define headers like X-Request-ID for tracing requests or X-Rate-Limit for throttling.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Headers Matter&lt;/strong&gt;&lt;br&gt;
Headers are what allow HTTP to be protocol-agnostic and extensible. Without headers:&lt;br&gt;
The client and server wouldn’t know content type, length, or caching policies.&lt;br&gt;
Authentication and session management would be impossible.&lt;br&gt;
Advanced features like partial content delivery, compression, and CORS would not work.&lt;br&gt;
In short, headers transform HTTP from a simple message-passing protocol into a fully-featured web communication framework.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTTP Versions&lt;/strong&gt;&lt;br&gt;
HTTP has evolved over time:&lt;br&gt;
&lt;em&gt;&lt;strong&gt;&lt;a href="https://datatracker.ietf.org/doc/html/rfc2616" rel="noopener noreferrer"&gt;HTTP/1.1&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt; – Persistent connections, chunked transfers.&lt;br&gt;
&lt;em&gt;&lt;strong&gt;&lt;a href="https://datatracker.ietf.org/doc/html/rfc7540" rel="noopener noreferrer"&gt;HTTP/2&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt; – Multiplexed streams, binary framing.&lt;br&gt;
&lt;em&gt;&lt;strong&gt;&lt;a href="https://datatracker.ietf.org/doc/html/rfc9114" rel="noopener noreferrer"&gt;HTTP/3&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt; – Runs over &lt;a href="https://en.wikipedia.org/wiki/QUIC" rel="noopener noreferrer"&gt;QUIC&lt;/a&gt; for faster, more reliable connections.&lt;br&gt;
Despite differences, all versions follow the same basic request-response model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;br&gt;
HTTP is the language that makes the web possible. It defines how a client asks for something and how a server responds. Every time you open a website, load an image, submit a form, or use an API, HTTP is working underneath. Through its methods, it defines what action you want to perform. Through its headers, it carries instructions and metadata about how that data should be handled. Through its evolving versions, it improves speed, efficiency, and security — without changing its fundamental model. At its core, HTTP is simple: request and response.&lt;br&gt;
But from that simplicity, the entire modern web is built.&lt;/p&gt;

&lt;p&gt;Now you know what happens behind those backend systems. I'm going to be releasing articles for other network protocols. It's going to be a series one per week. Next week we'll look at TCP. Follow me on: &lt;a href="https://www.linkedin.com/in/sospeter-kinyanjui-6a091b2a5/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; and &lt;a href="https://github.com/Sospeter-M-Kinyanjui" rel="noopener noreferrer"&gt;Github&lt;/a&gt;.&lt;br&gt;
Until next time, peace, focus.&lt;/p&gt;

</description>
      <category>http</category>
      <category>sospeter</category>
      <category>zone01kisumu</category>
      <category>lakehub</category>
    </item>
    <item>
      <title>Leveraging io_uring for performant asynchronous linux applications.</title>
      <dc:creator>Sospeter Kinyanjui</dc:creator>
      <pubDate>Sun, 08 Feb 2026 23:52:24 +0000</pubDate>
      <link>https://dev.to/sospeter/leveraging-iouring-for-performant-asynchronous-linux-applications-4pl7</link>
      <guid>https://dev.to/sospeter/leveraging-iouring-for-performant-asynchronous-linux-applications-4pl7</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzlgcmb2byf45ktorv7oa.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzlgcmb2byf45ktorv7oa.webp" alt="how the ring buffers for sequence queue entries and completion queue entries are laid in the shared memory in context to io_uring linux i/o system call" width="700" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;author: &lt;strong&gt;Sospeter Kinyanjui&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  intro
&lt;/h2&gt;

&lt;p&gt;For the longest time, in &lt;strong&gt;linux&lt;/strong&gt; there just existed &lt;code&gt;epoll&lt;/code&gt;, a I/O notification facility that enables applications to make read/write system calls to the linux kernel. &lt;code&gt;epoll&lt;/code&gt; first emerged in the Linux Kernel 2.5.44 back in 2002 which later gained mainstream adoption at 2.6 on 2003. &lt;code&gt;epoll&lt;/code&gt; uses the &lt;em&gt;readiness-model&lt;/em&gt; to make system calls to the kernel, &lt;code&gt;epoll_create&lt;/code&gt;, &lt;code&gt;epoll_ctl&lt;/code&gt; and &lt;code&gt;epoll_wait&lt;/code&gt;. The kernel notifies applications when resources are available in order for apps to submit tasks. This makes it O(1) complexity, which means it's speed stays the same whether you're watching 10 connections or 10,000 connections. And since making system calls are the only way for applications to communicate with the kernel to access computer resources, we might consider this behavior inefficient. And that presents the &lt;em&gt;syscall tax problem&lt;/em&gt;, making expensive &lt;em&gt;context switching system calls&lt;/em&gt; for every connections while switching between user mode and kernel mode. Not until 2019 was &lt;code&gt;io_uring&lt;/code&gt; Linux Kernel System call for I/O asynchronous operations came.&lt;/p&gt;

&lt;p&gt;First let's define &lt;strong&gt;asynchronous execution&lt;/strong&gt;: it's the ability of an application to start a long-running task and continue responsive execution rather than waiting for that task to finish. This makes better utilization of computer resources. Considering &lt;code&gt;epoll&lt;/code&gt; was event-driven, mimicking such behavior in programs can be considered an illusion. &lt;code&gt;io_uring&lt;/code&gt; aimed at making less system calls by batching multiple read/write requests then making one. as a result, multiple read and write operations do no have to wait for each other.&lt;/p&gt;

&lt;h2&gt;
  
  
  definition and implementation
&lt;/h2&gt;

&lt;p&gt;Technically, &lt;code&gt;io_uring&lt;/code&gt; exposes three calls: &lt;code&gt;io_uring_setup(2)&lt;/code&gt;, &lt;code&gt;io_uring_enter(2)&lt;/code&gt; and &lt;code&gt;io_uring_register(2)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A call to &lt;strong&gt;&lt;code&gt;io_uring_setup&lt;/code&gt;&lt;/strong&gt; initializes the &lt;code&gt;io_uring&lt;/code&gt; context by creating the submission queue (SQ) and completion queue (CQ), returning a file descriptor to the application. It takes parameters to configure it's primary data structures, rings, their sizes, the &lt;code&gt;head&lt;/code&gt;, &lt;code&gt;tail&lt;/code&gt;, &lt;code&gt;ring_mask&lt;/code&gt; and &lt;code&gt;ring_entries&lt;/code&gt;. As you can imagine a ring follows the FIFO thing. The first task on the sequence queue will be the first to be passed to the Completion Queue Entry. The CQEs are also structured similarly. A call to &lt;code&gt;io_uring_setup&lt;/code&gt; leads to a creation of a shared memory with the size specified comprising of SEQs and CQEs sections. For SEQs the user/application space only have writing permissios while kernel permissions are only granted for reading. For CQEs the kernel only has writing permissions while the user/application has just reading permissions. Apparently to keep things performant, they use the Single Producer / Single Consumer logic.&lt;/p&gt;

&lt;p&gt;A call to &lt;strong&gt;&lt;code&gt;io_uring_enter&lt;/code&gt;&lt;/strong&gt; is the engine starter for the whole operation. It tells the kernel: &lt;em&gt;"I've put some SQEs in the ring; go process them."&lt;/em&gt; This is how it looks like in the C structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;linux/io_uring.h&amp;gt;
    int io_uring_enter(unsigned int fd, unsigned int to_submit,
                   unsigned int min_complete, unsigned int flags,
                   sigset_t *sig);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If &lt;code&gt;io_uring_enter&lt;/code&gt; is the engine starter, &lt;strong&gt;&lt;code&gt;io_uring_register&lt;/code&gt;&lt;/strong&gt; is the &lt;em&gt;"VIP pass"&lt;/em&gt; for your data. It is a system call used to pre-register resources (like memory buffers or files) with the kernel. By doing this, you remove the overhead of the kernel having to "look up" or "map" these resources every time you perform an I/O operation. With those three pieces, asynchronous programming in linux has never been the same again. &lt;/p&gt;

&lt;p&gt;There are existing C wrappers around these kernel level calls, &lt;code&gt;liburing&lt;/code&gt; and &lt;code&gt;libc&lt;/code&gt; does a great job. But there is another hand in play for leveraging &lt;code&gt;io_uring&lt;/code&gt;'s capabilities in building asynchronous applications, Rust. Just imagine that, it solves the fundamental conflict: Completion Based I/O (the whole concept of &lt;code&gt;io_uring&lt;/code&gt;) but with memory safety. In &lt;code&gt;io_uring&lt;/code&gt;, the kernel takes control of your memory buffers to perform I/O asynchronously. This creates a "danger zone" where both the kernel and your application could try to access the same memory at once. The Rust compiler ensures your code cannot even touch that buffer until the kernel returns it in a Completion Queue Entry (CQE). Existing Rust wrappers for this Linux Kernel I/O API are some including tokio's &lt;code&gt;io-uring&lt;/code&gt;, &lt;code&gt;tokio-uring&lt;/code&gt; and &lt;code&gt;glammio&lt;/code&gt; among others.&lt;/p&gt;

&lt;h2&gt;
  
  
  there's more
&lt;/h2&gt;

&lt;p&gt;Implementing a Completion-Based mechanism for I/O operations at the kernel level can be more useful in today's real world not just for linux. Yeah, Windows has had such technology, it's called I/O completion ports (IOCP). Even though &lt;code&gt;iocp&lt;/code&gt; is asynchronous it still requires a system call for every request which makes the 'tax' a little higher compared to &lt;code&gt;io_uring&lt;/code&gt;'s.  The standard way for doing this in MacOS is by using the &lt;code&gt;kqueue&lt;/code&gt; API.  It is still readiness-based. You have to call &lt;code&gt;kevent&lt;/code&gt; to find out what is ready, then make separate system calls to actually perform the I/O. It suffers from the same syscall overhead that &lt;code&gt;io_uring&lt;/code&gt; was designed to kill. Which makes &lt;code&gt;io_uring&lt;/code&gt; a true asynchronous programming linux system calls API.&lt;/p&gt;

&lt;p&gt;But here's the thing about finding technological solutions, you don't have to solve everything. Someone I once looked up to once told me, "Be the best cog, but keep in mind you're not the only one in the machine." From my own point of view, I think the real problem lies in creating an asynchronous runtime that is &lt;em&gt;cross-platform&lt;/em&gt; and &lt;em&gt;completion-based&lt;/em&gt;. Such a technology exist, we have &lt;code&gt;compio&lt;/code&gt;, a &lt;strong&gt;Rust&lt;/strong&gt; framework for &lt;em&gt;asynchronous I/O operations&lt;/em&gt;. What makes it less perfect are two things: it's arguably doesn't have &lt;em&gt;zero-cost abstraction&lt;/em&gt; and it uses &lt;em&gt;fixed buffers&lt;/em&gt;(part of &lt;code&gt;io_urings&lt;/code&gt;'s design) which are immutable references. Most of the &lt;strong&gt;Rust ecosystem&lt;/strong&gt; is built on top of &lt;code&gt;std::io::Read&lt;/code&gt; and &lt;code&gt;std::io::Write&lt;/code&gt; traits which take this mutable references. Compio? It primarily emphasizes the ownership of buffers rather than borrowing them. Which as we've seen aligns with &lt;code&gt;io_uring&lt;/code&gt; completion-based model, but then it poses a real problem with integration with the rest of the ecosystem.&lt;/p&gt;

&lt;p&gt;But again, like I said, we just have to be here, implementing one solution at a time. By believing in ourselves even when it seems impossible. Until next time, peace, focus, desire.&lt;/p&gt;

&lt;p&gt;You can checkout others of my blogs.&lt;br&gt;
Follow me on:&lt;br&gt;
On &lt;strong&gt;github&lt;/strong&gt;: &lt;a href="https://github.com/Sospeter-M-Kinyanjui" rel="noopener noreferrer"&gt;https://github.com/Sospeter-M-Kinyanjui&lt;/a&gt;&lt;br&gt;
On &lt;strong&gt;LinkedIn&lt;/strong&gt;: &lt;a href="https://www.linkedin.com/in/sospeter-kinyanjui-6a091b2a5/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/sospeter-kinyanjui-6a091b2a5/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>rust</category>
      <category>iouring</category>
      <category>software</category>
      <category>sospeter</category>
    </item>
  </channel>
</rss>
