There are now three (NASA) Robots on Mars - Spirit, Opportunity and Curiosity.(No idea if the Beagle lander can be counted) All of them worked far beyond their expected lifetime. Spirit and Opportunity were designed for only 90 days of operation because the engineers at NASA decided that Martian dust would cover the solar panels and prevent further recharging. But, as it turns out, the winds on Mars cleaned up the solar panels and allowed it to continue for almost 10 years.
|Skycrane deployed for landing Curiosity|
Curiosity, on the other hand, is powered like a nuclear battery(like Iron Man's Arc Reactor, but lower power). Curiosity's landing itself was a another great engineering feat. They wanted to have a soft landing, so the used what they called a SkyCrane. SkyCrane was a rocket powered parachute that used rocket boosters to slow down the landing. It looked awesome.
What Operating system do these robots run ? Windows, Linux or OsX ?
|Margaret Hamilton - NASA Apollo programmer|
RTOS is a pretty stable OS meant for the IoT(Internet of Things). The code is mostly C. Curiosity 2.5 million lines of C on a RAD750 processor manufactured by BAE.
The Apollo mision's source code is actually now open source and free : being released on the 40th anniversary of the mission on Google Code. One of the programmers was Margaret Hamilton, Director of the Software Engineering Division of the MIT Instrumentation Laboratory, which developed on-board flight software for the Apollo space program. Hamilton is credited with coining the term "software engineering". In this field she was one of those who developed the concepts of asynchronous software, priority scheduling, end-to-end testing, and human-in-the-loop decision capability, such as priority displays which then became the foundation for ultra reliable software design.
|Alternative ending for the xkcd Mars rover webcomic|