Why do desktop OSes have a high response time when resumed from sleep/hibernation mode?

1

Why do desktop OSes such as Windows have a high response time when resumed from sleep or hibernation mode?

Intuitively, it should take less time to respond. But what is messed up internally that makes it take a while to come to its senses?

Sinstein

Posted 2014-08-21T17:03:19.163

Reputation: 155

Answers

6

I'm going to answer somewhat generically. I don't know if this applies to Windows. (If you want an answer about Windows specifically, ask on Super User.)

Think of the memory of a computer as a desk with lots of papers spread on it. When you need to read or write to a piece of paper, grab it from the desk. Sometimes the paper won't be on the desk, but in a filing cabinet somewhere; in that case you'll need to fetch it from the filing cabinet. The desk is the computer's RAM and the filing cabinets are the hard disk.

During hibernation, the RAM is switched off, so when power comes back on, there is nothing in RAM. The computer starts with a clean desk, with everything in the filing cabinets. All the data of the running programs needs to be fetched back from the filing cabinets, which happens on a by-need basis. So at first programs will be sluggish as they spend a lot of time loading stuff from the disk; eventually the cache will fill up with the most useful data.

This effect doesn't occur with a suspension that doesn't switch RAM off. However other things may need time to come back up, such as network connections.

Why does your intuition say that the computer should respond faster when it resumes from hibernation? At a guess, in the desk metaphor, you're thinking that it's faster to work from a clean desk. But it's the contrary: the cost of managing the desk doesn't depend much on the number of papers that are on it at a given time, only (or mostly) on the size of the desk. The computer doesn't have a problem with messy desks.

This is a general principle when analyzing resource utilization: if a computer has free memory, this memory is wasted. Having some memory free doesn't make the computer faster (except perhaps for a small amount kept in reserve to handle sudden urgent requests). The best performance comes from keeping the memory full of useful things — a cache (and the RAM is a cache for the much slower disk) is only as useful as it's used.

Gilles 'SO- stop being evil'

Posted 2014-08-21T17:03:19.163

Reputation: 58 319