<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Narek Galstyan</title>
    <link>https://narekg.me/</link>
    <description>Recent content on Narek Galstyan</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Mon, 10 Nov 2025 22:37:04 -0500</lastBuildDate>
    <atom:link href="https://narekg.me/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>SELECT 1 Touches 5,583 Lines of Postgres Source Code</title>
      <link>https://narekg.me/blog/2025/11/pg-select-1-lines/</link>
      <pubDate>Mon, 10 Nov 2025 22:37:04 -0500</pubDate>
      <guid>https://narekg.me/blog/2025/11/pg-select-1-lines/</guid>
      <description>&lt;p&gt;I ran &lt;code&gt;SELECT 1&lt;/code&gt; in Postgres under &lt;code&gt;gdb&lt;/code&gt; and traced the execution path through the source code.&lt;/p&gt;&#xA;&lt;p&gt;But before that, a few words on why I wanted to know.&lt;/p&gt;&#xA;&lt;h2 id=&#34;background&#34;&gt;Background&lt;/h2&gt;&#xA;&lt;p&gt;A while back, I had run into &lt;a href=&#34;https://narekg.me/blog/2024/10/pg-plpgsql-cache-invalidation-bug/&#34;&gt;an obscure bug in Postgres&lt;/a&gt; that I am sure has affected no one and will affect no one, due to the absurdity of its necessary conditions.&#xA;I had tried to fix it and failed at the time. Recently I revisited the bug and again failed to find the root cause, despite spending many many hours deep in Postgres source code.&#xA;Though I learned a little more about Postgres in the process (e.g., how it implements re-parenting heap-allocated memory when the memory needs to live longer than the context in which it was allocated),&#xA;I came away empty-handed.&lt;/p&gt;</description>
    </item>
    <item>
      <title>My Failed Attempts at Fixing an Obscure Postgres Bug</title>
      <link>https://narekg.me/blog/2024/10/pg-plpgsql-cache-invalidation-bug/</link>
      <pubDate>Sat, 19 Oct 2024 18:49:33 -0500</pubDate>
      <guid>https://narekg.me/blog/2024/10/pg-plpgsql-cache-invalidation-bug/</guid>
      <description>&lt;p&gt;Note: This is an unfinished bug hunt with no satisfying conclusion. I am documenting what I know so far to hopefully finish solving this later.&lt;/p&gt;&#xA;&lt;h2 id=&#34;background&#34;&gt;Background&lt;/h2&gt;&#xA;&lt;p&gt;When building bm25 indexing for &lt;a href=&#34;https://lantern.dev/&#34;&gt;LanternDB&lt;/a&gt;, I came across a very obscure Postgres bug (which I reported in the &lt;a href=&#34;https://www.postgresql.org/message-id/18432-62450522bb8f0754%40postgresql.org&#34;&gt;pgsql-bugs mailing list&lt;/a&gt;).&#xA;The bug causes a valid PL/pgSQL function call to fail, likely because of some faulty cache invalidation code path.&#xA;I would be very surprised if this has ever affected anyone. If it has, please let me know!&#xA;But as someone who has a history of obsession with bugs&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;, I was intrigued and wanted to get to the root of the problem and fix it.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Recompiling Rust libcore to enable gated features</title>
      <link>https://narekg.me/blog/2020/07/rust-libcore-recompile/</link>
      <pubDate>Wed, 01 Jul 2020 00:00:00 +0000</pubDate>
      <guid>https://narekg.me/blog/2020/07/rust-libcore-recompile/</guid>
      <description>&lt;p&gt;I have recently been working on a &lt;a href=&#34;https://narekg.me/blog/2020/06/mandelbrot-wasm-rust/&#34;&gt;WebAssembly project&lt;/a&gt; in which I wanted to take advantage of SIMD (single instruction multiple data) instructions in WebAssembly that are now supported in modern browsers. I was using Rust for programming and due to this project discovered some peculiarities of Rust standard library that I&amp;rsquo;d like to share.&lt;/p&gt;&#xA;&lt;p&gt;In Rust, wasm32 SIMD intrinsics are &lt;a href=&#34;https://doc.rust-lang.org/stable/core/arch/wasm32/index.html&#34;&gt;documented here&lt;/a&gt;. You can see in the source code of the module that the API it provides is feature-gated with &lt;code&gt;wasm_target_feature&lt;/code&gt; and &lt;code&gt;simd128&lt;/code&gt;.&#xA;Normally, you could just add the respective feature flag(&lt;code&gt;+simd128&lt;/code&gt;) to &lt;code&gt;RUSTFLAGS&lt;/code&gt; and enable these. But to my surprise, adding relevant rustflags did not make the API available to me.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Parallel mandelbrot set visualization with WebAssembly, Raynon and Rust</title>
      <link>https://narekg.me/blog/2020/06/mandelbrot-wasm-rust/</link>
      <pubDate>Thu, 25 Jun 2020 22:12:31 -0700</pubDate>
      <guid>https://narekg.me/blog/2020/06/mandelbrot-wasm-rust/</guid>
      <description>&lt;p&gt;&lt;figure&gt;&lt;img src=&#34;https://narekg.me/images/mandelbrot/ex1.png&#34;&gt;&lt;figcaption&gt;&#xA;      &lt;h4&gt;Each color band represents the work of a particular thread&lt;/h4&gt;&#xA;    &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&lt;figure&gt;&lt;img src=&#34;https://narekg.me/images/mandelbrot/headline.gif&#34;&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;I built an interactive Mandelbrot set visualizer in Rust that paralellizes computation with &lt;a href=&#34;https://github.com/rayon-rs/rayon&#34;&gt;Rayon&lt;/a&gt; and compiles to WebAssembly to run in your browser. &lt;a href=&#34;https://narekg.me/projects/mandelbrot&#34;&gt;&lt;strong&gt;Explore the Demo Here&lt;/strong&gt;&lt;/a&gt; (Works on a recent version of Chrome.)&lt;/p&gt;&#xA;&lt;p&gt;Or follow one of the direct links into&#xA;particular areas of the mandelbrot world map below:&lt;/p&gt;&#xA;&lt;p&gt;&lt;figure&gt;&lt;img src=&#34;https://narekg.me/images/mandelbrot/ex2.png&#34;&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&lt;a href=&#34;https://narekg.me/projects/mandelbrot/#controls=%7B%22scale%22:29048.11963583026,%22dx%22:0.7075870313244098,%22dy%22:0.3528848609218106,%22iterations%22:147.47671464860287,%22updateEvery%22:10,%22num_threads%22:8,%22color_mode%22:0,%22animation_num_frames%22:100,%22color_threads%22:false%7D&#34;&gt;Near the weist of mandelbrot&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;figure&gt;&lt;img src=&#34;https://narekg.me/images/mandelbrot/ex3.png&#34;&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&lt;a href=&#34;https://narekg.me/projects/mandelbrot/#controls=%7B%22scale%22:2692504.814299422,%22dx%22:0.8822945455153849,%22dy%22:0.23535782404621583,%22iterations%22:147.47671464860287,%22updateEvery%22:10,%22num_threads%22:8,%22color_mode%22:0,%22animation_num_frames%22:100,%22color_threads%22:false%7D&#34;&gt;Upper East side&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;figure&gt;&lt;img src=&#34;https://narekg.me/images/mandelbrot/ex4.png&#34;&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&lt;a href=&#34;https://narekg.me/projects/mandelbrot/#controls=%7B%22scale%22:259818279.33583263,%22dx%22:0.8824591729689749,%22dy%22:0.23537966188611972,%22iterations%22:308.4250635055038,%22updateEvery%22:10,%22num_threads%22:8,%22color_mode%22:0,%22animation_num_frames%22:100,%22color_threads%22:false%7D&#34;&gt;Zoomed in from the one above&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title></title>
      <link>https://narekg.me/misc/vmware5g/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://narekg.me/misc/vmware5g/</guid>
      <description>&lt;p&gt;5G was irst intentded to be the first sysstem built from sctatch to serve smart things. The main things needed were to break the monoliths of radio communication. some of it actually happeneed but alot of it still comprises of proprietary systems&lt;/p&gt;&#xA;&lt;p&gt;5G enables fusion of multiple industries (telecommunication and cloud and AI).&lt;/p&gt;&#xA;&lt;p&gt;Edge has no shape and are moving. (this can be a very useful argument for mTelcos since a revolution in telco is coming one way or another in order to support the rise of edge. Internet cannot fully support edge since devices ar efundamentally mobile)&lt;/p&gt;</description>
    </item>
    <item>
      <title></title>
      <link>https://narekg.me/privacy_papers/popcorn/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://narekg.me/privacy_papers/popcorn/</guid>
      <description>&lt;h2 id=&#34;what-is-the-problem-and-why-is-it-important&#34;&gt;What is the problem and why is it important?&lt;/h2&gt;&#xA;&lt;p&gt;As data gets more and more conentrated in the servers of giant private companies, even if the data is not secret, analysing the patterns in which this data is accessed can reveal private information about the end user. Netflix and Youtube are good examples of this: they deliver public content but can see which subset of the public content each user chooses to interact with. While at the scale of an average individual user this is a negligible leak, at the size of hyperscalars the data can be used to infer private information about users often not directly related to their watch patterns that these users not disclose volunatrily. One option to solve the problem is to stop interacting with any service that assumes leaking data access patterns. In today&amp;rsquo;s digital world this is almost impossible that is what makes Popcorn important.&lt;/p&gt;</description>
    </item>
    <item>
      <title></title>
      <link>https://narekg.me/seminal_papers/disco/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://narekg.me/seminal_papers/disco/</guid>
      <description>&lt;h2 id=&#34;what-is-the-problem-that-is-being-solved&#34;&gt;What is the problem that is being solved?&lt;/h2&gt;&#xA;&lt;p&gt;There is active research and new proposals for new exotic ways of organizing hardware. NUMA is one of these still new and shiny ideas. However, with existing operating systems built with existing hardware in mind, it is really hard to drive adoption for this new hardware ideas. This means that even if a hardware innovation was unequivocally better for the long term, it might lose to the status quo because existing OSes could decide not to support it and the cost of adoption for each individual application would therefore be bigger for the short term than the cost of using an inferior system.&lt;/p&gt;</description>
    </item>
    <item>
      <title></title>
      <link>https://narekg.me/seminal_papers/popcorn/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://narekg.me/seminal_papers/popcorn/</guid>
      <description>&lt;h2 id=&#34;what-is-the-problem-and-why-is-it-important&#34;&gt;What is the problem and why is it important?&lt;/h2&gt;&#xA;&lt;p&gt;As data gets more and more conentrated in the servers of giant private companies, even if the data is not secret, analysing the patterns in which this data is accessed can reveal private information about the end user. Netflix and Youtube are good examples of this: they deliver public content but can see which subset of the public content each user chooses to interact with. While at the scale of an average individual user this is a negligible leak, at the size of hyperscalars the data can be used to infer private information about users often not directly related to their watch patterns that these users not disclose volunatrily. One option to solve the problem is to stop interacting with any service that assumes leaking data access patterns. In today&amp;rsquo;s digital world this is almost impossible that is what makes Popcorn important.&lt;/p&gt;</description>
    </item>
    <item>
      <title></title>
      <link>https://narekg.me/seminal_papers/xen/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://narekg.me/seminal_papers/xen/</guid>
      <description>&lt;h2 id=&#34;what-is-the-problem-that-is-being-solved&#34;&gt;What is the problem that is being solved?&lt;/h2&gt;&#xA;&lt;p&gt;Sometimes we want to share hardware. OSes and timesharing systems were built to solve this issue but generally have a large system area. So OSes are great for sharing hardware in a trusted environment among users that trusted each other. On the other hand, sometimes we want to guarantee 100% hardware isolation and want to run applications requiring different operating systems on the same hardware. The state of the art for this has significant overhead which renders it impractical for many use-cases. The authors notice that many of these overheads are not fundamental and can be overcome through a couple of trade-offs They then design a system that is able to run 100 VMs simultaneously with under 1% overhead.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
