Skip to content

Commit

Permalink
Deploying to gh-pages from @ fa6f8d2 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
brianshih1 committed Jul 27, 2024
1 parent 6bbc7bf commit ab714ae
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion executor/waker_implementation.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ <h1 class="menu-title">Building an Asynchronous Runtime like Glommio</h1>
<div id="content" class="content">
<main>
<h1 id="waker"><a class="header" href="#waker">Waker</a></h1>
<p>Earlier, we saw that when <code>RawTask::run</code> is called, <code>run</code> creates a <code>waker</code> which is used to <code>poll</code> the user-provided <code>Future</code>. In this section, we look at how the <code>Waker</code> is implemented.</p>
<p>Earlier, we saw that when <code>RawTask::run</code> is called, <code>run</code> creates a <code>waker</code> which is used to <code>poll</code> the user-provided <code>Future</code>. In this section, we look at how the <code>Waker</code> instance is created.</p>
<p>To create a <code>waker</code> in Rust, we need to pass a <code>RawWakerVTable</code> to the <code>Waker</code> constructor.</p>
<p>Here is the vtable for the task:</p>
<pre><code>impl&lt;F, R, S&gt; RawTask&lt;F, R, S&gt;
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ <h1 class="menu-title">Building an Asynchronous Runtime like Glommio</h1>
<h1 id="motivation"><a class="header" href="#motivation">Motivation</a></h1>
<p>I've always wondered how asynchronous runtimes like <a href="https://nodejs.org/en/about">Node.js</a>, <a href="https://seastar.io/">Seastar</a>, <a href="https://docs.rs/glommio/latest/glommio/">Glommio</a>, and <a href="https://tokio.rs/">Tokio</a> work under the hood. Luckily, most asynchronous runtimes are open source.
There is also a bunch of excellent blogs online such as the <a href="https://rust-lang.github.io/async-book/">Asychronous Programming in Rust blog series</a>.</p>
<p>To better understand the internals of asynchronous runtimes, I built <code>mini-async-runtime</code>, a lightweight, toy asynchronous runtime written in Rust. I borrowed a lot of code from <a href="https://github.com/DataDog/glommio">Glommio</a> and <a href="https://github.com/smol-rs/async-io">async-io</a> to help myself prototype faster, since my goal was simply to gain a better intuition for how these systems really work. The <a href="https://github.com/brianshih1/mini-async-runtime">source code</a> is available online.</p>
<p>To better understand the internals of asynchronous runtimes, I built <code>mini-async-runtime</code>, a lightweight, toy asynchronous runtime written in Rust. I reused a lot of code from <a href="https://github.com/DataDog/glommio">Glommio</a> and <a href="https://github.com/smol-rs/async-io">async-io</a> to help myself prototype faster, since my goal was just to gain a better intuition for how these systems really work. The <a href="https://github.com/brianshih1/mini-async-runtime">source code</a> is available online.</p>
<p>In this blog series, I will deep dive into the internals of <code>mini-async-runtime</code>. Even though my implementation is in Rust, this blog is meant to
be language agnostic as most asynchronous runtimes, even in other languages, use a similar event-loop + reactor architecture. </p>
<h2 id="what-is-an-asynchronous-runtime"><a class="header" href="#what-is-an-asynchronous-runtime">What is an asynchronous runtime?</a></h2>
Expand All @@ -171,7 +171,7 @@ <h2 id="what-are-we-building"><a class="header" href="#what-are-we-building">Wha
<li><strong>Phase 4 [WIP]</strong>: In phase 4, we will build more advanced abstractions such as Executor Pools.</li>
</ul>
<p>As a teaser, here is the architecture of the async runtime that we are building:</p>
<img src="../images/architecture.png" width="110%">
<img src="./images/architecture.png" width="110%">
</main>

<nav class="nav-wrapper" aria-label="Page navigation">
Expand Down
4 changes: 2 additions & 2 deletions motivation.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ <h1 class="menu-title">Building an Asynchronous Runtime like Glommio</h1>
<h1 id="motivation"><a class="header" href="#motivation">Motivation</a></h1>
<p>I've always wondered how asynchronous runtimes like <a href="https://nodejs.org/en/about">Node.js</a>, <a href="https://seastar.io/">Seastar</a>, <a href="https://docs.rs/glommio/latest/glommio/">Glommio</a>, and <a href="https://tokio.rs/">Tokio</a> work under the hood. Luckily, most asynchronous runtimes are open source.
There is also a bunch of excellent blogs online such as the <a href="https://rust-lang.github.io/async-book/">Asychronous Programming in Rust blog series</a>.</p>
<p>To better understand the internals of asynchronous runtimes, I built <code>mini-async-runtime</code>, a lightweight, toy asynchronous runtime written in Rust. I borrowed a lot of code from <a href="https://github.com/DataDog/glommio">Glommio</a> and <a href="https://github.com/smol-rs/async-io">async-io</a> to help myself prototype faster, since my goal was simply to gain a better intuition for how these systems really work. The <a href="https://github.com/brianshih1/mini-async-runtime">source code</a> is available online.</p>
<p>To better understand the internals of asynchronous runtimes, I built <code>mini-async-runtime</code>, a lightweight, toy asynchronous runtime written in Rust. I reused a lot of code from <a href="https://github.com/DataDog/glommio">Glommio</a> and <a href="https://github.com/smol-rs/async-io">async-io</a> to help myself prototype faster, since my goal was just to gain a better intuition for how these systems really work. The <a href="https://github.com/brianshih1/mini-async-runtime">source code</a> is available online.</p>
<p>In this blog series, I will deep dive into the internals of <code>mini-async-runtime</code>. Even though my implementation is in Rust, this blog is meant to
be language agnostic as most asynchronous runtimes, even in other languages, use a similar event-loop + reactor architecture. </p>
<h2 id="what-is-an-asynchronous-runtime"><a class="header" href="#what-is-an-asynchronous-runtime">What is an asynchronous runtime?</a></h2>
Expand All @@ -171,7 +171,7 @@ <h2 id="what-are-we-building"><a class="header" href="#what-are-we-building">Wha
<li><strong>Phase 4 [WIP]</strong>: In phase 4, we will build more advanced abstractions such as Executor Pools.</li>
</ul>
<p>As a teaser, here is the architecture of the async runtime that we are building:</p>
<img src="../images/architecture.png" width="110%">
<img src="./images/architecture.png" width="110%">
</main>

