By the time Thuan Pham was just 12 years old, he had already had several brushes with death.

While escaping Vietnam with his mother and younger brother in 1979, a violent storm battered the dinky, wooden fishing boat carrying the family and dozens of other refugees. Pirates later robbed them. And once they landed at a refugee camp in Indonesia, they lacked shelter and sanitation for weeks.

"My mother decided that it was better to risk our lives...rather than grow up without opportunities for a better life," Pham said. "That's what you do as an immigrant: You are willing to trade your life for freedom. Sometimes you get lucky and you get to live."

Fortunately, Pham's family got lucky. And they eventually landed in suburban Maryland.

One immigrant's path from cleaning houses to Stanford professor

Pham worked hard in school, fell in love with computers and gained admission into the Massachusetts Institute of Technology where he studied computer science.

After graduation, he headed to Silicon Valley and became an integral part of the tech industry's transformation.

In 2013, he was hired as Uber's chief technology officer. Since that time, Pham, now 49, has built Uber's engineering group from 40 engineers to more than 2,000. The company's technology has gone from handling 30,000 trips a day to millions.

In addition, Pham was recently named one of 40 Great Immigrants of 2016 by the Carnegie Corporation, the nation's oldest grant making foundation.

Here is Pham's American Success Story.

What was life like as a child in Vietnam?

When Saigon fell in April of 1975 we lived through four years of Communism. My uncles were sent to a concentration camp and they died there.

My mom, younger brother and I left in the middle of the night. We crammed about 470 people on a dinky, wooden fishing boat -- the MT-2377. As we set out, everyone was throwing up.

We miraculously survived a major storm. The 10- to 20-foot waves were smashing into our boat. We were all just holding on for dear life.

One day we saw a light and thought someone spotted us to save us! But it was Thai pirates. They robbed us of everything. But we were lucky. They could have killed us.

This former FBI spy hunter fled Cuba at age 9

One night, as evening started to fall, we saw land. We were so happy. We gunned it and ran the boat aground in the beachfront property. Our boat was immediately surrounded by military who took us to a refugee camp.

My mom was saying, "We're free! We're free!" But a week later, they put us back on our boat and a Malaysian navy ship towed us back out to sea.

We ended up in Singapore, quarantined on our boat. Finally, we landed in Indonesia. We were treated pretty well there when we arrived. But then we were taken to Kuku Island.

What happened on Kuku Island?

We were among the first occupants in the [refugee] camp and there was no infrastructure. The first night we had just a tarp over our heads with a drenching rain. There was no sanitation and lots of people died from disease.

We were there 10 months. Organizations like the UNHCR, CARE and Save the Children poured in to help and distributed food and aid packages for us.

There is little difference from the refugee camps that we see today in Syria or the people fleeing from North Africa across the Mediterranean on boats.

The U.S. and many other countries, such as Canada, France, Germany, Australia, etc., sent delegations to register people seeking asylum.

My American Dream: Offering legal help to other immigrants

Some people on Kuku languished for years because they had no ties to any of the countries processing refugees. We qualified for political asylum with the U.S. because my father was part of the South Vietnamese Army, and so we were able to come here.

My father had stayed in Vietnam. When we left in the middle of the night, it was the last time I'd see him for 10 years.

What was life like once you got to the U.S.?

We arrived to the United States on an airplane and were relocated to Rockville, Maryland.

There was a community of refugees just like us [in Rockville]. We banded together for economic survival.

My mom worked at a gas station and at a grocery store. She was an accountant in Vietnam, but since her English wasn't good, she wasn't able to get certified in the U.S.

A two-bedroom apartment cost $370 a month. We had to share the place with another family. There were seven people in our apartment.

Winter in Maryland is pretty cold, but inside our place it was like a sauna. Literally the condensation would drip from the glass door and windows. The apartment was full of cockroaches at night as well. That's how we lived for years.

I tried to work really hard at Richard Montgomery High School and it paid off. I graduated in 1986 and was admitted to M.I.T.

That's when life started getting better.

How did you become interested in computers?

The father of my best friend in high school bought an IBM PC and I would hang out at his house after school. We built a program for the computer and were like, "Hey look! it does what we want it to do!" So that was fun.

One of the people in the church was a director at the National Bureau of Standards and he took me in as a student volunteer. I actually wrote a pretty advanced program for them as a 10th grader to automate their accounting processes. It reduced the work of two to three accountants to the click of a button.

When I was about to go to M.I.T., they awarded me an $1,800 bonus check so I could buy an IBM computer to take to college.

What would you consider to be your big break?

When I graduated from M.I.T., I got a job in the HP research lab.

After three years at HP, I got bored so I joined a company called Silicon Graphics (SGI), a really hot technology company in the early 90's founded by Jim Clark. He went on to found Netscape and what we know as the Internet today.

How this son of migrant farm workers became an astronaut

It was a significant move, but I broke my mom's heart. She thought I was reckless. In her view, I should have stayed to build a career at a stable company like HP for 30 years and retire with a gold watch.

That was the thrill of my career.

My office mate founded NetGravity (which later merged with DoubleClick) and I joined it as the fourth engineer. I didn't tell my mom about that until we went public and I was able to buy a house.

Many people may have the skill, but ultimately we all need to create the opportunity to perform and show what we can do.

Uber was my big break. I knew Uber was the kind of company that could make a real change in the world.

How do you define success and do you think you've achieved it?

My measure of success, at the core of it, is, "Have I lived a meaningful life?" By that measure, I'm considered somewhat successful.

The other type of success is, "Did you do everything you could with your time on Earth?" That type of success, I'll leave to other people to judge.

What is the one thing you do every day that helps you achieve your goals?

I reflect. I think about the things that happened that day and ask myself, "Is that the best thing I could have done?"

The answer almost always is: "I could have done it better."