Skip to content

Commit c5286e9

Browse files
wip: new post, update css
Signed-off-by: Henry Gressmann <[email protected]>
1 parent c608155 commit c5286e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+678
-275
lines changed

content/2024/api-design/index.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: Context-free API Design
3+
date: 2024-10-06
4+
draft: true
5+
---
6+
7+
<!--
8+
* I tried out kotlin, elixir
9+
* Coming from a different mindset, too much context
10+
* Code generation, too much boilerplate
11+
* New Java/C# have the right idea: allow boilerplate free main code
12+
* Good Library API design doesn't have magic and can be understand without knowlege of the programming language
13+
-->

content/2024/books.md

+28-13
Original file line numberDiff line numberDiff line change
@@ -11,69 +11,84 @@ tags = []
1111

1212
This year I planed to venture out of my comfort zone and read more non-fiction, but in the end allmost all of my favorite books still ended up being sci-fi.
1313

14+
<br />
15+
1416
# [The Teixcalaan Series](https://www.goodreads.com/series/233352-teixcalaan)
1517

1618
A world you can easily get lost in, filled with intrigues, politics, and a very unique culture. A diverse cast of characters with their own motivations and goals, that doesn't feel forced or tokenized. Definitely one of my favorite series of all time, and I'm looking forward to more books set in this universe.
1719

20+
<br />
21+
1822
# [The Murderbot Diaries](https://www.goodreads.com/series/191900-the-murderbot-diaries) by Martha Wells
1923

2024
If you need something a bit more light-hearted, I can highly recommend the Murderbot Diaries. It's a series of novellas about a murderous robot that just wants to be left alone to watch TV. Even though he's not human, Martha Wells does a fantastic job of creating an empathetic character. While there's quite a few books already, most of them are pretty short and you won't be able to put them down. The latest book in the series came out at the end of 2023 and I'm looking forward to more books in the series.
2125

26+
<br />
27+
2228
# [The Hitchhiker's Guide to the Galaxy](https://www.goodreads.com/series/40957-the-hitchhiker-s-guide-to-the-galaxy) by Douglas Adams
2329

2430
The movie was never really my thing, but I'm glad I finally read the book. Douglas Adams's writing style is just so fun, but sometimes it can be a bit too much.
2531
It has something for everyone, but I recommend stopping after 'So Long, and Thanks for All the Fish', probably the best book in the series.
2632
A couple of days ago I've also started reading [Colour of Magic](https://www.goodreads.com/book/show/8695.The_Colour_of_Magic) by Terry Pratchett, and so far it's a very similar style of humor, without as much absurdity - I'm looking forward to reading more of Discworld.
2733

34+
<br />
35+
2836
# [Ra](https://www.goodreads.com/book/show/57891607-ra) by Sam Hughes
2937

