RSSAmplifier

Blog

andrestc.com

Recent content on andrestc.com

andrestc.comRSS feed ↗14 posts

Latest posts

Netconsole target recovery: my first non-trivial kernel patch

Earlier this year I got my first non-trivial kernel patch merged. It was a series of 7 commits and all in all it took over 4 months and 11 revisions to get it into good shape to be merged. This wasn’t my first kernel contribution: I had previously landed a small patch introducing new tests, and written about the kernel development workflow . 
 Before talking a bit about the details of…

Linux Kernel Development Workflow (for n00bs)

For a long time I’ve had this goal of getting into Linux Kernel development. After a lot of trial and error, and with the help of a friend of mine who agreed to mentor me in the process, I finally did it. 
 The change itself is not that interesting, you usually don’t want your first attempt at this to be something too complicated. There is enough to learn in terms of the…

Developing with Nix

I’ve recently started running Linux on my local machine and decided to play around with Nix in order to avoid having to install a bunch of dependencies globally on the system. I came across https://github.com/the-nix-way/dev-templates which has templates for various languages and toolchains and I’m quite happy with it so far. 
 To adopt it in one of my projects (…

Understanding Pressure Stall Information in Linux

System administrators often use load averages to quickly assess whether a server is overloaded. These values are easily accessible in tools like uptime and top. However, load averages alone do not provide enough detail about which resource—CPU or I/O—may be causing the bottleneck, and they lack granularity in time and cgroup-specific data. 
 According to man uptime : 
 
 System load…

My 2018 in review

As 2018 is coming to and end, I have decided to review my year. 
 Talks 
 One of my major goals for 2018 was to focus and improve my public speaking skills. Specifically, I wanted to do my first talk at an international conference. 
 I created a spreadsheet with a bunch of events that were interesting to me, such as Gophercon US, Gophercon UK, KubeCons and so on. I organized them by…

Go's Memory Allocator - Overview

I’ve decided to learn how the Go runtime allocates memory and this is the first in a series of posts that are going to cover what I learned (and also the process itself: how I learned). These posts are based of my notes for the talk I gave at Gophercon UK in 2018: 
 
 Slides are available here . 
 In this first post we are going to cover: 
 
 Memory allocation 101 
…

Using cgroups to limit I/O

Developers running their apps on tsuru can choose plans based on memory and cpu usage. We were looking at adding I/O usage as one of the plan’s features, so one could choose how many I/O operations per second or bytes per second a container may be able to read/write. 
 Being able to limit I/O is particulary important when running a diverse cloud, where applications with different…

Linux Delay Accounting

Ever wondered how long is your program spending while waiting for I/O to finish? Or if it is spending lots
of time while waiting for a turn to run on one of the cpus? Linux provides delay accounting information that may help answering these and other questions. Delay information is available for many types of resources: 
 
 waiting for a CPU (while being runnable) 
 completion of…

Implementing a simple sudo

One of the exercises of &ldquo;The Linux Programming Interface&rdquo; chapter 38 is about implementing program,&#xA;called douser , that should have the same functionality as the sudo progam. This means that if you run&#xA; $ douser whoami , this should asks for the root user password and, if the password matches, should run&#xA;the command whoami , which would print root . If the -u <user> flag…

Talks

This list contains some of the major conference talks that I did in the past years. &#xA; 2018 &#xA; &#xA; &#xA; Linux Delay Accounting at Gophercon (Lightning Talk) [Slides] [Video] &#xA; &#xA; &#xA; Understanding Go Memory Allocation at Gophercon UK [Slides] [Video] &#xA; &#xA; &#xA; Entendendo Alocação de memória no Go at The Developers Conferece SP (PT-BR) [Slides] &#xA; &#xA; The Developers…

Killing a container from the inside

This past week a tsuru user was having a problem in one of his apps. Some units of his app would simply get stuck, timing out every request and apparently doing nothing. As a workaround he wanted to kill the problematic unit and force it to restart. On tsuru you are able to restart all units of an app but may not choose a particular unit to restart. &#xA; We then “sshed” into the problematic…

Implementing malloc and free

&#xA; Chapter 7 of “The Linux Programming Interface” is about memory allocation. One of the exercises, marked as advanced, asks the reader to implement malloc . I’ve decided to give it a shot. My full implementation is available on Github . I will try to break down some of my reasoning on the next sections and include some snippets from the code. &#xA; Memory layout of a Process &#xA; The memory…

Sparse files

Following my read of “The Linux Programming Interface”, I came across the concept of “file with holes” or “sparse files”. Those are files that try to use the file system more effectively by preventing it from using disk space when sections of the file are empty. The disk storage is only actually used when needed. Sparse files are really useful for backup utilities, disk images, database snapshots…

reboot(2) syscall and agic numbers

I’m currently reading “The Linux Programming Interface” and I intend to use this blog as a way to share what i’m learning (to make sure I’m actually learning). &#xA; In one of the first chapters there is an exercise about the reboot(2) syscall and some magic numbers that are used as parameters. &#xA; The reboot(2) syscall has the following signature: &#xA; int reboot ( int magic, int magic2, int…