zknd

joined 10 months ago
[–] zknd@lemmy.world 1 points 21 hours ago

Thanks for the feedback!

[–] zknd@lemmy.world 1 points 21 hours ago

Thank you for the feedback.

 

Hello everyone,

I've just published the second post in my Linux Inside Out series.

In the first post we demystified the Linux kernel a bit: where it lives, how to boot it in a VM, and we even wrote a tiny init program.

In this second post we go one layer deeper and look at how programs actually talk to the kernel. We'll do a few small experiments to see:

  • how our init program (that we wrote in the first post) communicates with the kernel via system calls
  • how something like echo "hello" ends up printing text on your screen
  • how to trace system calls to understand what a program is doing

I’m mainly targeting developers and self-hosters who use Linux daily and are curious about the internals of a Linux-based operating system.

This is part 2 of a longer series, going layer by layer through a Linux system while trying to keep things practical and approachable.

Link (part 2): https://serversfor.dev/linux-inside-out/system-calls-how-programs-talk-to-the-linux-kernel/

Link (part 1): https://serversfor.dev/linux-inside-out/the-linux-kernel-is-just-a-program/

As always, any feedback is appreciated.

 

Hello everyone,

I've just published the second post in my Linux Inside Out series.

In the first post we demystified the Linux kernel a bit: where it lives, how to boot it in a VM, and we even wrote a tiny init program.

In this second post we go one layer deeper and look at how programs actually talk to the kernel. We'll do a few small experiments to see:

  • how our init program (that we wrote in the first post) communicates with the kernel via system calls
  • how something like echo "hello" ends up printing text on your screen
  • how to trace system calls to understand what a program is doing

I’m mainly targeting developers and self-hosters who use Linux daily and are curious about the internals of a Linux-based operating system.

This is part 2 of a longer series, going layer by layer through a Linux system while trying to keep things practical and approachable.

Link (part 2): https://serversfor.dev/linux-inside-out/system-calls-how-programs-talk-to-the-linux-kernel/

Link (part 1): https://serversfor.dev/linux-inside-out/the-linux-kernel-is-just-a-program/

As always, any feedback is appreciated.

[–] zknd@lemmy.world 3 points 1 week ago

That is a fair point, thank you!

I am fixing it.

[–] zknd@lemmy.world 2 points 1 week ago (1 children)

Turned out it is not so simple to add the full content of the post to the RSS feed with Astro's RSS plugin, but trying to find some workaround.

[–] zknd@lemmy.world 2 points 1 week ago

Dark mode added.

[–] zknd@lemmy.world 1 points 1 week ago* (last edited 1 week ago)

Thank you for the feedback!

My goal with this series is to make Linux internals more approachable, so I’m intentionally keeping each post narrow and avoiding details that would overwhelm readers at this stage.

The primary target audience of these blog posts are developers, and I have a progression plan in mind how to build up layer by layer the necessary knowledge they need to know to understand how they program work/interact with the other parts of the OS. The boot process or the exact composition of the kernel image is irrelevant here in my opinion, they wont need to touch them on a VPS for example or on their dev machine.

Regarding the kernel space/user space I did not write that the kernel space stopped, I will come back to it in the next post that will be about system calls, we will discuss there that when our programs interact with the kernel we are switching between user and kernel mode back and forth, with the syscall instruction (on x86-64 systems).

Anyway, I really appreciate your feedback and that you put effort into it, and thank you for reading the post! :)

[–] zknd@lemmy.world 3 points 1 week ago (2 children)

I am writing a blog post series to make this topic more approachable for others.

[–] zknd@lemmy.world 3 points 1 week ago (1 children)

Thank you! :) Sure, working on it. :)

[–] zknd@lemmy.world 1 points 1 week ago* (last edited 1 week ago)

Thank you for the feedback. There is a post planned about the boot process that will include initramfs more thoroughly, but first I would like to build up the concepts from the kernel through the system calls, files/devices, to processes (so we can talk about that the programs you write interact with the hardware through syscalls, files/devices, etc). The primary targeted audience are developers, so they can better understand how their program works when it is deployed to a server (or on their dev machine).

 

I’ve been working on a "Linux Inside Out" series and wrote a post that might interest folks here who like low(ish)-level / OS internals.

The idea is to dissect the components of a Linux OS, layer by layer, and build a mental model of how everything fits together through experiments.

The first part is about the kernel, in the post I:

  • take the same kernel image my distro boots from /boot
  • boot it directly with QEMU (no distro, no init system)
  • watch it panic
  • write a tiny Go program and use it as PID 1
  • build a minimal initramfs around it so the kernel can actually start our process

The goal isn’t to build a real distro, just to give a concrete mental model of:

  • that the Linux kernel is just a compressed file, you can boot it
  • without anything else
  • what the kernel actually does at boot
  • how it hands control to userspace
  • what PID 1 / init is in practice
  • what is kernel space vs user space

Link: https://serversfor.dev/linux-inside-out/the-linux-kernel-is-just-a-program/

I’m the author, would be happy to hear from other devs whether this way of explaining things makes sense, and what you’d add or change for future posts in the series.

Hope you find it useful.

 

I’ve been working on a "Linux Inside Out" series and wrote a post that might interest folks here who like low(ish)-level / OS internals.

The idea is to dissect the components of a Linux OS, layer by layer, and build a mental model of how everything fits together through experiments.

The first part is about the kernel, in the post I:

  • take the same kernel image my distro boots from /boot
  • boot it directly with QEMU (no distro, no init system)
  • watch it panic
  • write a tiny Go program and use it as PID 1
  • build a minimal initramfs around it so the kernel can actually start our process

The goal isn’t to build a real distro, just to give a concrete mental model of:

  • that the Linux kernel is just a compressed file, you can boot it
  • without anything else
  • what the kernel actually does at boot
  • how it hands control to userspace
  • what PID 1 / init is in practice
  • what is kernel space vs user space

Link: https://serversfor.dev/linux-inside-out/the-linux-kernel-is-just-a-program/

I’m the author, would be happy to hear from other devs whether this way of explaining things makes sense, and what you’d add or change for future posts in the series.

Hope you find it useful.

[–] zknd@lemmy.world 3 points 1 week ago

Thank you for the feedback.

Sure, I will look into the RSS plugin config. :)

[–] zknd@lemmy.world 12 points 1 week ago

Thank you for the feedback.

 

I’ve been working on a "Linux Inside Out" series and wrote a post that might interest folks here who like low(ish)-level / OS internals.

The idea is to dissect the components of a Linux OS, layer by layer, and build a mental model of how everything fits together through experiments.

The first part is about the kernel, in the post I:

  • take the same kernel image my distro boots from /boot
  • boot it directly with QEMU (no distro, no init system)
  • watch it panic
  • write a tiny Go program and use it as PID 1
  • build a minimal initramfs around it so the kernel can actually start our process

The goal isn’t to build a real distro, just to give a concrete mental model of:

  • that the Linux kernel is just a compressed file, you can boot it
  • without anything else
  • what the kernel actually does at boot
  • how it hands control to userspace
  • what PID 1 / init is in practice
  • what is kernel space vs user space

Link: https://serversfor.dev/linux-inside-out/the-linux-kernel-is-just-a-program/

I’m the author, would be happy to hear from other devs whether this way of explaining things makes sense, and what you’d add or change for future posts in the series.

Hope you find it useful.

view more: next ›