This post details my adventures with the Linux virtual memory subsystem, and my discovery of a creative way to taunt the OOM (out of memory) killer by accumulating memory in the kernel, rather than in userspace.
Keep reading and you’ll learn:
- Internal details of the Linux kernel’s demand paging implementation
- How to exploit virtual memory to implement highly efficient sparse data structures
- What page tables are and how to calculate the memory overhead incurred by them
- A cute way to get killed by the OOM killer while appearing to consume very little memory (great for parties)
After failing three times, on my third try learning Chinese I actually became conversational. Here’s what I did, which is generally applicable to any language:
- I used Duolingo for 30 minutes every day for over a year.
- I went to Chinese language exchanges twice a month, for a year and a half.
- I used Hellotalk to find a great language partner to chat and do video calls with. I also used it to crowd source corrections for my bad Chinese.
That’s it! The key is consistent effort over a long time (2 years), mixing solo practice and real conversation.
(Originally appeared on my Indie Hackers blog)
Even though I’ve only achieved modest success as an indie hacker, I’ve learned many valuable skills that will make me more successful in other areas of my life, no matter how I proceed.
(Originally appeared on Indie Hackers)
Here’s a few of my insights from the past few months of personally finding mentorship and listening to hours and hours of the Indie Hackers podcast 🙂
Pretty recently I learned about
longjmp(). They’re a neat pair of libc functions which allow you to save your program’s current execution context and resume it at an arbitrary point in the future (with some caveats). If you’re wondering why this is particularly useful, to quote the manpage, one of their main use cases is “…for dealing with errors and interrupts encountered in a low-level subroutine of a program.” These functions can be used for more sophisticated error handling than simple error code return values.
I was curious how these functions worked, so I decided to take a look at musl libc’s implementation for x86. First, I’ll explain their interfaces and show an example usage program. Next, since this post isn’t aimed at the assembly wizard, I’ll cover some basics of x86 and Linux calling convention to provide some required background knowledge. Lastly, I’ll walk through the source, line by line.