WASHINGTON (AP) — They seem right out of a Hollywood fantasy, and they are: Cars that drive themselves have appeared in movies like "I, Robot" and the television show "Knight Rider."

Now, three years after Google invented one, automated cars could be on their way to a freeway near you. In the U.S., California and other states are rewriting the rules of the road to make way for driverless cars. Just one problem: What happens to the millions of people who make a living driving cars and trucks — jobs that always have seemed sheltered from the onslaught of technology?

"All those jobs are going to disappear in the next 25 years," predicts Moshe Vardi, a computer scientist at Rice University in Houston. "Driving by people will look quaint; it will look like a horse and buggy."

If automation can unseat bus drivers, urban deliverymen, long-haul truckers, even cabbies, is any job safe?

Vardi poses an equally scary question: "Are we prepared for an economy in which 50 percent of people aren't working?"

An Associated Press analysis of employment data from 20 countries found that millions of midskill, midpay jobs already have disappeared over the past five years, and they are the jobs that form the backbone of the middle class in developed countries.

That experience has left a growing number of technologists and economists wondering what lies ahead. Will middle-class jobs return when the global economy recovers, or are they lost forever because of the advance of technology? The answer may not be known for years, perhaps decades. Experts argue among themselves whether the job market will recover, muddle along or get much worse.

To understand their arguments, it helps to understand the past.

Every time a transformative invention took hold over the past two centuries — whether the steamboat in the 1820s or the locomotive in the 1850s or the telegraph or the telephone — businesses would disappear and workers would lose jobs. But new businesses would emerge that employed even more.

The combustion engine decimated makers of horse-drawn carriages, saddles, buggy whips and other occupations that depended on the horse trade. But it also resulted in huge auto plants that employed hundreds of thousands of workers, who were paid enough to help create a prosperous middle class.

"What has always been true is that technology has destroyed jobs but also always created jobs," says Nobel Prize-winning economist Joseph Stiglitz of Columbia University. "You know the old story we tell about (how) the car destroyed blacksmiths and created the auto industry."

The astounding capabilities of computer technology are forcing some mainstream economists to rethink the conventional wisdom about the economic benefits of technology, however. For the first time, we are seeing machines that can think — or something close to it.

In the early 1980s, at the beginning of the personal computer age, economists thought computers would do what machines had done for two centuries — eliminate jobs that required brawn, not brains. Low-level workers would be forced to seek training to qualify for jobs that required more skills. They'd become more productive and earn more money. The process would be the same as when mechanization replaced manual labor on the farm a century ago; workers moved to the city and got factory jobs that required higher skills but paid more.

But it hasn't quite worked out that way. It turns out that computers most easily target jobs that involve routines, whatever skill level they require. And the most vulnerable of these jobs, economists have found, tend to employ midskill workers, even those held by people with college degrees — the very jobs that support a middle-class, consumer economy.

So the rise of computer technology poses a threat that previous generations of machines didn't: The old machines replaced human brawn but created jobs that required human brains. The new machines threaten both.

"Technological change is more encompassing and moving faster and making it harder and harder to find things that people have a comparative advantage in" versus machines, says David Autor, an economist at the Massachusetts Institute of Technology who has studied the loss of midpay jobs to technology.

Here are the three scenarios that economists and technologists offer about jobs in the future:

—THE ECONOMY RETURNS TO HEALTH AFTER A WRENCHING TRANSITION

It has always happened before. Europe and the United States endured repeated economic and social upheaval during the 19th and early 20th centuries as their agricultural economies transformed into industrial ones. Columbia's Stiglitz argues that such pressures led to the collapse of the world economy in 1929 — the cataclysm we call the Great Depression.

The mechanization of farming caused agricultural production to soar worldwide in the 1920s — and prices to plunge. In the U.S., crop and livestock prices fell by 50 percent between 1929 and 1932. American farmers, who accounted for a fifth of the U.S. workforce, lost purchasing power and also struggled to pay their mortgages and other loans. As their debts went bad, banks began to collapse, squeezing credit and spreading panic. The economy went into free-fall.

Only World War II — and the massive rearmament program it required — restored the U.S. economy to full health. The experience was traumatizing. And today only 2 percent of Americans work on farms.

"Economies don't make these transitions well," Stiglitz says. People in the dying parts of the economy can't afford to invest in the education or retraining they need to find different work. "So you get workers trapped in the wrong sectors or unemployed," he says.

Peter Lindert, an economist at the University of California-Davis, says computers are more disruptive than earlier innovations because they are "general-purpose technologies" used by all kinds of companies. They upend many industries instead of just a few. The mechanized looms the Luddites hated in England in the early 1800s, for instance, rattled one industry. Information technology touches every business.

The changes are coming much faster this time, too. Lindert says that's showing up in the steep drop in prices for some products this time.

In the Industrial Revolution, "the price of textiles went down. But it was a small number compared to how the cost of information storage has gone down. It's a fraction of what it was in the 1970s," Lindert says. Now, computing power is doubling every 18 months to two years — and the price is plummeting.

But Lindert does not believe workers are doomed to unemployment. With the right skills and education, he says, they can learn to work with the machines and become productive enough to fend off the automation threat.

"There is a period of time that is extremely disruptive," says Thomas Schneider, CEO of the consultancy Restructuring Associates. "If you're 55 years old now and lose your job, the odds of you ever getting hired into what you were doing before is as close to zero as you can imagine. If you are a 12-year-old, you have a very bright future. It's just not doing what your father was doing or your mother was doing."

