Wake-up sources in ARM Architecture - Time & Space Complexity
When analyzing wake-up sources in ARM architecture, we want to understand how the system responds to events that bring it out of low-power states.
We ask: how does the time to wake up change as the number of possible wake-up sources increases?
Analyze the time complexity of checking multiple wake-up sources in ARM.
CHECK_WAKEUP_SOURCES:
MOV R0, #0 ; Initialize index
LOOP:
CMP R0, NUM_SOURCES ; Compare index with total sources
BGE END_LOOP ; If index >= NUM_SOURCES, exit loop
LDR R1, [SOURCES, R0, LSL #2] ; Load wake-up source status
CMP R1, #0 ; Check if source triggered wake-up
BNE HANDLE_WAKEUP ; If yes, handle wake-up
ADD R0, R0, #1 ; Increment index
B LOOP ; Repeat loop
END_LOOP:
BX LR ; Return from function
This code checks each wake-up source one by one to find which caused the system to wake up.
- Primary operation: Looping through each wake-up source to check its status.
- How many times: Once for each wake-up source, from 0 up to NUM_SOURCES - 1.
As the number of wake-up sources increases, the time to check all sources grows proportionally.
| Input Size (n) | Approx. Operations |
|---|---|
| 10 | About 10 checks |
| 100 | About 100 checks |
| 1000 | About 1000 checks |
Pattern observation: The time grows linearly as the number of wake-up sources increases.
Time Complexity: O(n)
This means the time to check wake-up sources grows directly in proportion to how many sources there are.
[X] Wrong: "Checking wake-up sources happens instantly no matter how many there are."
[OK] Correct: Each source must be checked one by one, so more sources mean more time spent checking.
Understanding how wake-up sources affect system responsiveness helps you reason about efficiency in embedded systems and low-power design.
"What if the system could check all wake-up sources in parallel? How would the time complexity change?"
Practice
Solution
Step 1: Understand the role of wake-up sources
Wake-up sources are signals or events that tell a device to stop sleeping mode and start operating.Step 2: Identify the main purpose
The main purpose is to save power by allowing the device to sleep until needed, then wake up when triggered.Final Answer:
To tell the device when to stop sleeping and start working -> Option AQuick Check:
Wake-up sources = signal to wake device [OK]
- Thinking wake-up sources increase speed
- Confusing wake-up with reset functions
- Assuming device stays always on
Solution
Step 1: Identify common wake-up sources
Common wake-up sources include physical inputs like button presses, timers, sensors, or network signals.Step 2: Match options to wake-up sources
Only a button press is a direct event that can wake the device from sleep.Final Answer:
A button press -> Option CQuick Check:
Button press = valid wake-up source [OK]
- Confusing software actions with wake-up triggers
- Thinking screen brightness changes wake device
- Assuming memory formatting wakes device
Solution
Step 1: Understand wake-up source configuration
The device is set to wake on either a timer event or a button press, meaning either event alone can wake it.Step 2: Analyze the scenario
At 10 seconds, the timer triggers, which is a valid wake-up source, so the device wakes even if no button is pressed.Final Answer:
The device wakes up because of the timer event -> Option DQuick Check:
Timer event alone wakes device [OK]
- Thinking all wake-up sources must trigger simultaneously
- Confusing wake-up with reset
- Assuming button press is mandatory
Solution
Step 1: Check wake-up source configuration
If the device does not wake on a network signal, it likely means the network signal is not set as a wake-up source.Step 2: Eliminate unrelated causes
Battery charge, active mode, or display connection do not prevent wake-up from a configured source.Final Answer:
The network signal is not configured as a wake-up source -> Option AQuick Check:
Wake-up source must be configured to work [OK]
- Assuming battery charge affects wake-up
- Confusing sleep and active modes
- Thinking display connection affects wake-up
Solution
Step 1: Understand the requirement
The device should wake up when either the motion sensor detects movement or the timer reaches 5 minutes, not both together.Step 2: Choose correct configuration
Configuring both as wake-up sources with an OR condition allows waking on either event, saving battery and meeting requirements.Step 3: Eliminate incorrect options
Only timer or only motion sensor misses one trigger; requiring both simultaneously delays wake-up unnecessarily.Final Answer:
Configure both motion sensor and timer as wake-up sources, waking on either event -> Option BQuick Check:
Wake on either event = configure both sources [OK]
- Configuring only one wake-up source
- Requiring both events simultaneously
- Ignoring battery saving by waking too often
Ready to prove it?
Pass the test and this pattern moves unknown
