The human body and the set of biological processes we collectively refer to as “life” bear little resemblance to any real machine. We attempt to synthesize the complexity of the natural world but in fact have done so only on the fringes, in marginal, limited contexts. Undaunted, we anthropomorphize with respect to our creations, crowing about their ability to listen, see, hibernate, snooze, sleep, wake up.
These particular verbs feature prominently in discussions of power savings, where various approaches are combined to effect a reduction in a system’s appetite for energy. While the role of sleep in animals is not yet fully understood, the role of sleep in machines is typically to save power (or to mitigate related effects, like heat). The ability of a life form to sleep and awaken is possible, thanks to a decoupling of various portions of the body, while maintaining enough interconnectedness to facilitate coherent activity. But in the simpler, lower-cost systems we’re used to, the system or board is too often conceived of as a fully integrated whole, no portion being able to survive or operate independently of the others.
Successful sleep in a system, and the various possible stages of sleep, is analogous to that of a person. A machine could be active, idle, napping, sleeping, in a coma, or, regrettably, dead (with one possible advantage over humans). It all depends on the activity of processing, memory, and sensory organs as well as the awareness of state.
Activity, of course, is a relative thing. Typing at the computer is activity. Running a marathon is activity. One requires more energy than the other, and the human body is thankfully equipped with a dynamic energy and frequency scaling feature. When activity levels rise, the level of energy (as unlocked through the delivery of oxygen) increases through faster breathing, and the frequency (as embodied in the heartbeat) automatically increases.
It takes some time for such changes to take effect; if you want to be at your peak for a run, you have to warm up to get your respiration and blood working efficiently. Likewise, when you’re done, you have a recovery period where your pulse and breathing come back down to earth.
This reflects an approach that is being taken on advanced SoCs but could be applied to embedded boards as well: scaling of voltage and/or clock frequency according to the level of work required. A simple approach would allow a software command to instruct the board to go hyphy or chill out; a more sophisticated setup would be able to detect the activity and adjust accordingly. And here also there is a lag when a change is made. If the voltage is changed, there is a ramp time before a new steady state is achieved; if the frequency is changed, then there’s generally some time required for phase-locked loops to stabilize at the new frequency.
An idle state is something less than active, but still awake. Perhaps one is lost in daydream – actually, that is still productive, even creative. Maybe a better example is something like spending time on Myspace: there’s clearly little evidence of creative or cognitive contribution there. A Myspace sojourn might be considered the human equivalent of keeping the power up while stopping the clock on the brain. But the clock is still working elsewhere.
And this is where some decoupling helps. The animalian form has a sophisticated I/O system that operates at arm’s length from central processing. For the purposes of this discussion, the lumping together of input and output isn’t really relevant: what matters is input. Whether or not output happens to share a device or a wire or an organ or some circuitry is incidental. The input allows the sensing of pertinent activity to re-engage the brain. “Pertinent” is important, since filtering can be applied. For example, if your brain has shut down as you check out the profile of an FBI agent disguised as buffy13xxx, you may be unaware of lots of noise and even conversation going on around you. And yet if someone actually calls your name or you hear a pounding on the door, the input system traps that signal, culls it out of the mass of other background noise, and reawakens the brain. And possibly initiates a fight-or-flight response.
In similar fashion, the critical inputs on a board can be decoupled from the main processing element(s) to allow the latter to go idle by stopping the clock while watchfulness is maintained. If the board performs a networking function, for example, a chunk of circuitry at the Ethernet input may evaluate whether a given packet is addressed to the board; if not, nothing happens. But when a suitable packet arrives, the input can re-activate the processing side of things so that the packet can be handled.
If maintaining a ready state of idleness isn’t needed, then sleep could be considered. But there are varying levels of sleep, vaguely distinguished by their depth. If we are napping, a relatively light level of sleep is attained, and the expectation is that it will be short. We probably don’t change into different clothes, and the transition to and from sleep is pretty quick. For the most part, when we awaken, it doesn’t take long to remember where we are and what has to happen next. And we’re easily aroused by noise or other activity around us.
This can be achieved on a board by shutting down the core processing unit. But we do need to deal with the state of the system at this point. Since we’re going down only for a short time, we want to keep the state close at hand. So we can store it in the DRAM, flush the cache, and put the DRAM into a self-refreshing mode so that the core (and the memory controller) can be powered down. When the system is powered back up, the state does need to be recovered from memory, and the cache will take some time to refill, so things might be a tad slower for a short time, but they get rolling again pretty quickly.
A deeper sleep may be entered when activity isn’t expected. We might slip into something a bit more comfortable, brush our teeth, say goodnight to the cockatoo, and settle in for a good few hours. We can still respond to outside activity or arrange to be awoken at a specific time by an alarm clock that keeps running as we sleep. Upon waking, we achieve a slow recovery, gradually remembering where we are and what we’re supposed to do next (unless you’re like me, in which case wakeful autonomic activity dominates, pending the application of suitable quantities of liquid caffeine… preferably intravenously…).
A system can achieve such a deeper level of sleep by storing the state, not by using the nearby DRAM, but by sending it to some other form of non-volatile memory (typically FLASH or a disk). Then the DRAM itself can be powered down. Power to the input sensing circuitry could be reduced, and a timer could remain powered up if a specific wakeup time is specified. Upon reawakening, power is ramped back up, the state is gradually restored from its resting spot, and processing resumes. In this case, attempting to accelerate the process by applying a cup of coffee is unlikely to be effective.
Of course, it is possible for the body to attain an even lower level of consciousness, being either unconscious or in a coma. At this point there is no arousal. There’s still some level of activity, even though we may not understand what it is. In a system, this basically means that the janitor tripped over the power cord, pulling it out, so not even the inputs are awake. There may be a small amount of battery backup keeping a few things going, but, for the most part, power-down was not graceful, the state was not saved, and arrangements for a clean power-up were not made. So exactly when the thing powers back up, whether any data was lost in the process, and what the power-up state will be remain unknown.
The final unrecoverable resting state is serious business for the human race. There is no activity, there is no frequency, there is no energy being consumed. The system equivalent of this would be worse than just pulling the plug, since the plug can be put back in. Rather, it reflects either damage to or the wear-out of some part of the system such that power is lost (or the system has to be unplugged). And the system will no longer work. And here is where the system has an edge over us: the damage can always be repaired (although it might not make sense to do so). We’re not yet at a point of having to decide whether it makes economic sense to reanimate a deanimated human, although we’re pretty much there when it comes to deciding whether to let deanimation take its course. But that’s a whole separate subject.
The various levels of system repose are enabled through the judicious decoupling of the processor, memory, and input sensing circuitry (with a possible role for a timer), as well as the ability to ratchet up or down the voltage and/or clock frequency and save state. How much of this is done automatically or by the guidance of some higher-level software can vary greatly; it could be argued that greater intervention by a higher power can result in more effective operation. Standards and approaches to better power control by a central authority figure are underway and will be the subject of future discussion.