September 3, 2021

I just finished a four-month co-op term (internship) with the FreeBSD Foundation. For some background, I am a third-year student at the University of Waterloo in the computer science program. In terms of my involvement with the open source community, I hadn’t really done anything beyond submitting a few bug reports to various projects. Although I always wanted to be more involved, I was intimidated by all the projects I had seen; it seemed like all the contributors were people who “knew what they were doing” and I was someone who did not “know what I was doing”. Plus, outside of technical know-how, I had some other apprehensions: I was afraid that I wouldn’t grok the culture, that I would do or say something embarrassing, that my code would be laughed out of the room…

All that is to say I’ve become a lot more confident in participating in open source after this internship. My experience has been very positive. It turns out that solving problems for FreeBSD during this internship was no different than solving problems elsewhere. The FreeBSD Bugzilla has some bugs that even people who are completely new to FreeBSD, as I was, can attempt. One such problem that I looked at was profiling and optimizing the sort program, which you can actually read about in my blog post. Debugging the userland programs in FreeBSD is really no different from debugging any other!

Of course, as an intern, I benefited from receiving a lot of guidance from people in the Foundation who were much more experienced with FreeBSD and knew the system inside and out. However, everyone that I talked with outside of the Foundation was also very friendly, and were happy to help out and answer my questions.

I also worked in the FreeBSD kernel. I had little experience with kernel programming before this internship, other than an operating systems course I had taken. When I was first asked if I wanted to work on some components of the kernel, I thought the tasks would be daunting. In reality, the problems I worked on were easy to understand and approachable. I fixed quite a few bugs in racct, the FreeBSD resource accounting system. In particular, I made some aggregate resource counts, such as resource accounting for jails, more accurate. Programming and debugging kernel code was a little different (and I probably used more printfs than I should have), but not to the extent that I was expecting.

I also worked on bhyve, the hypervisor. Just like when I started working on racct, it sounded intimidating, but again the problems I worked on were actually very approachable. However, bhyve was different in that it’s used by many people (including me) every day, and actively developed. So, when it came to making changes and adding features, I had to have discussions with bhyve maintainers about the best path forward. So far, I’ve improved the behaviour of virtual machines in jails — so that VMs inside a jail are destroyed when that jail is destroyed, and jails can’t see VMs in other jails. These changes were pretty much uncontroversial.

I also added a new way of creating VMs which ties a VM’s lifetime to the lifetime of the process that created it, so when the process exits, all of the VMs it created are destroyed. This change was more radical and brought about a lot of discussion, and I’m still not sure if my exact patch will make it in or if someone will rewrite the work completely. However, my contribution was still valuable in that I was able to test out and experiment with the functionality of the proposed change, and in the resulting discussions about the ideal interface for VM creation.

Reflecting on the term as a whole, I really appreciated how there’s so many things to work on in FreeBSD. After all, it is an operating system comprising many parts that are completely different from one another, and I think it’s great how I was able to work with so many things, compared to previous co-op terms I’d had where I focused on one singular product. This can be a double-edged sword, however; it can be overwhelming at first to see so many interesting problems and not know where to start. The guidance I’d received during my internship helped a lot in figuring out what I wanted to do.

Overall, I had a great experience and it’s made me much more confident in my ability to participate in the open source community. I hope to make more contributions to various projects including FreeBSD in the near and far future.

— Contributed by Cyril Zhang