[From the last episode: We looked at how legacy codeA collection of software that’s been built up over the years. It’s usually been improved an optimized gradually for the processor it's running on, and it works, so developers will be reluctant to make major changes to it. can make it hard for newer processorsA computer chip that does computing work for a computer. It may do general work (like in your home computer) or it may do specialized work (like some of the processors in your smartphone). to be successful, even if they’re “better.”]
When you’re in your house, especially if you have a family, the house probably hums with activity. The lights are on, music is playing, one or more TVs will be on, someone may be using the computer… all part of the normal goings on.
But what happens when you all pile into the car to go somewhere? Well, you probably turn the music and the TVs off; you shut down the computer; you turn most of the lights off. Why? To avoid wasting energy on things from which no one is around to benefit.
You might even say that you put the house to sleep, waking it back up when you get back home. It’s not completely powered down – you didn’t pull the main breaker, since you still want the heater to keep the house at a reasonable temperature and the refrigerator to keep the food cold. But you’re definitely using less energy while you’re away.
Sleeping Machines
The same thing happens with electronic systemsThis is a very generic term for any collection of components that, all together, can do something. Systems can be built from subsystems. Examples are your cell phone; your computer; the radio in your car; anything that seems like a "whole." – and for the same reason: saving energy. One clue is that computer: rather than shutting it down completely, meaning a new hard reboot, you may well just put it to… wait for it… sleepThe state of a machine where as many non-essential electronic elements as possible are shut down, without powering the machine completely down.. What happens with your phone when you’re not using it? It shuts down the display, stops playing that video, and goes to… sleep.
OK, so, apparently, the notion of a sleeping machineIn our context, a machine is anything that isn't human (or living). That includes electronic equipment like computers and phones. isn’t so obscure. But what does it really mean?
Just as there are many electrical items in your house that you can shut off, there are also many electronic components in your laptop and your phone that can be shut off. When you put a laptop to sleep, it can shut down the processor, the hard driveA type of persistent (non-volatile) memory built from rotating platters and “read heads” that sense the data on the platters., the display, the graphics processor… almost everything. So what makes this different from shutting it all the way down?
Well, for one thing, you get to keep your activities going. That document you were working on is still up. That pageA chunk of memory on a hard drive or SSD that can be brought into DRAM for use or for execution. you were browsing is still available. That means one of two things: either the working memory remains awake, or, for a deeper sleep, the computer stores the contents on a hard drive before powering down the working memory. In the latter case, it will reload the contents when it wakes back up. Working memory is usually DRAMStands for "dynamic random access memory." This is temporary working memory in a computer. When the goes off, the memory contents are lost. It's not super fast, but it's very cheap, so there's lots of it., which is volatile – it needs powerThe rate of energy consumption. For electricity, it’s measured in watts (W). to keep its contents. So either it has to remain awake or its contents need to be moved to non-volatile memory. (For a refresher on memory types, check out this past blog post.)
Another difference between shut down and asleep is the fact that, usually, your keyboard has to remain active; that’s often how you wake the computer back up. The keyboard has no effect when the computer is off.
Keeping the Power Down
This all matters for phones and for IoTThe Internet of Things. A broad term covering many different applications where "things" are interconnected through the internet. devices even more – in particular, when they’re battery-powered. Even though it may feel like your phone goes through the battery too fast, engineers have worked really hard to lighten the load on the battery. And they continue to do so. Being able to put things to sleep is an important part of that effort. If you’re not watching a video on your phone, then the circuits used to decode the video stream can be shut down. They may even speed up or slow down the processors depending on how much work you’re doing, since a slower processor requires less energy (just like jogging slowly requires less energy than running fast).
Now… something I mentioned above may have raised a question in your mind: If you use the keyboard to wake the computer back up, then… if the processor is asleep, how does it know that you touched the keyboard? That’s the topic of next week’s post.
Leave a Reply