A Homemade Distributed Computing Project
One of the things that gets me really excited is making the world a better place. As an engineer, I’m often in the mindset of automating as much as possible. But can we automate making the world a better place?
It’s this question that led me into the wonderful world of distributed computing projects. SETI@home is perhaps the most well-known—a screensaver that uses your computer to process radio signals from space, crowdsourcing the search for extra-terrestrial intelligent life. Folding@home does the same for protein folding, a type of computational modeling used to research cures for diseases like Alzheimer’s. There are dozens of others.
I love these projects—the idea that ordinary people’s ordinary computers can work together as a powerful supercomputer for good is revolutionary. But they’re not perfect. They only work for causes that have computationally-intensive tasks (like protein folding), and many worthy organizations simply don’t need to do a lot of number crunching. These programs also often work your computer pretty hard (though this varies from project to project), which can drive up your electricity bill and shorten the lifetime of the hardware. And there’s usually a rather cumbersome installation and registration process—who wants to memorize another password just to do some good in the world?
And so I started a side-project to create my own. Compute for Humanity runs in the background on your computer and every few minutes performs a few seconds worth of cryptocurrency mining. The altcoins generated are exchanged for dollars and then donated to charities. (More details are on the website.) The project prioritizes the user experience above all else—it has an extremely low impact on your computer, and it’s so easy to install that even my 95-year-old grandma can do it (and indeed she did, bless her). And the nice thing about generating money (instead of, say, protein simulations) is that money can be directly donated to any good cause.
In building this, I got to try my hand at Swift, Apple’s much-hyped new programming language (I wouldn’t say I have a good sense of the language yet, but switching from my normal text-editor coding setup to a deeply-integrated IDE like Xcode is always a somewhat jaw-dropping experience). Because a core goal of my project is user experience and efficiency, I got to explore some of the cool energy-efficiency APIs OS X exposes, like:
- Thermal state change notifications: “The CPU’s getting warm so let’s pump the brakes a bit.”
- Timer tolerances: “Wait two seconds, but I don’t care if it’s exactly two seconds or just kind of close.”
- Quality of service indications: “Hey OS X, this process is a really slow background task. No rush—do it whenever you see fit!”
By giving OS X more control over how it schedules your tasks on the CPU and by responsibly adjusting to the temperature of the computer, these (and other) APIs let you dramatically improve the energy efficiency of your app. This means I can make sure the app won’t drive up users’ electricity bills, and besides, seeing the effects in the “Energy” tab in Activity Monitor is actually quite fun.
Take the app for a spin to see for yourself, and share your thoughts in the comments below and on Twitter. And if you’re interested in playing around with the code and helping to hyper-optimize for energy efficiency, become a contributor! (And if you’re the kind of person who thinks computers should be working for us and not the other way around, we’re hiring!)