What happens to cabin pressurisation when the engines fail? I was reading about the cabin pressurisation mechanism from Wikipedia and another article here. According to both of them, the aircraft's engine plays a vital role in the  pressurisation process.



My question is:

I have come across many air crash investigation articles mentioning that all the engines of an aircraft had failed, but the pilots were able to glide the aircraft and safely land it with no casualties. How is it possible for everyone onboard the aircraft to survive without cabin pressurisation (with all engines out) ?

UPDATE: What if a safe landing area is a bit too far? After losing altitude, the aircraft can't obviously gain altitude. Won't the plane crash due to low altitude (the descent is fast) gliding?So, isn't it better to maintain (sufficient) altitude to reach an emergency destination? I hope the altitude can be maintained provided cabin pressurisation is intact. But, how is this achieved in commercial aircrafts?
Closing the outflow valve would seal up the plane, so it wouldn't depressurize immediately. Once the pressure falls below a safe threshold the oxygen masks would drop. The masks are good for about 15 minutes.

Air Transat flight 236 which ran out of fuel over the Atlantic holds the record for the longest unpowered glide in an airliner. It lasted about 19 minutes. 

The APU can provide pressurization, but if you're out of fuel that won't work either. Air Transat was running off the RAT and I doubt that can provide pressurization. BUT if you factor in the outflow valves being closed and the last part of the glide being below 10,000 feet the oxygen masks will provide ample time for the passengers to stay safe.