Optimizing Linux Pipes

In CPU design, there is Ahmdal’s law. Simply put, it means that if some process is contributing to 10% of your execution, optimizing it can’t improve things by more than 10%. Common sense, really, but it illustrates the importance of knowing how fast or slow various parts of your system are. So how fast are Linux pipes? That’s a good question and one that [Mazzo] sets out to answer.

The inspiration was a highly-optimized fizzbuzz program that clocked in at over 36GB/s on his laptop. Is that a common speed? Nope. A simple program using pipes on the same machine turned in not quite 4 GB/s. What accounts for the difference?

Continue reading “Optimizing Linux Pipes”

Practical Transistors: JFETs

Transistors come in different flavors. Tubes used an electric field to regulate current flow, and researchers wanted to find something that worked the same way without the drawbacks like vacuum and filament voltages. However, what they first found — the bipolar transistor — doesn’t work the same way. It uses a small current to modulate a larger current, acting as a switch. What they were looking for was actually the FET — the field effect transistor. These come in two flavors. One uses a gate separated from the channel by a thin layer of oxide (MOSFETs), and the other — a junction or JFET — uses the property of semiconductors to deplete or enhance carriers in the channel. [JohnAudioTech] takes a decidedly practical approach to JFETs in a recent video that you can watch below.

The idea for the FET is rather old, with patents appearing in 1925 and 1934, but there were no practical devices at either time. William Shockley tried and failed to make a working FET in 1947, the same year the first point-contact transistor appeared, which was invented while trying to create practical FETs. In 1948, the bipolar junction transistor hit the scene and changed everything. While there were a couple of working FETs created between 1945 and 1950, the first practical devices didn’t appear until 1953. They had problems, so interest waned in the technology while the industry focused on bipolar transistors. However, FETs eventually got better, boasting both very high input impedance and simplified biasing compared to bipolar technology.

Continue reading “Practical Transistors: JFETs”

3D Printing With Sound, Directly

Canadian researchers at Concordia University want to change how you do 3D printing. Instead of using light or thermal mechanisms, they propose using ultrasound-activated sonochemical reactions. Sounds wild? You can see a video about it below, or read the paper in Nature.

The idea is that sound causes bubbles of cavitation. This requires a focused ultrasonic beam which means you can actually print through items that are transparent to ultrasonic energy. Wherever the cavitation bubbles form, liquid polymer turns solid.

Continue reading “3D Printing With Sound, Directly”

Linux Fu: Easy Widgets

Here’s a scenario. You have a microcontroller that reads a number of items — temperatures, pressures, whatever — and you want to have a display for your Linux desktop that sits on the panel and shows you the status. If you click on it, you get expanded status and can even issue some commands. Most desktops support the notion of widgets, but developing them is a real pain, right? And even if you develop one for KDE, what about the people using Gnome?

Turns out there is an easy answer and it was apparently inspired by, of all things, a tool from the Mac world. That tool was called BitBar (now XBar). That program places a widget on your menu bar that can display anything you want. You can write any kind of program you like — shell script, C, whatever. The output printed from the program controls what appears on the widget using a simple markup-like language.

That’s fine for the Mac, but what about Linux? If you use Gnome, there is a very similar project called Argos. It is largely compatible with XBar, although there are a few things that it adds that are specific to it. If you use KDE (like I do) then you’ll want Kargos, which is more or less a port of Argos and adds a few things of its own.

Good News, Bad News

The good news is that, in theory, you could write a script that would run under all three systems. The bad news is that each has its own differences and quirks. Obviously, too, if you use a complied program that could pose a problem on the Mac unless you recompile.

Continue reading “Linux Fu: Easy Widgets”

Better Robots Through Gallium

In the movie Terminator 2, the T-1000 robot was made of some kind of liquid metal that could change shape among other interesting things. According to a chemical engineer at North Carolina State University, there may be something to the idea. [Michael Dickey] has been experimenting with gallium, a liquid metal, that scientists think may unlock a new generation of flexible devices.

The most common liquid metal is mercury, of course, and it has its uses. However, its toxicity has led to a reduction in its use. Gallium has low toxicity and also doesn’t easily evaporate. What can you do with it? Check out the video below to see a very simple demonstration of the liquid metal lifting a small — very small — weight with an electrical impulse.

Continue reading “Better Robots Through Gallium”

Linux And C In The Browser

There was a time when trying to learn to write low-level driver or kernel code was hard. You really needed two machines: one to work with, and one to screw up over and over again until you got it right. These days you can just spin up a virtual machine and roll it back every time you totally screw up. Much easier! We don’t think it is all that practical, but [nsommer] has an interesting post about loading up a C compiler and compiling Linux for a virtual machine. What’s different? Oh, the virtual machine is in your browser.

The v86 CPU emulator runs in the browser and looks like a Pentium III computer with the usual hardware. You might think it is slow and it certainly isn’t going to be fast as a rocket, but it does translate machine code into WebAssembly, so performance isn’t as bad as you might think.

The post goes into detail about how to build and create a simple machine web page that hosts v86. Once you cross-compile the kernel you can boot the machine up virtually. The other interesting part is the addition of tcc which is a pretty capable C compiler and much smaller and faster than the very traditional gcc.

The tcc build is tricky because the normal build process compiles the compiler and then uses the same compiler to build the default libraries. When cross-compiling, this doesn’t work well because the library you want for the host compile is different from the library you want to target for the second pass. You’ll see how to work around that in the post. The post continues to show how to do remote debugging and even gets QEMU into the mix. Debugging inside v86 doesn’t seem to work so far. There are more posts on this topic promised.

Honestly, this is one of those things like teaching a chicken to play checkers. It can be done, there’s little practical value, but it is still something to see. On the other hand, if you spend the weekend working through this, your next Linux porting project ought to seem easy by comparison.

Amazing what you can pull off with WebAssembly. If you need a quick introduction, check this one out from [Ben James].

Wireless Power: Here? Now?

Outside of very small applications, Nikola Tesla’s ideas about transmitting serious power without wires have not been very practical. Sure, we can draw microwatts from radio signals in the air, and if you’re willing to get your phone in just the right spot, you can charge it. But having power sent to your laptop anywhere in your home is still a pipe dream. Sending power from a generating station to a dozen homes without wire is even more fantastic. Or is it? [Paul Jaffe] of the Naval Research Laboratory thinks it isn’t fantastic at all and he explains why in a post on IEEE Spectrum.

Historically, there have been attempts to move lots of power around wirelessly. In 1975, researchers sent power across a lab using microwaves at 50% efficiency. They were actually making the case for beaming energy down from solar power satellites. According to [Jaffe], the secret is to go beyond even microwaves. A 2019 demonstration by the Navy conveyed 400 watts over 300 meters using a laser. Using a tightly confined beam on a single coherent wavelength allows for very efficient photovoltaic cells that can far outstrip the kind we are used to that accept a mix of solar lighting.

Wait. The Navy. High-powered laser beams. Uh oh, right? According to [Jaffe], it is all a factor of how dense the energy in the beam is, along with the actual wavelengths involved. The 400-watt beam, for example, was in a virtual enclosure that could sense any object approaching the main beam and cut power.

Keep in mind that 400 watts isn’t enough to power a hair dryer. Besides, point-to-point transmission with a laser is fine for sending power to a far-flung community but not great for keeping your laptop charged no matter where you leave it.

Still, this sounds like exciting work. While it might not be Tesla’s exact vision, laser transmission might be closer than it seemed just a few years ago. We’ve seen similar systems that employ safety sensors, but they are all relatively low-power. We still want to know what’s going on in Milford, Texas, though.