3038
A very unique and super creative take on "Magic Systems", but don't let that fool you, this is a hard sci-fi book. Most of the abstracts and summaries I've seen online don't do it justice, and it's worth to finish the book even if you're not sure about it at the start, great plot twists and a very satisfying ending.
3139
I also recommend [Valuable Humans in Transit and Other Stories](https://www.goodreads.com/book/show/63198504-valuable-humans-in-transit-and-other-stories?ref=nav_sb_ss_1_26) and [There Is No Antimemetics Division](https://www.goodreads.com/book/show/54870256-there-is-no-antimemetics-division?ref=rae_2) by Qntm/Sam Hughes, they're both free on [his website](https://qntm.org/scp).
3240

41+
<br />
42+
3343
# [The Metamorphosis of Prime Intellect](https://www.goodreads.com/book/show/64341.The_Metamorphosis_of_Prime_Intellect) by Roger Williams
3444

3545
I found this book from a recommendation on a [Podcast](https://www.youtube.com/watch?v=dNrTrx42DGQ) about AI safety and AGI. It explores some interesting topics around the nature of consciousness, immortality, and Singularity but I definitely have to warn you that the book can be pretty dark and disturbing at times. It takes place in a world with no moral constraints and the author doesn't shy away from the darker sides of human nature.
3646

3747
[A Casino Odyssey in Cyberspace](https://www.goodreads.com/book/show/41569567-a-casino-odyssey-in-cyberspace) is a sequel to this book, kind of going more into a post-scarcity world,
3848
and if you liked the first book you should definitely also check his [The Mortal Passage Trilogy](https://www.goodreads.com/book/show/24237204-the-mortal-passage-trilogy?ac=1&from_search=true&qid=DT495nnrDR&rank=1). Most of his books are available for free on his [website](http://localroger.com/prime-intellect/).
3949

50+
<br />
51+
4052
# [Do Androids Dream of Electric Sheep?](https://www.goodreads.com/book/show/36402034-do-androids-dream-of-electric-sheep) by Philip K. Dick
4153

4254
I don't know how I've not read it or watched the movies until now, such well made and thought provoking world building.
4355
There's soo much of the same story on self aware robots, but PKD's somehow over 50 years old book still feels fresh.
4456
The most interesting part for me was the societies view on animals, and how they've become a symbol of status and empathy.
4557

58+
<br />
59+
4660
# [UNIX: A History and a Memoir](https://www.goodreads.com/book/show/53011383-unix) by Brian W. Kernighan
4761

4862
A surprisingly inspiring book about the history of UNIX and the people behind it. Just makes you jealous the meeting all of these people working at Bell Labs and the early days of computing. The book goes a bit into the philosophy of UNIX and the design decisions that made it so successful, but it's more so focused on the people and the history of the project.
4963

64+
<br />
65+
5066
# [The Phantom Tollbooth](https://www.goodreads.com/book/show/378.The_Phantom_Tollbooth) by Norton Juster
5167

5268
Essentially a children's book, but I still found it very enjoyable as an adult. It's just so clever and fun, definitely something that can make a bad day better, and I'm sure I'll be reading it again in the future. Helps you remember to slow down and enjoy the journey.
5369

70+
<br />
71+
5472
# Honorable Mentions
5573

5674
As a honorable mention I also want to mention some books that I read this year. These held up surprisingly well and all of them are worth a read (or re-read).
5775

58-
## [Brave New World](https://www.goodreads.com/book/show/5129.Brave_New_World) by Aldous Huxley
76+
## > [Brave New World](https://www.goodreads.com/book/show/5129.Brave_New_World) by Aldous Huxley
5977

60-
## [1984](https://www.goodreads.com/book/show/40961427-1984) by George Orwell
78+
## > [1984](https://www.goodreads.com/book/show/40961427-1984) by George Orwell
6179

62-
## [Fahrenheit 451](https://www.goodreads.com/book/show/13079982-fahrenheit-451) by Ray Bradbury
80+
## > [Fahrenheit 451](https://www.goodreads.com/book/show/13079982-fahrenheit-451) by Ray Bradbury
6381

64-
## [The Time Machine](https://www.goodreads.com/book/show/2493.The_Time_Machine?ref=nav_sb_ss_5_9) by H.G. Wells
82+
## > [The Time Machine](https://www.goodreads.com/book/show/2493.The_Time_Machine?ref=nav_sb_ss_5_9) by H.G. Wells
6583

66-
## [Ender’s Game](https://www.goodreads.com/book/show/375802.Ender_s_Game) by Orson Scott Card
84+
## > [Ender’s Game](https://www.goodreads.com/book/show/375802.Ender_s_Game) by Orson Scott Card
6785

68-
## [Sidhartha](https://www.goodreads.com/book/show/52036.Siddhartha) by Hermann Hesse
86+
## > [Sidhartha](https://www.goodreads.com/book/show/52036.Siddhartha) by Hermann Hesse
6987

70-
## [The Count of Monte Cristo](https://www.goodreads.com/book/show/7126.The_Count_of_Monte_Cristo) by Alexandre Dumas
88+
## > [The Count of Monte Cristo](https://www.goodreads.com/book/show/7126.The_Count_of_Monte_Cristo) by Alexandre Dumas
7189

72-
## [Slaughterhouse-Five](https://www.goodreads.com/book/show/4981.Slaughterhouse_Five) by Kurt Vonnegut
90+
## > [Slaughterhouse-Five](https://www.goodreads.com/book/show/4981.Slaughterhouse_Five) by Kurt Vonnegut
7391

74-
I hope you found something interesting in this list, and for more recommendations you can check out my [Goodreads page](https://www.goodreads.com/review/list/129153443-henry?shelf=read) or [my reading list](https://www.goodreads.com/review/list/129153443-henry?shelf=to-read).
75-
76-
<br/>
77-
<br/>
92+
<br />
7893

79-
Oh, and a new post on my [Rust OS series](/series/rust-os/) is coming soon, some great new things have happened in the Rust embedded space in the last couple of months.
94+
I hope you found something interesting in this list, and for more recommendations you can check out my [Goodreads page](https://www.goodreads.com/review/list/129153443-henry?shelf=read) or [my reading list](https://www.goodreads.com/review/list/129153443-henry?shelf=to-read).

content/2024/tinywasm/assets/hn.jpg

13.3 KB
Loading
31 KB
Loading
Loading

content/2024/tinywasm/index.md

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title: "TinyWasm: How I wrote my own WebAssembly Runtime"
3+
date: 2024-10-06
4+
draft: true
5+
---
6+
7+
<!--
8+
Talk about how big scary words and jargon don't matter. Bruteforceing your way through works. don't be afraid to throw away code. **Be** afraid to ask for help: with the right mindset, you can figure it out yourself (might not work for everyone ?).
9+
-->
10+
11+
After a long hiatus from writing on this blog, I'm back with a small update on what I've been working on lately (or rather slowly catchin op on the backlog of posts I wanted to write).
12+
13+
This summer, I finally finished writing my bachelor's thesis on the topic of WebAssembly and Edge Computing. More on that (probably) in a later post, but for now, I wanted to talk about another project I worked on earlier this year that inspired a lot of the work I did for my thesis: TinyWasm.
14+
15+
## <u>**TinyWasm**</u>
16+
17+
When writing my posts on [OS Development](https://blog.henrygressmann.de/series/rust-os/) last year, I got really interested in the topic of WebAssembly and wanted to try it out inside of the kernel. I was kind of got fed up with writing context switching and memory management code and WebAssembly it looked like an easy way to run existing code in the operating system.
18+
I had a look at the existing interpreters and compilers for WebAssembly, but they were all either too complex or had too many dependencies for my taste (I was going for embedded systems, so it had to be lightweight).
19+
20+
So, without only minimal prior experience with both WebAssembly and compilers/interpreters, I now had the topic for my capstone project: A tiny WebAssembly runtime. I've been pretty burned on a lot of (unneccessarily) complex projects in the past, so, to keep myself on track, I decided to set out some constraints at the start to actually finish it on time:
21+
22+
1. **No Platform-Specific Code**: My first goal was to remove all dependencies on platform-specific code, so everything could work in Rust's `no_std` environment. This also meant that I couldn't use many of the existing libraries for WebAssembly. Thankfully, a really good crate for parsing WebAssembly binaries already existed: [`wasmparser`](https://github.com/bytecodealliance/wasm-tools) (however with no `no_std` support at the time).
23+
24+
2. **Build the MVP**: Just focus on the initial version of WebAssembly, so no threads, no SIMD, no garbage collection, etc.
25+
26+
3. **Keep it simple**: I wanted the codebase to be as small and readable as possible to make it easier to integrate into other projects such as my OS. No premature optimization.
27+
28+
4. **No Unsafe Code**: This one came a bit later, but I decided to avoid unsafe Rust code entirely (maybe something for another post).
29+
30+
I started out by taking a simple "Hello World" WebAssembly program and tried to infer everything I needed from there. Surprisingly, this worked pretty well and in a super short amount of time. This gave me some slightly missplaced confidence that everything was going to be smooth sailing from here on out.
31+
32+
{{ figure(caption = "I couldn't find a good XKCD comic for this, so here's one on graphs instead.", position="center", src="./assets/image.png", invert=true, mixblend=true, link="https://www.xkcd.com/688/") }}
33+
34+
With this newly gained confidence, I scrapped the initial codebase and started from scratch. Starting with a simple public API, I did something very unlike me: TDD. Now, I'm sorry for subjecting you to this, but essentially following a long document that outlines everything about WebAssembly (the [specification](https://webassembly.github.io/spec/core/index.html)), you just have to write tests for everything. Thankfully, I didn't actually have to write any of these tests myself, as the reference interpreter conveniently already has thousands of them covering a lot of edge cases (that are also often not clear from the specification). Plumbing these tests into my own test suite was a bit of a pain, but in the end I had a sweet script that would run all of the relevant tests and give me a nice graph of how many tests I had passed (and some dopamine hits when the number went up).
35+
36+
{{ figuresvg(caption = "", position="center", src="content/2024/tinywasm/assets/progress-mvp.svg") }}
37+
38+
Now was about the time my newly found confidence started to decline.
39+
40+
Not to throw the blame on the specification, but it's hard to grasp as someone from the outside. A lot of abstraction, (probably?) needless complexity and leaving things up to the implementer. I spent about a week just looking at different interpreters and their APIs to get a better understanding of what I was supposed to do. Most of the time, I just ended up taking a couple of tests from one of the test suites and trying to get them to pass, which worked suprisingly well. Slowly but surely, the numbers went up and more and more tests passed.
41+
42+
Predictably, once I reached only about 80/2000+ tests left, I still had about 20% of my work and a couple of long nights ahead of me. But finally, once all tests passed, I just compiled the interpreter to WebAssembly and ran it using TinyWasm itself. It worked on the first try. I was completely confused, but I guess LLVM randomly did the right optimizations that made it work.
43+
44+
I was super happy with the results, and I'm still pushing the odd update here and there. As of now, it's at the point of supporting WebAssembly V2 (without SIMD and threads) and a couple of proposals. I also posted it on HN and Reddit, where I got some nice feedback and a couple of stars on GitHub (obviously the most important part).
45+
46+
{{ figure(caption = "Internet points are important.", position="center", src="./assets/hn.jpg", link="https://news.ycombinator.com/item?id=39627410") }}

content/2024/webassembly/index.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: The Future of WebAssembly
3+
date: 2024-10-06
4+
draft: true
5+
---

content/rust-os/1-hello-riscv/assets/elf.svg

+13-20
Loading

content/rust-os/1-hello-riscv/assets/rings.svg

+18-29
Loading

0 commit comments

Comments
 (0)