Over the next decade, automation and artificial intelligence could throw 54 million Americans out of work. Here's everything you need to know:

Why is automation a threat?
Rapid technological advances are enabling machines to perform a growing number of tasks traditionally done by humans. Law firms now use artificial intelligence (AI) — ­sophisticated computer programs that can learn from ­experience — to conduct contract analysis, hunt for client conflicts, and even craft litigation strategy. McDon­ald's is replacing drive-thru workers with order-taking AI, and cashiers with self-checkout kiosks. Walmart is automating truck unloading, while Cal­i­for­nia farms are employing robots to harvest lettuce. From 1990 to 2007, robots replaced about 670,000 U.S. jobs, mostly in manufacturing; every robot introduced into a local economy claimed 6.2 jobs. That trend will accelerate over the next decade, as advances in mobile technology, AI, data transfer, and computing speeds allow robots to act with greater independence. Oxford Uni­ver­sity researchers concluded in a major 2013 study that 47 percent of Amer­i­can jobs are at "high risk" of automation within two decades. McKin­sey Global In­sti­tute came to a similar conclusion in 2017, warning that by 2030 robots will have forced 16 million to 54 million ­Americans — as many as a third of U.S. ­workers — to retrain for a new job.

What jobs are most at risk?
Generally speaking, those involving repetitive physical tasks in predictable environments. For instance, some restaurants in China have already begun replacing servers with robots. The Palm Beach County Court recently began using four robots — Wally Bishop, Rosie Tobor, Kitt Robbie, and Speedy — to read court filings, fill out docket sheets, and input data into its case management system. In theory, at least 91 percent of a short-order cook's tasks can be automated using existing technology. It's 100 percent for a dredge operator, plasterer, stucco mason, motion picture projectionist, and logging equipment operator. Conversely, jobs that involve managing people, creative thinking, and social interaction will see less automation. But even the jobs you'd think are safe aren't. The Guardian Australia newspaper published its first article this year written entirely by a computer. The Indian e-­commerce site Myntra recently created one of its best-selling T-shirts by delegating the design to two algorithms that analyzed previous designs and invented new ones. Sales of AI-designed shirts are "growing at 100 percent," said Ananth Narayanan, Myntra's CEO. "It's working."

How will this affect the workforce?
History has shown that previous apocalyptic warnings about technology wiping out the need for human labor have proved untrue — although there is often a difficult transition period to new jobs requiring new skills. In the 19th century, farmers rendered obsolete by mechanized agriculture found their way to new, better-paying jobs in factories. When industrial automation in the 20th century threatened factory workers, many of the displaced transitioned to service work (often with lower salaries, however). "If history is any guide," McKinsey said in its study, "we could also expect that 8 to 9 percent of 2030 labor demand will be in new types of occupations that have not existed before."

So will the impact be modest?
Not necessarily. The futurist Martin Ford acknowledges the "long record of false alarms," but argues that this time is different. The pace of automation, he says, is no longer linear, but exponential, like the growth in computing capacity predicted by Moore's Law. The economy, Ford says, will not have time to create new professions to absorb the tens of millions of workers displaced by automation. By some estimates, Amer­i­ca is less than a decade away from autonomous ­vehicles — and yet 3.5 million Amer­i­cans still work as truck drivers. White-collar jobs are also at risk for the first time, Ford says. On Wall Street, the number of financial workers has already plunged by 50,000 since 2000, as computers can process 100,000 transactions in a tenth of a second. Radiologists may lose their job analyzing medical images. Displaced workers might find new jobs, but at much lower salaries.

How will this affect society?
Predictions vary, but there is a lot of grim prognostication about a "robot apocalypse." The Demo­cratic presidential candidate Andrew Yang warns of an automation "buzz saw" that will eliminate millions of jobs and lead to political polarization, "suicides, drug overdoses, anxiety, depression," as well as "derelict buildings," "jobless zones," and "a hyper­strat­i­fied society like something out of The Hunger Games." He, like tech titans Elon Musk and Mark Zuck­er­berg, believes it will be necessary for government to provide a universal basic income to each citizen. Meanwhile, there is some comfort to be had in the claim made late last year by a Forrester Research team that while 10 percent of American workers would lose their jobs to automation in 2019, artificial intelligence was "still at least 100 years away from sending all of humanity on a permanent vacation."

The last 'robot apocalypse'
Fear that automation would replace human workers has come in several waves in U.S. history. The most recent came during the 1950s, when World War II technologies were integrated into private industry and the computer chip was invented. Gen­eral Elec­tric ran an ad reminding people that robots replace ­"drudgery — not people," while IBM found office managers often too frightened to buy its computers out of fear the clever machines would eventually replace them too. "Computers," IBM assured them, "can only do what they are programmed to do." The Nation called automation "a ghost which frightens every worker in every plant," and the nonprofit Science Ser­vice complained, "With the advent of the thinking machine, people are beginning to understand how horses felt when Ford invented the Model T." In the end, Uni­ver­sity of Chi­ca­go economist Yale Brozen found that technology destroyed some 13 million jobs during the 1950s, but also created more than 20 million, as vast productivity growth led to the demand for more workers in aggregate — office personnel, engineers, maintenance staff — to keep pace with rising demand. "The catastrophe that doom criers constantly threaten us with," Brozen wrote, "has retreated into such a dim future that we simply cannot take their pronouncements seriously."