Misconceptions About Loops, Or: Static Code Analysis Is Hard

When thinking about loops in programming languages, they often get simplified down to a conditions section and a body, but this belies the dizzying complexity that emerges when considering loop edge cases within the context of static analysis. A paper titled Misconceptions about Loops in C by [Martin Brain] and colleagues as presented to SOAP 2024 conference goes through a whole list of false assumptions when it comes to loops, including for languages other than C. Perhaps most interesting is the conclusion that these ‘edge cases’ are in fact a lot more common than generally assumed, courtesy of how creative languages and their users can be when writing their code, with or without dragging in the meta-language of C’s preprocessor.

Assumptions like loop equivalence can fall apart when considering the CFG ( control flow graph) interpretation versus a parse tree one where the former may e.g. merge loops. There are also doozies like assuming that the loop body will always exist, that the first instruction(s) in a loop are always the entry point, and the horrors of estimating loop exits in the context of labels, inlined functions and more. Some languages have specific loop control flow features that differ from C (e.g. Python’s for/else and Ada’s loop), all of which affect a static analysis.

Ultimately, writing a good static analysis tool is hard, and there are plenty of cases where it’s likely to trip up and give an invalid result. A language which avoids ambiguity (e.g. Ada) helps immensely here, but for other languages it helps to write your code as straightforward as possible to give the static analysis tool a fighting chance, or just get really good at recognizing confused static analysis tool noises.

(Heading image: Control flow merges can create multiple loop entry
edges (Credit: Martin Brand, et al., SOAP 2024) )

Looking At Standard-Cell Design In The Pentium Processor

Die photo of the Intel Pentium processor with standard cells highlighted in red. The edges of the chip suffered some damage when I removed the metal layers. (Credit: Ken Shirriff)
Die photo of the Intel Pentium processor with standard cells highlighted in red. The edges of the chip suffered some damage when I removed the metal layers. (Credit: Ken Shirriff)

Whereas the CPUs and similar ASICs of the 1970s had their transistors laid out manually, with the move from LSI to VLSI, it became necessary to optimize the process of laying out the transistors and the metal interconnects between them. This resulted in the development of standard-cells: effectively batches of transistors with each a specific function that could be chained together. First simple and then more advanced auto-routing algorithms handled the placement and routing of these standard elements, leading to dies with easily recognizable structures under an optical microscope. Case in point an original (P54C) Intel Pentium, which [Ken Shirriff] took an in-depth look at.

Using a by now almost unimaginably large 600 nm process, the individual elements of these standard cells including their PMOS and NMOS components within the BiCMOS process can be readily identified and their structure reverse-engineered. What’s interesting about BiCMOS compared to CMOS is that the former allows for the use of bipolar junction transistors, which offer a range of speed, gain and output impedance advantages that are beneficial for some part of a CPU compared to CMOS. Over time BiCMOS’ advantages became less pronounced and was eventually abandoned.

All in all, this glimpse at the internals of a Pentium processor provides a fascinating snapshot of high-end Intel semiconductor prowess in the early 1990s.

(Top image: A D flip-flop in the Pentium. Credit: [Ken Shirriff] )

The Flash Memory Lifespan Question: Why QLC May Be NAND Flash’s Swan Song

The late 1990s saw the widespread introduction of solid-state storage based around NAND Flash. Ranging from memory cards for portable devices to storage for desktops and laptops, the data storage future was prophesied to rid us of the shackles of magnetic storage that had held us down until then. As solid-state drives (SSDs) took off in the consumer market, there were those who confidently knew that before long everyone would be using SSDs and hard-disk drives (HDDs) would be relegated to the dust bin of history as the price per gigabyte and general performance of SSDs would just be too competitive.

Fast-forward a number of years, and we are now in a timeline where people are modifying SSDs to have less storage space, just so that their performance and lifespan are less terrible. The reason for this is that by now NAND Flash has hit a number of limits that prevent it from further scaling density-wise, mostly in terms of its feature size. Workarounds include stacking more layers on top of each other (3D NAND) and increasing the number of voltage levels – and thus bits – within an individual cell. Although this has boosted the storage capacity, the transition from single-level cell (SLC) to multi-level (MLC) and today’s TLC and QLC NAND Flash have come at severe penalties, mostly in the form of limited write cycles and much reduced transfer speeds.

So how did we get here, and is there life beyond QLC NAND Flash?

Continue reading “The Flash Memory Lifespan Question: Why QLC May Be NAND Flash’s Swan Song”

PeLEDs: Using Perovskites To Create LEDs Which Also Sense Light

With both of the dominant display technologies today – LCD and OLED – being far from perfect, there is still plenty of room in the market for the Next Big Thing. One of the technologies being worked on is called PeLED, for Perovskite LED. As a semiconductor material, it can both be induced to emit photons as well as respond rather strongly to incoming photons. That is a trick that today’s displays haven’t managed without integrating additional sensors. This technology could be used to create e.g. touch screens without additional hardware, as recently demonstrated by [Chunxiong Bao] and colleagues at Linköping University in Sweden and Nanjing University in China.

Their paper in Nature Electronics describes the construction of photo-responsive metal halide perovskite pixels, covering the typical red (CsPbI3−xBrx), green (FAPbBr3), and blue (CsPbBr3−xClx) wavelengths. The article also describes the display’s photo-sensing ability to determine where a finger is placed on the display. In addition, it can work as an ambient light sensor, a scanner, and a solar cell to charge a capacitor. In related research by [Yun Gao] et al. in Nature Electronics, PeLEDs are demonstrated with 1 microsecond response time.

As usual with perovskites, their lack of stability remains their primary obstacle. In the article by [Chunxiong Bao] et al. the manufactured device with red pixels was reduced to 80% of initial brightness after 18.5 hours. While protecting the perovskites from oxygen, moisture, etc. helps, this inherent instability may prevent PeLEDs from ever becoming commercialized in display technology. Sounds like a great challenge for the next Hackaday Prize!

A Look Back At The USSR’s Mi-6 Helicopter Airliner

Most of us would equate commercial airline travel with fixed-wing aircraft, but civilian transport by helicopter, especially in large and sparsely populated regions, is common enough. It was once even big business in the Soviet Union, where the Aeroflot airline operated passenger helicopters in regular service for many decades. In the mid-1960s they even started work on converting the Mil Mi-6 — the USSR’s largest and fastest helicopter — to carry paying passengers. Unfortunately this never got past a single prototype, with the circumstances described by [Oliver Parken] in a recent article.

This passenger version of the Mi-6 got the designation Mi-6P (for passazhirskyi, meaning passenger) and would have seated up to 80 (3 + 2 row configuration), compared to the Mi-8 passenger variant that carried 28 – 31 passengers. Why exactly the Mi-6P never got past the prototype stage is unknown, but its successor in the form of the Mi-26P has a listed passenger variant and features. Both have a cruising speed of around 250 km/h, with a top of 300 km/h. The auxiliary winglets of the Mi-6 provided additional lift during flight, and the weight lifting record set by the Mi-6 was only broken by the Mi-26 in 1982.

An obvious disadvantage of passenger helicopters is that they are more complicated to operate and maintain, while small fixed wing airliners like the ATR 72 (introduced in 1988) can carry about as many passengers, requires just a strip of tarmac to land and take off from, travel about twice as fast as an Mi-6P would, and do not require two helicopter pilots to fly them. Unless the ability to hover and land or take-off vertically are required, this pretty much explains why passenger helicopters are such a niche application. Not that the Mi-6P doesn’t have that certain je ne sais quoi to it, mind.

Cloudflare Adds Block For AI Scrapers And Similar Bots

It’s no big secret that a lot of the internet traffic today consists out of automated requests, ranging from innocent bots like search engine indexers to data scraping bots for LLM and similar generative AI companies. With enough customers who are less than amused by this boost in useless traffic, Cloudflare has announced that it’s expanding its blocking feature for the latter category of scrapers. Initially this block was only for ‘poorly behaving’ scrapers, but now it apparently targets all of such bots.

The block seems to be based around a range of characteristics, including the user agent string. According to Cloudflare’s data on its network, over 40% of identified AI bots came from ByteDance (Bytespider), followed by GPTBot at over 35% and ClaudeBot with 11% and a whole gaggle of smaller bots. Assuming that Imperva’s claims of bots taking up over half of today’s internet traffic are somewhat correct, that means that even if these bots follow robots.txt, that is still a lot of bandwidth being drained and the website owner effectively subsidizing the training of some company’s models. Unsurprisingly, Cloudflare notes that many website owners have already taken measures to block these bots in some fashion.

Naturally, not all of these scraper bots are well-behaved. Spoofing the user agent is an obvious way to dodge blocks, but scraper bot activity has many tell-tale signs which Cloudflare uses, as well as statistical data across its global network to compute a ‘bot score‘ for any requests. Although it remains to be seen whether false positives become an issue with Cloudflare’s approach, it’s definitely a sign of the times that more and more website owners are choosing to choke off unwanted, AI-related traffic.

Access To Fresh And Potable Water: An Ancient And Very Current Challenge

Throughout history, clean and potable water has been one of the most prized possessions, without which no human civilization could have ever sustained itself. Not only is water crucial for drinking and food preparation, but also for agriculture, cleaning and the production of countless materials, chemicals and much more. And this isn’t a modern problem: good water supplies and the most successful ancient cultures go hand in hand.

For instance, the retention and management of fresh water in reservoirs played a major role in the Khmer Empire, with many of its reservoirs (baray) surviving to today. Similarly, the Anuradhapure Kingdom in Ceylon (now Sri Lanka) featured massive reservoirs like Kala Wewa that was constructed in 460 CE with a capacity of 123 million m3. In the New World, the Maya civilization similarly created reservoirs with intricate canals to capture rainwater before the dry season started, as due to the karst landscape wells were not possible.

Keeping this water fresh and free from contaminants and pollution was a major problem for especially the Maya, with a recent perspective by Lisa J. Lucera in PNAS Anthropology suggesting that they used an approach similar to modern day constructed wetlands to keep disease and illness at bay, while earlier discoveries also suggest the use of filtration including the use of zeolite.

Continue reading “Access To Fresh And Potable Water: An Ancient And Very Current Challenge”