<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Systems on AAYUSHYA</title>
    <link>https://tiwariji.net/tags/systems/</link>
    <description>Recent content in Systems on AAYUSHYA</description>
    <generator>Hugo -- 0.154.5</generator>
    <language>en</language>
    <lastBuildDate>Thu, 02 Jul 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://tiwariji.net/tags/systems/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Big integer in Python</title>
      <link>https://tiwariji.net/posts/biginteger/</link>
      <pubDate>Thu, 02 Jul 2026 00:00:00 +0000</pubDate>
      <guid>https://tiwariji.net/posts/biginteger/</guid>
      <description>&lt;p&gt;Today we are looking at how you can work with big integers in Python. What do I mean by &amp;ldquo;big&amp;rdquo; integers?&lt;/p&gt;
&lt;p&gt;A standard 32-bit integer tops out at 2,147,483,647. A standard 64-bit integer tops out at about 9.2 × 10^18.&lt;/p&gt;
&lt;p&gt;The very interesting thing about Python is: &lt;strong&gt;it doesn&amp;rsquo;t have a fixed ceiling for integers!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The only limitation is the machine&amp;rsquo;s memory. So you can effectively store any integer in a Python &lt;code&gt;int&lt;/code&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Implementing mini Ollama from scratch</title>
      <link>https://tiwariji.net/posts/forge/</link>
      <pubDate>Fri, 15 May 2026 00:00:00 +0000</pubDate>
      <guid>https://tiwariji.net/posts/forge/</guid>
      <description>&lt;p&gt;In my previous work, we discussed different ideas and ways in writing a server. To quickly recap, it&amp;rsquo;s writing it asychronously, writing a multi-threaded server or writing a &amp;ldquo;dumb&amp;rdquo; one.
Each one has its pros and cons. People might say writing an async server would solve issues but it would not be the complete story. An async server helps when threads are idle waiting on I/O — network reads, file reads from external devices. Things like this, you can build an async server and it&amp;rsquo;ll get you the fastest latency. But they don&amp;rsquo;t provide us with the same improvements when the work is not I/O bound. Forge&amp;rsquo;s threads are idle waiting on compute — a different problem. We&amp;rsquo;ll see why in this article.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Writing an inference server in bare-metal C&#43;&#43;</title>
      <link>https://tiwariji.net/posts/dumb-server/</link>
      <pubDate>Wed, 06 May 2026 00:00:00 +0000</pubDate>
      <guid>https://tiwariji.net/posts/dumb-server/</guid>
      <description>&lt;p&gt;What is a &lt;strong&gt;Server&lt;/strong&gt;?    &lt;br&gt;
It is a software program that manages resources over a network. The whole network could be visualized like this:
&lt;img loading=&#34;lazy&#34; src=&#34;https://tiwariji.net/posts/dumb-server/pic.jpg&#34;&gt;&lt;/p&gt;
&lt;p&gt;Today we are writing a server.&lt;/p&gt;
&lt;p&gt;A dumb one, at first. We&amp;rsquo;ll benchmark the load handling of the server. And then we optimize.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Difference between websockets and a http server model&lt;/strong&gt;&lt;/em&gt;
WebSockets maintain a persistent, stateful connection where both client and server can continuously exchange data.
In a traditional HTTP model, the client usually sends a request, receives a response, and the connection is then closed.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Studying threads and benchmarking python vs c&#43;&#43;</title>
      <link>https://tiwariji.net/posts/threading/</link>
      <pubDate>Mon, 04 May 2026 00:00:00 +0000</pubDate>
      <guid>https://tiwariji.net/posts/threading/</guid>
      <description>&lt;p&gt;Threads are the smallest unit of execution that an operating system can schedule inside a process.     &lt;br&gt;
