Philosophers

A code project in which I learned how it feels to deal with threads in programming.

Philosophers
Photo by Julian Wallner / Unsplash

I'm terrible at multitasking. That's because when doing two things at the same time, that's two times more things about everything that can change. What made me feel a little bit better though, is that it apparently isn't any different for computers.

This has to do with the fact that every action of what a computer can do are always made up of tiny steps. These steps should always happen in the right order without interruption. And if there were to say two actions that a computer should do at the same time, then the steps for those two actions are mixed up with each other, unless you prevent that from happening. Traditionally, this is the programmer's job.

The 42 project Philosophers introduces you to this concept. You learn what 'threads' are and how you can prevent them from getting knotted together and messing up your computer, by using so-called 'mutexes' that help you do all the steps in the right order.

What I learned

This project gave a better Fingerspitzengefühl for how the quality of the machine and the quality of the code influence the running speed. Working with so many threads really gets very different performance on different machines and with or without optimizations. Comparable how push_swap made me realize how quick a computer can execute tasks and make calculations after each other, this project gave me a greater understanding of how many threads computers can run alongside each other and what possibilities that gives.

Curious? Have a look yourself at the code!

Yannick / Philosophers · GitLab
GitLab.com

To understand what the project is about, read the subject: