In Real Time
Some things in the real world can't wait for a computer to make up its mind.
2020-12-20 Previous Home Next

Self-driving cars, just like any other robots that sense and act, will have to make decisions promptly. Computer programs designed to produce results within tight deadlines are called "real-time" programs.

When discussing self-driving cars, people sometimes get passionate and bring up the "Trolley Problem."

Green line

The Trolley Problem is an ethical dilemma you might be familiar with from the TV show The Good Place: A runaway tram is hurtling down the track toward a group of five people. A switch operator could divert it onto a different track and save them. But! A child is running across the second track and would be killed.

What should the switch operator do: save the five people, or spare the child?

Philosophers love to analyze the Trolley Problem in its many variations to explore ethical issues, which get hairier when a computer is the one making the decision.

Leaving aside ethical issues for a moment, another question bears asking: How much time does the operator have? Any criteria the operator uses will become irrelevant if the computation takes too long.

Real-time computing

In real-world decision making, results must not only be correct, but also timely. A web search must produce results in under a second, or the user might leave. Tomorrow's weather forecast must not take all day to compute, or it would become useless. For a robot, a quick, good-enough decision is better than a perfect decision that comes too late.

When deadlines are so tight that computers struggle to meet them, designers employ special techniques to design and test programs. They modify commonly-used algorithms so that they produce some results within the allotted time.

Computers embedded inside consumer and industrial devices often need to produce results within a fraction of a second and are traditionally programmed with these techniques.

In the 1980s, video games used to look simple and blocky, because that's all their computers could manage within one-thirtieth of a second, the refresh period of standard American broadcast television. But today with better computers and high-resolution color monitors, players expect a photo-realistic view of each blade of grass in a meadow or every puddle in an urban street.

Generating these high-information graphics requires a lot of computation. So video games have to squeeze a lot of processing into even tinier fractions of a second. To play these newer interactive games, gaming PCs need computing hardware specially designed for generating images quickly.

For playing the game on an ordinary PC, the game software will often provide settings to fit the computation to the computer. On a PC without the special hardware, the game can sacrifice some picture quality but still remain responsive.

The same rules apply to self-driving cars that perceive their environment and take action. Engineers must make sure that decisions are taken within their deadline— even decisions heavy with ethical implications.