People (me) get confused about what threads are and what &lt;em&gt;processes&lt;/em&gt; are. This article will talk about threading as a programming concept and not the theory behind processes and threads. Nevertheless, we&amp;rsquo;ll talk about processes and threads too.&lt;/p&gt;
&lt;h1 id=&#34;processes-and-threads&#34;&gt;Processes and threads&lt;/h1&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Process A       
 ├── Thread 1       
 ├── Thread 2       
 └── Thread 3       

Process B       
 ├── Thread 1       
 └── Thread 2       
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Process is an independent program instance. It has its own memory and resources. Think of it like an agent.     &lt;br&gt;
A process can have one or more threads in it. Threads share the process memory and resources, though each thread has its own execution state and stack.  &lt;br&gt;
How processes and threads are implemented depends on specific programming languages and operating systems, so I highly recommend checking out the &lt;a href=&#34;#references&#34;&gt;wiki&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Speeding up matrix math with SIMD intrinsics</title>
      <link>https://tiwariji.net/posts/simd/</link>
      <pubDate>Mon, 09 Feb 2026 00:00:00 +0000</pubDate>
      <guid>https://tiwariji.net/posts/simd/</guid>
      <description>&lt;p&gt;Today we look at matrix multiplication (matmul, as we will call in this essay).  &lt;br&gt;
Since, the last essay was on &lt;a href=&#34;https://tiwariji.net/posts/backprop/&#34;&gt;backprop&lt;/a&gt;, it was only logical to think about the most fundamental math operation that lets us do the algo.     &lt;br&gt;
That is, matmul.&lt;br&gt;
Also, the numbers in this essay are going to shock you.  &lt;br&gt;
Like really. So if you think I am making this up, you should checkout &lt;a href=&#34;https://github.com/aayushyatiwari/blogCode/tree/master/simd&#34;&gt;my code&lt;/a&gt; for this essay.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Implementing collision-resistant hash maps from scratch</title>
      <link>https://tiwariji.net/posts/hashing/</link>
      <pubDate>Thu, 22 Jan 2026 00:00:00 +0000</pubDate>
      <guid>https://tiwariji.net/posts/hashing/</guid>
      <description>&lt;h1 id=&#34;what-is-this-about&#34;&gt;what is this about?&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;Today we&amp;rsquo;re looking at hashing. We&amp;rsquo;ll get into the process, the data structures and some applications.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Through this article, we&amp;rsquo;ll see how we can implement &lt;strong&gt;dictionary&lt;/strong&gt; operations, which are mainly:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;insert&lt;/li&gt;
&lt;li&gt;delete&lt;/li&gt;
&lt;li&gt;search&lt;/li&gt;
&lt;/ol&gt;
&lt;h1 id=&#34;what-is-hashing&#34;&gt;what is Hashing?&lt;/h1&gt;
&lt;p&gt;Hashing is a &lt;strong&gt;technique&lt;/strong&gt; of identifying an object out of a group of similar objects.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Analogy for hashing&lt;/strong&gt;: &lt;br&gt;
Imagine if you took your name &lt;em&gt;tiwariji&lt;/em&gt; and ran it through a complex mathematical function that produced &lt;strong&gt;7a3f9c2e&lt;/strong&gt;. You couldn&amp;rsquo;t look at &lt;strong&gt;7a3f9c2e&lt;/strong&gt; and figure out it came from &lt;em&gt;tiwariji&lt;/em&gt;, but every time you hash &lt;em&gt;tiwariji&lt;/em&gt; you&amp;rsquo;d get the same result.  &lt;br&gt;
&lt;br&gt;
That, is hashing.  &lt;br&gt;
&lt;br&gt;
Ideally, no two different inputs should produce the same hash output. We&amp;rsquo;ll talk about that later when we discuss &lt;a href=&#34;#hash-functions&#34;&gt;hash functions&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Memory layout: Stacks, heaps, and pointers</title>
      <link>https://tiwariji.net/posts/stacks_heaps/sh/</link>
      <pubDate>Fri, 16 Jan 2026 00:00:00 +0000</pubDate>
      <guid>https://tiwariji.net/posts/stacks_heaps/sh/</guid>
      <description>&lt;h1 id=&#34;data-management-during-compiler-process&#34;&gt;Data management during compiler process&lt;/h1&gt;
