[Monthly Update] February 2025

Tawaliou ALAOTawaliou ALAO
3 min read

Sys Prog, Coding Challenges, Go, Container, Linux Internal,

February 2025, I built a Linux utility in Go, learnt about how container are built (in Linux environment) and planning to learn about Linux Driver (Kernel Module). Here are some details.

Sys Prog, Coding Challenges, Go

I try Build your Own wc tool by The Coding challenges in Go. The challenge is to rewrite in the langage of your choice from scratch the word counter utility found in Linux environment. And you have the freedom to expand the features. wc prints the number of lines, words, characters, bytes of file(s). You can read more details in the links I paste above.

In my case, I built it, and add some sugar features:

  • handle multiple files: I use goroutines so the process of multiple files with the same size will took approximatively the amount of time of on file of the same size (good !)

  • nice output: in my case the output is like

 l: 111, w:100, m: 200, c: 200 text.txt
  • I’ll add(I forget this feature) to get argument from standard input and not only from files.

While doing this project, I learnt more about

Container: under the hood

I try to understand how containers like Docker are made and try to build a container from scratch. And even if I didn’t go to too far, I have learnt many things. And Yes: Linux is awesome, incredible as OS.

A container in Linux env, is based on: namespaces and cgroups. Namespaces help to have process in isolation and cgroups to put limit on ressources (memory, cpu, storage...) used by process

Here are the namespaces under linux:

  • Mount (mnt): for mount points and provide a complete filesystems to the process which is now different of the host filesystems. That’s why you’ve a complete filesystems (root, dev, home with access) when you’re inside a container.

  • Process ID (pid): a parent process with an ID can see other process but its children only see process from the same parent. That’s why when you’re inside a container you don’t get PID from applications/process outside the container.

  • Network (net): this namespace virtualize the network stack. You remember Docker Network ? Yeah this is the namespace that provide this capabilities: having your own network isolation inside on the host

  • User ID (user): This namespace provide you everything related to user and their management: access/privilege, groups. You remember when creating a Docker image you can specify the user with USER command and create group ?

  • Inter-process Communication (System V IPC)

  • UTS (Unix Time-Sharing, hostname): with this you have can hostname, DNS for specific process

Here are some details about Linux Namespaces and Linux cgroups.

Liz Rice give many talks on how to build a simple and lightweight container system from scratch in Go

I don’t know but, I think it’s the main reason why Docker is not avalable on Windows without WSL.

Right, hope you learn something from this articles, I’ll be back for sure.

0
Subscribe to my newsletter

Read articles from Tawaliou ALAO directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Tawaliou ALAO
Tawaliou ALAO

Software Developer | Love Low Level Eng. | Python, Javascript, C, Linux I'm learning backend development and system programming.