<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Real-Time Systems on Prateek Sharma</title>
		<link>https://prateeksharma.me/tags/real-time-systems/</link>
		<description>Recent content in Real-Time Systems on Prateek Sharma</description>
		<generator>Hugo</generator>
		<language>en-us</language>
		
		
		
		
			<lastBuildDate>Thu, 27 Aug 2026 00:00:00 +0000</lastBuildDate>
		
			<atom:link href="https://prateeksharma.me/tags/real-time-systems/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>Two-sided membership needs one lock, not two</title>
				<link>https://prateeksharma.me/blog/atomic-membership-in-a-concurrent-go-library/</link>
				<pubDate>Thu, 27 Aug 2026 00:00:00 +0000</pubDate>
				<guid>https://prateeksharma.me/blog/atomic-membership-in-a-concurrent-go-library/</guid>
				<description>&lt;p&gt;&lt;a href=&#34;https://prateeksharma.me/projects/goroomlib/&#34;&gt;Goroomlib&lt;/a&gt;&#xA; models a relationship that points both ways: a&#xA;&lt;code&gt;Room&lt;/code&gt; holds a map of its users, and each &lt;code&gt;User&lt;/code&gt; holds a list of the rooms it&amp;rsquo;s&#xA;in. That redundancy is deliberate — both lookups need to be O(1) — but it&amp;rsquo;s also&#xA;the whole bug surface.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-first-version&#34;&gt;The first version&lt;/h2&gt;&#xA;&lt;p&gt;&lt;code&gt;AddUserToRoom&lt;/code&gt; did the obvious thing:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-go&#34; data-lang=&#34;go&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ff7b72&#34;&gt;func&lt;/span&gt;&lt;span style=&#34;color:#6e7681&#34;&gt; &lt;/span&gt;(s&lt;span style=&#34;color:#6e7681&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ff7b72;font-weight:bold&#34;&gt;*&lt;/span&gt;RoomService)&lt;span style=&#34;color:#6e7681&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#d2a8ff;font-weight:bold&#34;&gt;AddUserToRoom&lt;/span&gt;(roomName&lt;span style=&#34;color:#6e7681&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ff7b72&#34;&gt;string&lt;/span&gt;,&lt;span style=&#34;color:#6e7681&#34;&gt; &lt;/span&gt;user&lt;span style=&#34;color:#6e7681&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ff7b72;font-weight:bold&#34;&gt;*&lt;/span&gt;User)&lt;span style=&#34;color:#6e7681&#34;&gt; &lt;/span&gt;{&lt;span style=&#34;color:#6e7681&#34;&gt;&#xA;&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:#6e7681&#34;&gt;    &lt;/span&gt;room&lt;span style=&#34;color:#6e7681&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ff7b72;font-weight:bold&#34;&gt;:=&lt;/span&gt;&lt;span style=&#34;color:#6e7681&#34;&gt; &lt;/span&gt;s.rooms[roomName]&lt;span style=&#34;color:#6e7681&#34;&gt;&#xA;&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:#6e7681&#34;&gt;&#xA;&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:#6e7681&#34;&gt;    &lt;/span&gt;room.mu.&lt;span style=&#34;color:#d2a8ff;font-weight:bold&#34;&gt;Lock&lt;/span&gt;()&lt;span style=&#34;color:#6e7681&#34;&gt;&#xA;&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:#6e7681&#34;&gt;    &lt;/span&gt;room.users[user.ID]&lt;span style=&#34;color:#6e7681&#34;&gt; &lt;/span&gt;=&lt;span style=&#34;color:#6e7681&#34;&gt; &lt;/span&gt;user&lt;span style=&#34;color:#6e7681&#34;&gt;&#xA;&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:#6e7681&#34;&gt;    &lt;/span&gt;room.mu.&lt;span style=&#34;color:#d2a8ff;font-weight:bold&#34;&gt;Unlock&lt;/span&gt;()&lt;span style=&#34;color:#6e7681&#34;&gt;&#xA;&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:#6e7681&#34;&gt;&#xA;&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:#6e7681&#34;&gt;    &lt;/span&gt;user.mu.&lt;span style=&#34;color:#d2a8ff;font-weight:bold&#34;&gt;Lock&lt;/span&gt;()&lt;span style=&#34;color:#6e7681&#34;&gt;&#xA;&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:#6e7681&#34;&gt;    &lt;/span&gt;user.joinedRooms&lt;span style=&#34;color:#6e7681&#34;&gt; &lt;/span&gt;=&lt;span style=&#34;color:#6e7681&#34;&gt; &lt;/span&gt;append(user.joinedRooms,&lt;span style=&#34;color:#6e7681&#34;&gt; &lt;/span&gt;roomName)&lt;span style=&#34;color:#6e7681&#34;&gt;&#xA;&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:#6e7681&#34;&gt;    &lt;/span&gt;user.mu.&lt;span style=&#34;color:#d2a8ff;font-weight:bold&#34;&gt;Unlock&lt;/span&gt;()&lt;span style=&#34;color:#6e7681&#34;&gt;&#xA;&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:#6e7681&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Each side is individually locked, so &lt;code&gt;go vet&lt;/code&gt; and the race detector on a simple&#xA;test are both happy. But there&amp;rsquo;s a window between the two critical sections where&#xA;the room says &amp;ldquo;user is here&amp;rdquo; and the user says &amp;ldquo;I&amp;rsquo;m not in that room.&amp;rdquo; Anything&#xA;that reads both — say, a disconnect handler that walks &lt;code&gt;user.joinedRooms&lt;/code&gt; to&#xA;remove the user from each — can run in that window and leak the membership.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Goroomlib</title>
				<link>https://prateeksharma.me/projects/goroomlib/</link>
				<pubDate>Sun, 23 Aug 2026 00:00:00 +0000</pubDate>
				<guid>https://prateeksharma.me/projects/goroomlib/</guid>
				<description>&lt;p&gt;Across the poker platforms I&amp;rsquo;ve worked on at Adda52 and Mind Sports League, one&#xA;shape kept showing up: users joining a table, leaving it, sending messages to&#xA;everyone at it, and the server keeping track of who&amp;rsquo;s where. Every time I touched&#xA;a new real-time feature, I ended up rewriting the same User and Room bookkeeping&#xA;from scratch. I wanted to pull that pattern out once, get it right, and stop&#xA;reimplementing it.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Mind Sports League</title>
				<link>https://prateeksharma.me/experience/mind-sports-league/</link>
				<pubDate>Mon, 01 Mar 2021 00:00:00 +0000</pubDate>
				<guid>https://prateeksharma.me/experience/mind-sports-league/</guid>
				<description>&lt;p&gt;Mind Sports League ran an online poker platform. I led development of the game&#xA;and tournament features on top of the existing platform.&lt;/p&gt;&#xA;&lt;h2 id=&#34;engineering-areas&#34;&gt;Engineering areas&lt;/h2&gt;&#xA;&lt;h3 id=&#34;tournament-features&#34;&gt;Tournament features&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Built advanced tournament mechanics: &lt;strong&gt;hand-for-hand&lt;/strong&gt; play, &lt;strong&gt;re-entry&lt;/strong&gt;, and&#xA;&lt;strong&gt;table balancing&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;real-time-backend&#34;&gt;Real-time backend&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Engineered game-state management and an &lt;strong&gt;event-driven backend&lt;/strong&gt; handling&#xA;thousands of concurrent players with low-latency communication.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;training-tools&#34;&gt;Training tools&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Built a &lt;strong&gt;poker simulator&lt;/strong&gt; integrated with an educational platform, so&#xA;players could practise strategy and review analytics.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;stack&#34;&gt;Stack&lt;/h2&gt;&#xA;&lt;p&gt;Real-time / event-driven backend · game-state management · AngularJS (simulator)&lt;/p&gt;</description>
			</item>
			<item>
				<title>Adda52 — Delta Corp</title>
				<link>https://prateeksharma.me/experience/adda52/</link>
				<pubDate>Mon, 01 Sep 2014 00:00:00 +0000</pubDate>
				<guid>https://prateeksharma.me/experience/adda52/</guid>
				<description>&lt;p&gt;Adda52 is one of India&amp;rsquo;s largest real-money poker platforms. I joined as a&#xA;graduate trainee in 2014 and left in 2020 as a Senior Software Engineer, working&#xA;across the game backend, load and resilience testing, and the public platform.&lt;/p&gt;&#xA;&lt;h2 id=&#34;role-progression&#34;&gt;Role progression&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Graduate Engineer Trainee&lt;/strong&gt; (Sep 2014 – Oct 2015)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Software Engineer&lt;/strong&gt; (Oct 2015 – Oct 2016)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Senior Software Engineer&lt;/strong&gt; (Oct 2016 – Feb 2020)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;engineering-areas&#34;&gt;Engineering areas&lt;/h2&gt;&#xA;&lt;h3 id=&#34;game-logic&#34;&gt;Game logic&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Contributed to core poker cash-game and tournament-management modules.&lt;/li&gt;&#xA;&lt;li&gt;Implemented the &lt;strong&gt;OFC&lt;/strong&gt; poker variant end to end on the &lt;code&gt;adda52live.com&lt;/code&gt;&#xA;frontend (Angular 2).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;load-and-resilience-testing&#34;&gt;Load and resilience testing&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Enhanced Java-based user-behaviour simulators to &lt;strong&gt;load test real-time poker&#xA;servers at 10,000+ concurrent users&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Built &lt;strong&gt;disaster-recovery systems&lt;/strong&gt; for zero-downtime gameplay — restoring&#xA;poker games and player state after a failure.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;platform-migration&#34;&gt;Platform migration&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Led migration of the public gaming platform from &lt;strong&gt;PHP to Node.js&lt;/strong&gt;, improving&#xA;performance and maintainability.&lt;/li&gt;&#xA;&lt;li&gt;Built Angular 2 interfaces for event bookings on &lt;code&gt;adda52live.com&lt;/code&gt; and&#xA;user-segmentation logic for targeted marketing.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;delivery&#34;&gt;Delivery&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Developed Gradle-based CI/CD pipelines with &lt;strong&gt;Jenkins&lt;/strong&gt;, automating builds and&#xA;reducing integration friction.&lt;/li&gt;&#xA;&lt;li&gt;Represented a 6-member team in sprint planning and stakeholder meetings,&#xA;coordinating with QA, product, and DevOps.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;stack&#34;&gt;Stack&lt;/h2&gt;&#xA;&lt;p&gt;Java · Node.js · Angular 2 · Jenkins · Gradle&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