The rise of the iPhone, for instance, has put more than 290,000 people to work on related iPhone apps since 2007, according to Apple. That suggests that new technology continues to create new types of jobs that require higher skills and creativity.

"Over the long run, I have confidence we can do it," Stiglitz says. But, he warns, "I can see us being in this kind of doldrums for half a decade, for a decade, or for longer."

—THE ECONOMY CONTINUES TO PRODUCE JOBS, JUST NOT ENOUGH GOOD ONES

Some economists worry that the sluggish, lopsided labor market of the past five years is what we'll be stuck with in the future.

Smarter machines and niftier software will continue to replace more and more midpay jobs, making businesses more productive and swelling their profits.

The most highly skilled workers — those who can use machines to be more productive but can't be replaced by them — will continue to prosper. Many low-pay jobs are likely to remain sheltered from the technological offensive: Robots are too clumsy to tidy up hotel rooms or clear dirty dishes at busy restaurants.

"Computers can do calculus better than any human being," says Andrew McAfee, principal research scientist at MIT's Center for Digital Business. But "restaurant bus boy is a very safe job for a long time to come."

Under this scenario, technology could continue to push economic growth — but only a few would enjoy the benefits. More people would be competing for midpay jobs, so pay would shrivel. Many midskill workers would be left unemployed or shunted into low-skill, low-pay jobs. The income gap between the rich and ordinary citizens, already at record levels in many developed countries, would continue to widen.

Most economists say that unequal societies don't prosper; it takes a large and confident middle class to produce the consumer spending that drives healthy economic growth. "In the long run, you could actually see growth stopping," says economist Maarten Goos at Belgium's University of Leuven. "If everyone is employed in low-wage service jobs, then, that's it."

—TECHNOLOGY LEADS TO MASS UNEMPLOYMENT

In a speech last year, former U.S. Treasury Secretary Lawrence Summers declared that the biggest economic issue of the future would not be the federal debt or competition from China but "the dramatic transformations that technology is bringing about."

Summers imagined a machine called the "Doer" that could make anything or provide any service. Productivity would soar. Wonderful goods and services would emerge. Enormous wealth would go "to those who could design better Doers, to those who could think of better things for Doers to do." But everyone else would be worthless in the labor market.

Summers said the world is moving in that direction and has completed only 15 percent of the journey, but already we are "observing its consequences."

Consequences, indeed. ATMs dislodged bank tellers. Microsoft Outlook manages what secretaries used to do. Expedia is replacing travel agents. E-ZPass is doing away with toll-booth operators. And robots continue to supplant factory workers.

But surely some jobs are safe. Truck drivers, perhaps? A machine can't negotiate a left-hand turn against oncoming traffic without a human behind the wheel, can it? Or so economists Frank Levy of MIT and Richard Murnane of Harvard University reasoned in their book "The New Division of Labor," way back in 2004.

That was then.

Six years later, Google developed a car that could drive itself, crossing the Golden Gate Bridge, circling Lake Tahoe and cruising down Hollywood Boulevard. The gee-whiz driverless car could soon claim victims in the job market.

"Twice a week, a truck comes near my house, and two guys get out and pick up the garbage," says Vardi, the Rice computer scientist. "This will disappear. There will still be a truck coming, but it will be driven autonomously, and the garbage will be picked up autonomously, and those jobs will be gone."

In the United States alone, 92,000 people are employed as sanitation workers, according to the Bureau of Labor Statistics. Add all other driving occupations, from long-haul truckers to taxi cab drivers, and the total exceeds 4 million. All those jobs may be in danger.

And that's the future: Other occupations already are disappearing. Add up the jobs that technology can take across dozens of occupations and the result, Vardi and others warn, is unemployment on a scale we haven't begun to imagine.

"The vast majority of people do routine work. The human economy has always demanded routine work," says software entrepreneur Martin Ford. He worries that machines will take all those routine jobs, leaving few opportunities for ordinary workers.

In his book "The Lights in the Tunnel," Ford foresees a computer-dominated economy with 75 percent unemployment before the end of this century; the vast majority of workers, he predicts, won't be able to develop the skills necessary to outrun job-killing computers and robots.

"People talk about the future, creating new industries and new businesses," Ford says. "But there's every indication that these are not going to be in labor-intensive industries. ... Right from the get-go, they're going to be digital."

Consider the great business successes of the Internet age: Apple employs 80,000 people worldwide; Google, 54,000; Facebook, 4,300. Combined, those three superstar companies employ less than a quarter of the 600,000 people General Motors had in the 1970s. And today, GM employs just 202,000 people, while making more cars than ever.

As far back as 1958, American union leader Walter Reuther recalled going through a Ford Motor plant that was already automated. A company manager goaded him: "Aren't you worried about how you are going to collect union dues from all these machines?"

"The thought that occurred to me," Reuther replied, "was how are you going to sell cars to these machines?"

An AP interactive that accompanies the Great Reset series explores job growth in recent economic recoveries and includes an in-depth video analysis: http://bigstory.ap.org/interactive/interactive-great-reset/

Bernard Condon reported from New York. You can reach the writers on Twitter at www.twitter.com/BernardFCondon and www.twitter.com/PaulWisemanAP.