# Volunteering at AddisCoder!

This past summer I spent a month in Ethiopia in the capital Addis Ababa volunteering to teach coding to high school students from all over Ethiopia 🇪🇹.

This past summer I spent a month in Ethiopia in the capital Addis Ababa volunteering to teach coding to high school students from all over Ethiopia 🇪🇹.

A small cheat sheet for figuring out Open Source Licenses!

Things used to work, now they don’t anymore. Somebody pushed a rogue commit, and you want to find the culprit. The solution to this problem is easier than you’d imagine.

# | filename | text | data | bss | dec | hex |
---|---|---|---|---|---|---|

BEFORE | kernel/pid.o | 8447 | 3894 | 64 | 12405 | 3075 |

AFTER | 3397 | 304 | 0 | 3701 | e75 | |

BEFORE | kernel/pid_namespace.o | 5692 | 1842 | 192 | 7726 | 1e2e |

AFTER | 2854 | 216 | 16 | 3086 | c0e |

My project involves replacing bitmap implementation of PID allocation with IDR implementation. In an effort to do this, I made an exhaustive list of all the functions inside pid.c which will need replacement/deletion because they use bitmap (or are no longer needed). While this is not an ideal way to go about this problem, it helps me isolate what needs to be changed. In a while I will also have to figure out how to break my patches logically so that every patch in the series ensures that the kernel will not break. For now, here is the list:

In this post, I’ll be explaining the functions used for PID lookup in the Linux kernel. The first function is next_pidmap(), which finds the first set bit in the current pidmap or the successor pidmaps corresponding to a namespace ns. Initially, there is a sanity check on the range to see if we have not exceeded the PID_MAX_LIMIT. Inside the for loop, we traverse from the current pidmap till the end of the pidmaps.

The IDR API is charged with the allocation of integer ID numbers used with device names, POSIX timers, and more.

Allocating a free PID is essentially looking for the first bit in the bitmap whose value is 0; this bit is then set to 1. Conversely, freeing a PID can be implemented by ‘toggling’ the corresponding bit from 1 to 0.