<!doctype html>
<html lang="en">

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

	<title>reveal.js</title>

	<link rel="stylesheet" href="dist/reset.css">
	<link rel="stylesheet" href="dist/reveal.css">
	<link rel="stylesheet" href="dist/theme/sky.css">

	<!-- Theme used for syntax highlighted code -->
	<link rel="stylesheet" href="plugin/highlight/zenburn.css">
</head>

<body>
	<div class="reveal">
		<div class="slides">
			<section>
				<h1>Xous</h1>
				<h2>Embedded Multiprocess Microkernel</h2>
				<h3>17 April 2024, Sean Cross</h3>
			</section>
			<section>
				<h2>Outline</h2>
				<ol>
					<li>About Me</li>
					<li>Project history</li>
					<li>Why a new OS?</li>
					<li>What can it do?</li>
					<li>How do I use it?</li>
				</ol>
			</section>
			<section>
				<section>
					<h2>About Me</h2>
					<ul>
						<li>Live in Singapore</li>
						<li>Enjoy understanding systems</li>
						<li>Low-level is best</li>
					</ul>
				</section>
				<section>
					<h2>Novena: Open laptop</h2>
					<div class="r-hstack">
						<div>
							<img data-src="img/novena-1068_jpg_md-xl.jpg" height="400">
						</div>
						<div>
							<ul>
								<li>Always wanted custom laptop</li>
								<li>"Large" Cortex A9</li>
								<li>32 GB disk, 4 GB RAM</li>
								<li>Linux</li>
							</ul>
						</div>
					</div>
				</section>
				<section>
					<img data-src="img/novena-1089_jpg_project-body.jpg" height="600">
				</section>
				<section>
					<h2>Chibitronics: Programming for 8-year-olds</h2>
					<div class="r-hstack">
						<div>
							<img data-src="img/ltc.jpg" height="400">
						</div>
						<div>
							<ul>
								<li>Paper circuit design</li>
								<li>"Small" Cortex M0+</li>
								<li>32 kB flash, 4 kB RAM</li>
								<li>ChibiOS</li>
							</ul>
						</div>
					</div>
				</section>
				<section>
					<h2>Precursor Design</h2>
					<div class="r-hstack">
						<div>
							<img data-src="img/betrusted_pvt_blockdiag.png" height="500">
						</div>
						<div>
							<ul>
								<li>Two FPGA-based CPUs</li>
								<li>RV32IMAC based on VexRiscv</li>
								<li>128 MB flash, 16 MB RAM</li>
								<li class="fragment">Operating System?</li>
							</ul>
						</div>
					</div>
				</section>
				<section>
					<img data-src="img/a-r-m.png">
				</section>
				<section>
					<h2>Operating System Selection</h2>
					<ul>
						<li>RISC-V</li>
						<li>Memory Protection</li>
						<li>Not Linux</li>
						<li class="fragment">Rust is a new thing?</li>
					</ul>
				</section>
			</section>
			<section>
				<section>
					<h2>Xous Design</h2>
				</section>
				<section>
					<h2>Brief Specs</h2>
					<ul>
						<li>Kernel is 17k sloc</li>
						<!-- * 6k of that is a RISC-V disassembler for optional GDB support -->
						<li>Threads</li>
						<li>Processes</li>
						<li>Tier 2 Rust support</li>
						<!-- * libstd -->
					</ul>
				</section>
				<section>
					<h2>Other Features</h2>
					<ul>
						<li>Microkernel</li>
						<li>Interrupts in userspace</li>
						<li>Each page of memory is mapped once</li>
						<li class="fragment">Only <i>stable</i> Rust</li>
						<li class="fragment">No C compiler required</li>
					</ul>
				</section>
				<section>
					<h2>More Specs</h2>
					<ul>
						<li>Kernel is single-threaded</li>
						<li>Services use well-defined API calls</li>
						<li>All drivers provided in user space</li>
						<li>Each page of memory can only be lent once</li>
					</ul>
					</ul>
				</section>
				<section>
					<h2>Messages are Everything</h2>
					<ul>
						<li>Messages form IPC</li>
						<li>Scalars or Pages</li>
						<li>Blocking or Nonblocking</li>
					</ul>
				</section>
				<section>
					<h2>Example: Sleeping</h2>

					<code>sleep(msec: usize)</code>
					<ol>
						<li>Connect to "ticktimer" server</li>
						<li>Send a `BlockingScalar` with desired duration</li>
						<li>Client will block until server replies</li>
						<li>Server calls `ReturnScalar()` after expiration</li>
					</ol>
				</section>

				<section>
					<h2>Example: Mutex</h2>
					<code>mutex.lock().unwrap()</code>
					<ol>
						<li>Fast path with <code>AtomicIsize</code></li>
						<li>Slow path by sending <code>LockMutex</code></li>
						<li>On unlock, contending thread will see poison and send <code>UnlockMutex</code></li>
						<li>Server will reply to <code>LockMutex</code> message to unblock the thread</li>
					</ol>
				</section>

				<section>
					<h2>MMUs are Amazing</h2>
					<ul>
						<li>XIP flash for free!</li>
						<li>Swap space</li>
						<li>Encrypted swap? No problem!</li>
						<li>Realtime patching broken hardware</li>
					</ul>
				</section>
				<section>
					<h2>How can I use it?</h2>
					<div class="r-hstack">
						<div>
							<img data-src="img/renode-networking.png">
						</div>
						<div>
							<ul>
								<li>Talk to system vendors -- get them to include MMUs!</li>
								<li>Emulation is easiest -- Renode support</li>
							</ul>
						</div>
				</section>
			</section>
			<section>
				<h2>Thank you!</h2>
				<h3>github.com/betrusted-io/xous-core</h3>
				<!-- <h3 class="fragment">Questions?</h3> -->
			</section>
		</div>
	</div>

	<script src="dist/reveal.js"></script>
	<script src="plugin/notes/notes.js"></script>
	<script src="plugin/markdown/markdown.js"></script>
	<script src="plugin/highlight/highlight.js"></script>
	<script>
		// More info about initialization & config:
		// - https://revealjs.com/initialization/
		// - https://revealjs.com/config/
		Reveal.initialize({
			hash: true,
			controls: false,
			width: 1200,
			height: 700,

			// Learn about plugins: https://revealjs.com/plugins/
			plugins: [RevealMarkdown, RevealHighlight, RevealNotes]
		});
	</script>
</body>

</html>