Technology advances are making amazing things possible: we finally have a chance to solve the problems that have long plagued humanity such as hunger, disease, energy, and education.

The same technologies that make this abundance possible are however setting the stage for the elimination of the majority of human jobs.

Within two decades, we will have almost unlimited energy, food, and clean water; advances in medicine will allow us to live longer and healthier lives; robots will drive our cars, manufacture our goods, and do our chores. There won’t be much work for human beings. Self-driving cars will be commercially available by the end of this decade and will eventually displace human drivers — just as automobiles displaced the horse and buggy — and will eliminate the jobs of taxi, bus, and truck drivers. Drones will take the jobs of postmen and delivery people.

The debates of the next decade will be about whether we should allow human beings to drive at all on public roads. The pesky humans crash into each other, suffer from road rage, rush headlong into traffic jams, and need to be monitored by traffic police. Yes, we won’t need traffic cops either.

Robots are already replacing manufacturing workers. Industrial robots have advanced to the point at which they can do the same physical work as human beings. The operating cost of some robots is now less than the salary of an average Chinese worker. And, unlike human beings, robots don’t complain, join labor unions, or get distracted. They readily work 24 hours a day and require minimal maintenance. Robots will also take the jobs of farmers, pharmacists, and grocery clerks.

Medical sensors in our smartphones, clothing, and bathrooms will soon be monitoring our health on a minute-to-minute basis. Combined with electronic medical records and genetic and lifestyle data, these will provide enough information for physicians to focus on preventing disease rather than on curing it. If medications are needed, they can be prescribed based on a person’s genome rather than a one-size-fits-all basis as they are today.

The problem is that there is now so much information that humans cannot effectively analyze it. But artificial intelligence-based physicians such as IBM Watson can. The role of the doctor becomes to provide comfort and compassion — not to diagnose disease or to prescribe medications. In other words, computers will be also taking over some of the jobs of our doctors, and we won’t need as many human doctors as we have today.

It will be like the future that Autodesk CEO Carl Bass once described to me: “The factory of the future will have only two employees, a man and a dog. The man will be there to feed the dog. The dog will be there to keep the man from touching the equipment.”

Governments will not be able to create the jobs or slow down this progress. They can barely keep up with the advances that are happening in technology, let alone develop economic policies for employment. Even the courts are struggling to understand the legal and ethical issues of advancing technologies. Neither they nor our policy makers have come to grips with how to protect our data and personal information, control cable and Internet monopolies, regulate advances in genetics and medicine, and tax the sharing economy that companies such as Uber and AirBnb belong to. How are policy makers going to grapple with entire industries’ disruptions in periods that are shorter than election cycles?

The industrial age lasted a century, and its consequent changes have happened over generations. Now we have startups in Silicon Valley shaking up bedrock industries such as cable and broadcasting, hotels, and transportation.

The writing is clearly on the wall about what lies ahead. Yet even the most brilliant economists — and futurists — don’t know what to do about it.

The greatest futurist of our time, Ray Kurzweil, said to me in a debate we had about jobs that “Automation always eliminates more jobs than it creates if you only look at the circumstances narrowly surrounding the automation. That’s what the Luddites saw in the early nineteenth century in the textile industry in England. The new jobs came from increased prosperity and new industries that were not seen.” Kurzweil’s key argument was that just as we could not predict that types of jobs that were created, we can’t predict what is to come.

Kurzweil is right, but the problem is that no matter what the jobs of the future are, they will surely require greater skill and education, as robots can do all the grunt work. Manufacturers who want to bring production back already complain that they can’t find enough skilled workers in the U.S. for their automated factories.  echnology companies that write the software also complain about shortages of workers with the skills that they need. We won’t be able to retrain the majority of the workforce fast enough to take the new jobs in emerging industries. During the industrial revolution, it was the younger generations who were trained, not the older workers.

The only solution that I see is a shrinking work week. We may perhaps be working for 10 to 20 hours a week instead of the 40 we do today. And with the prices of necessities and of what we today consider luxury goods dropping exponentially, we may not need the entire population to be working. There is surely a possibility for social unrest because of this, but we could also create the utopian future we have long dreamed of, with a large part of humanity focused on creativity and enlightenment.

Regardless, at best we have another 10 to 15 years in which there is a role for humans.

The number of available jobs will actually increase in the U.S. and Europe before it decreases. China is out of time because it has a manufacturing-based economy, and those jobs are already disappearing. Ironically, China is accelerating this demise by embracing robotics and 3D printing.

As manufacturing comes back to the U.S., new factories need to be built, robots need to be programmed, and new infrastructure needs to be developed. To install new hardware and software on existing cars to make them self-driving, we will need many new auto mechanics. We need to manufacture the new medical sensors, install increasingly efficient solar panels, and write new automation software.

So the future is very bright for some countries in the short term. But in the long term it is uncertain for all.

The utopian, Star Trek future we have long dreamed about is finally within sight. The only question is whether the human race will focus on uplifting itself through knowledge and the arts — or self-destruct because it doesn’t know what to do with itself.