&lt;p&gt;When compiling a piece of code, the data in the code is stored in &lt;em&gt;segments&lt;/em&gt;.&lt;/p&gt;
&lt;h2 id=&#34;there-are-five-types-of-segments&#34;&gt;There are five types of segments:&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;stack&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;heap&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;data&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;code&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;BSS&lt;/em&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;We will focus on stack and heap in this essay.&lt;/p&gt;
&lt;h2 id=&#34;stack&#34;&gt;Stack&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;Stack allocation is the process of allocating memory for local variables and function calls in &lt;strong&gt;call stack&lt;/strong&gt;. &lt;br&gt;
Each function gets some memory in the stack to store variables in it. &lt;br&gt;
Since the memory is handled by the system, its faster. But the memory is less as compared to heaps. &lt;br&gt;
The size required is already known before execution. The compiler allocates some memory.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How memory represents data at the bit level</title>
      <link>https://tiwariji.net/posts/datarepresentationw2/</link>
      <pubDate>Thu, 15 Jan 2026 00:00:00 +0000</pubDate>
      <guid>https://tiwariji.net/posts/datarepresentationw2/</guid>
      <description>&lt;h1 id=&#34;overview&#34;&gt;Overview&lt;/h1&gt;
&lt;p&gt;When you call &lt;code&gt;int x = 0;&lt;/code&gt; in your code, where and how is that x stored? This is the question that I wanted to know the answer of. And in this essay, we’ll look at just that.
And&lt;/p&gt;
&lt;h2 id=&#34;why-should-you-care&#34;&gt;Why should you care?&lt;/h2&gt;
&lt;p&gt;As we will understand later in the article, there are issues and subtle bugs that come when programmers don’t understand their code. Hackers want to figure out ways to exploit those bugs and gain entery into people’s systems. So knowing how, why, and where of &lt;em&gt;your&lt;/em&gt; data, in &lt;em&gt;your&lt;/em&gt; system is not only useful, I’d say it’s necessary.&lt;/p&gt;</description>
    </item>
    <item>
      <title>from code to execution</title>
      <link>https://tiwariji.net/posts/code-from-source-to-execution/code-from-source-to-execution/</link>
      <pubDate>Sat, 03 Jan 2026 00:00:00 +0000</pubDate>
      <guid>https://tiwariji.net/posts/code-from-source-to-execution/code-from-source-to-execution/</guid>
      <description>&lt;p&gt;do you know how your code&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-c++&#34; data-lang=&#34;c++&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;f&lt;/span&gt;(){
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;42&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;turns into&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-llvm&#34; data-lang=&#34;llvm&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;mov&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;ea&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;x&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;42&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;ret&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;and then into&lt;/p&gt;
&lt;p&gt;&lt;code&gt;B8 2A 00 00 00 C3&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;this?&lt;/p&gt;
&lt;aside&gt;
&lt;p&gt;Here’s the whole essay in short:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;source code&lt;/strong&gt; → something happens, &lt;strong&gt;Intermediate code&lt;/strong&gt; forms → something happens again, &lt;strong&gt;Machine code&lt;/strong&gt; is formed.&lt;/p&gt;
&lt;p&gt;We’ll clear the ‘something’ in this article.&lt;/p&gt;
&lt;/aside&gt;
&lt;p&gt;Life would be very simple if we humans could write 1s and 0s and directly give machine it’s prefered machine code. But since we don’t have 1000 hands per person and the outputs that we’re expecting out of computers have evolved to complexities unimaginable, we need another simpler way to talk to the machines. And that is why we have different programming languages and their compilation processes.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
