<?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>Parallel-Programming on Rafiul Alam</title>
    <link>https://alamrafiul.com/tags/parallel-programming/</link>
    <description>Recent content in Parallel-Programming on Rafiul Alam</description>
    <image>
      <title>Rafiul Alam</title>
      <url>https://alamrafiul.com/papermod-cover.png</url>
      <link>https://alamrafiul.com/papermod-cover.png</link>
    </image>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Thu, 30 Jan 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://alamrafiul.com/tags/parallel-programming/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Go Concurrency Pattern: Monte Carlo Pi Estimation</title>
      <link>https://alamrafiul.com/posts/go-monte-carlo-pi/</link>
      <pubDate>Thu, 30 Jan 2025 00:00:00 +0000</pubDate>
      
      <guid>https://alamrafiul.com/posts/go-monte-carlo-pi/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://alamrafiul.com/posts/go-login-counter/&#34;&gt;← Login Counter&lt;/a&gt; | &lt;a href=&#34;https://alamrafiul.com/concurrency-patterns/&#34;&gt;Series Overview&lt;/a&gt; | &lt;a href=&#34;https://alamrafiul.com/posts/go-sieve-eratosthenes/&#34;&gt;Sieve of Eratosthenes →&lt;/a&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;the-problem-computing-pi-by-throwing-darts&#34;&gt;The Problem: Computing Pi by Throwing Darts&lt;/h2&gt;
&lt;p&gt;Imagine a square dartboard with a circle inscribed inside it. Throw random darts at the square. The ratio of darts landing inside the circle to total darts thrown approaches π/4.&lt;/p&gt;
&lt;p&gt;Why? &lt;strong&gt;Mathematics:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Square side length: 2 (from -1 to 1)&lt;/li&gt;
&lt;li&gt;Square area: 4&lt;/li&gt;
&lt;li&gt;Circle radius: 1&lt;/li&gt;
&lt;li&gt;Circle area: π × 1² = π&lt;/li&gt;
&lt;li&gt;Ratio: π/4&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Throw 1 million darts, multiply by 4, and you&amp;rsquo;ve estimated π. More darts = better estimate. This is &lt;strong&gt;Monte Carlo simulation&lt;/strong&gt;: using randomness to solve deterministic problems.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Go Concurrency Pattern: The Mandelbrot Set</title>
      <link>https://alamrafiul.com/posts/go-mandelbrot-set/</link>
      <pubDate>Mon, 27 Jan 2025 00:00:00 +0000</pubDate>
      
      <guid>https://alamrafiul.com/posts/go-mandelbrot-set/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://alamrafiul.com/posts/go-sieve-eratosthenes/&#34;&gt;← Sieve of Eratosthenes&lt;/a&gt; | &lt;a href=&#34;https://alamrafiul.com/concurrency-patterns/&#34;&gt;Series Overview&lt;/a&gt; | &lt;a href=&#34;https://alamrafiul.com/posts/go-collatz-explorer/&#34;&gt;Collatz Explorer →&lt;/a&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;the-problem-rendering-fractals-in-parallel&#34;&gt;The Problem: Rendering Fractals in Parallel&lt;/h2&gt;
&lt;p&gt;The Mandelbrot set is defined by a simple iterative formula:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Start with &lt;code&gt;z = 0&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Repeatedly compute &lt;code&gt;z = z² + c&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;If &lt;code&gt;|z|&lt;/code&gt; exceeds 2, the point escapes (not in the set)&lt;/li&gt;
&lt;li&gt;Color each pixel by iteration count&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;The beauty:&lt;/strong&gt; Each pixel is completely independent. Perfect for parallelism!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The challenge:&lt;/strong&gt; Some pixels escape in 5 iterations, others take 1000+. This creates &lt;strong&gt;load imbalance&lt;/strong&gt;-some workers finish instantly while others grind away.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Go Concurrency Pattern: Goroutine Basics</title>
      <link>https://alamrafiul.com/posts/go-goroutine-basics/</link>
      <pubDate>Wed, 12 Jun 2024 00:00:00 +0000</pubDate>
      
      <guid>https://alamrafiul.com/posts/go-goroutine-basics/</guid>
      <description>&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Go Concurrency Patterns Series:&lt;/strong&gt;
&lt;a href=&#34;https://alamrafiul.com/concurrency-patterns/&#34;&gt;Series Overview&lt;/a&gt; | &lt;a href=&#34;https://alamrafiul.com/posts/go-channel-fundamentals/&#34;&gt;Channel Fundamentals →&lt;/a&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;what-are-goroutines&#34;&gt;What are Goroutines?&lt;/h2&gt;
&lt;p&gt;Goroutines are lightweight threads managed by the Go runtime. They&amp;rsquo;re one of Go&amp;rsquo;s most powerful features, allowing you to write concurrent programs that can handle thousands of simultaneous operations with minimal overhead. Think of goroutines as extremely efficient workers that can run independently while sharing the same memory space.&lt;/p&gt;
&lt;p&gt;Unlike traditional threads that typically consume 1-2MB of memory each, goroutines start with just 2KB of stack space and grow as needed. This efficiency allows Go programs to spawn millions of goroutines without overwhelming system resources.&lt;/p&gt;</description>
    </item>
    
  </channel>
</rss>