<nav class="nav-wrapper" aria-label="Page navigation">
Expand Down
6 changes: 3 additions & 3 deletions print.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ <h1 class="menu-title">Building an Asynchronous Runtime like Glommio</h1>
<h1 id="motivation"><a class="header" href="#motivation">Motivation</a></h1>
<p>I've always wondered how asynchronous runtimes like <a href="https://nodejs.org/en/about">Node.js</a>, <a href="https://seastar.io/">Seastar</a>, <a href="https://docs.rs/glommio/latest/glommio/">Glommio</a>, and <a href="https://tokio.rs/">Tokio</a> work under the hood. Luckily, most asynchronous runtimes are open source.
There is also a bunch of excellent blogs online such as the <a href="https://rust-lang.github.io/async-book/">Asychronous Programming in Rust blog series</a>.</p>
<p>To better understand the internals of asynchronous runtimes, I built <code>mini-async-runtime</code>, a lightweight, toy asynchronous runtime written in Rust. I borrowed a lot of code from <a href="https://github.com/DataDog/glommio">Glommio</a> and <a href="https://github.com/smol-rs/async-io">async-io</a> to help myself prototype faster, since my goal was simply to gain a better intuition for how these systems really work. The <a href="https://github.com/brianshih1/mini-async-runtime">source code</a> is available online.</p>
<p>To better understand the internals of asynchronous runtimes, I built <code>mini-async-runtime</code>, a lightweight, toy asynchronous runtime written in Rust. I reused a lot of code from <a href="https://github.com/DataDog/glommio">Glommio</a> and <a href="https://github.com/smol-rs/async-io">async-io</a> to help myself prototype faster, since my goal was just to gain a better intuition for how these systems really work. The <a href="https://github.com/brianshih1/mini-async-runtime">source code</a> is available online.</p>
<p>In this blog series, I will deep dive into the internals of <code>mini-async-runtime</code>. Even though my implementation is in Rust, this blog is meant to
be language agnostic as most asynchronous runtimes, even in other languages, use a similar event-loop + reactor architecture. </p>
<h2 id="what-is-an-asynchronous-runtime"><a class="header" href="#what-is-an-asynchronous-runtime">What is an asynchronous runtime?</a></h2>
Expand All @@ -172,7 +172,7 @@ <h2 id="what-are-we-building"><a class="header" href="#what-are-we-building">Wha
<li><strong>Phase 4 [WIP]</strong>: In phase 4, we will build more advanced abstractions such as Executor Pools.</li>
</ul>
<p>As a teaser, here is the architecture of the async runtime that we are building:</p>
<img src="../images/architecture.png" width="110%"><div style="break-before: page; page-break-before: always;"></div><h1 id="what-is-an-executor"><a class="header" href="#what-is-an-executor">What is an executor?</a></h1>
<img src="./images/architecture.png" width="110%"><div style="break-before: page; page-break-before: always;"></div><h1 id="what-is-an-executor"><a class="header" href="#what-is-an-executor">What is an executor?</a></h1>
<p>As we mentioned earlier, asynchronous programming allows multiple tasks to run on a single thread (or a thread pool). To do that, we need a scheduler
that figures out which task to run at any moment and when to switch tasks. That is what an <strong>executor</strong> does.</p>
<p>There are two categories for how an executor schedules task:</p>
Expand Down Expand Up @@ -1013,7 +1013,7 @@ <h3 id="code-references-2"><a class="header" href="#code-references-2">Code Refe
<li><a href="https://github.com/DataDog/glommio/blob/d93c460c3def6b11a224892657a6a6a80edf6311/glommio/src/executor/multitask.rs#L114">LocalExecutor</a> - My toy implementation calls the <code>LocalExecutor</code> the <code>TaskQueueExecutor</code></li>
</ul>
<div style="break-before: page; page-break-before: always;"></div><h1 id="waker-1"><a class="header" href="#waker-1">Waker</a></h1>
<p>Earlier, we saw that when <code>RawTask::run</code> is called, <code>run</code> creates a <code>waker</code> which is used to <code>poll</code> the user-provided <code>Future</code>. In this section, we look at how the <code>Waker</code> is implemented.</p>
<p>Earlier, we saw that when <code>RawTask::run</code> is called, <code>run</code> creates a <code>waker</code> which is used to <code>poll</code> the user-provided <code>Future</code>. In this section, we look at how the <code>Waker</code> instance is created.</p>
<p>To create a <code>waker</code> in Rust, we need to pass a <code>RawWakerVTable</code> to the <code>Waker</code> constructor.</p>
<p>Here is the vtable for the task:</p>
<pre><code>impl&lt;F, R, S&gt; RawTask&lt;F, R, S&gt;
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion searchindex.json

Large diffs are not rendered by default.

0 comments on commit ab714ae

Please sign in to comment.