Field-programmable gate arrays
maddog's Doghouse
Take some advice from Linus Torvalds and learn how to program an FPGA.
I was at LinuxCon in Beijing, China, this year, and Linus Torvalds was being interviewed onstage. During the interview, Linus said that if he were starting over in FOSS today, he might not create a kernel but instead, learn how to program a field-programmable gate array (FPGA). I found this interesting.
What is an FPGA? Traditional central processing units (CPUs) and graphics processing units (GPUs) are made of fixed circuits designed by computer engineers that form an "instruction set." This instruction set tells the hardware to do certain things when an instruction (designated by a program) is executed. All of this is controlled by a clock that acts like a drum keeping a beat and makes sure that everything works in harmony.
However, another way of building a computational unit is to build specialized circuitry that always processes data in a particular way – like "hard coding" the circuitry. Once the circuitry is set, there is only one thing that circuitry can do. Because the circuitry does not necessarily have to follow a "drumbeat," it can often solve that particular problem 10, 20, or even 100 times faster than a traditional CPU or GPU.
Of course, most of us do not want to buy a computer for every single problem we want to solve, so the programmer is able to change the program on the FPGA to solve different problems. One moment, the FPGA might be compressing an image; the next moment it might be encrypting (or decrypting) a stream of data. If you combine one (or more) FPGAs in a system along with a CPU and GPU, the FPGAs can offload a lot of processing from the main processing units, allowing them to do more varied tasks while the FPGA does the computation it was programmed to do.
Programming an FPGA does not follow the same procedural logic that programming a CPU or GPU normally does. Special languages and tool chains are used to build the program, and it does take some study to learn how to use them. Also, in the past, FPGAs were very expensive (and large), so not too many people learned how to program them. Now they are inexpensive and getting more inexpensive by the day. Some companies are now building FPGA functionality into their Systems on a Chip (SoCs).
FPGAs are not just about speed of computation; they can be used to reduce the cost of energy, as well. If your main CPU has to run for a long time to solve a problem, it may use a lot of electrical power. But if the FPGA can do the calculation quickly, then the main CPU might be able to go into "standby" mode and use less electrical power.
The Mars Rover was designed a long time ago, and although it does have regular CPUs on board, they are relatively slow and consume a lot of power. On the other hand, the Rover has a significant number of FPGAs on board that do the "heavy lifting," which allows it to reduce its overall use of electricity by turning the FPGAs off when they are not in use.
People are often confused by the term "real time." To me real time means that the computation occurs as the data comes in. If you are not doing the data processing in real time, then the data has to stop or be buffered until the processing element can "catch up." In most data processing, this causes a backlog that may never be overcome. FPGAs can be used to keep this data flowing, so you never have to stop the data flow.
FPGAs can have another useful function, particularly in embedded systems. Many GPUs have proprietary, binary-only firmware that can prevent new versions of the kernel from working unless the firmware is updated. I call these "binary blobs." I was lamenting to Professor Marcelo Zuffo of the University of Sao Paulo that many 3D functions (particularly "simple" ones) could be done by an FPGA and therefore eliminate the need for proprietary GPU binary blobs. Three months later, two graduate students had programmed an FPGA to run all of the OpenGL test suites. By using an FPGA for simple 3D and 2D graphics processing, embedded systems do not suffer when companies drop support for their GPUs (or the operating system that is using the GPUs).
One last idea on GPUs is using them for crypto-currency mining. While your main CPU is running the system, your FPGA can be taking care of the mining process.
Therefore, I recommend finding an inexpensive FPGA and learning to program it. Don't let Linus have all the fun!
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Thousands of Linux Servers Infected with Stealth Malware Since 2021
Perfctl is capable of remaining undetected, which makes it dangerous and hard to mitigate.
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.
-
OSI and LPI Form Strategic Alliance
With a goal of strengthening Linux and open source communities, this new alliance aims to nurture the growth of more highly skilled professionals.
-
Fedora 41 Beta Available with Some Interesting Additions
If you're a Fedora fan, you'll be excited to hear the beta version of the latest release is now available for testing and includes plenty of updates.
-
AlmaLinux Unveils New Hardware Certification Process
The AlmaLinux Hardware Certification Program run by the Certification Special Interest Group (SIG) aims to ensure seamless compatibility between AlmaLinux and a wide range of hardware configurations.
-
Wind River Introduces eLxr Pro Linux Solution
eLxr Pro offers an end-to-end Linux solution backed by expert commercial support.
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.
-
New KDE Slimbook Plasma Available for Preorder
Powered by an AMD Ryzen CPU, the latest KDE Slimbook laptop is powerful enough for local AI tasks.