\section{Introduction}
Batteryless systems are emerging as a promising future platform of Internet-of-Things (IoT) devices.
These systems adopt a small capacitor as an energy storage and operate by harvesting power from environmental sources.
This setup effectively addresses challenges associated with traditional battery-based systems, such as need for human intervention for recharging or replacement~\cite{choiCompilerDirected2022} and harmful environmental impacts~\cite{ahmedInternet2024}.
These systems are also known as intermittent systems, since the computation happens intermittently only when there exist sufficient power to compute.

Intermittent systems require software support to sustain long-running executions across power failures.
% An intermittent system requires software support to retain volatile system state information across power interruptions. 
During operation, volatile data (e.g., registers or SRAM data) must be saved to Non-Volatile Memories (NVMs) through a process known as checkpointing.
When power is restored, this saved state is restored to allow operations to resume from the context before the power failure (recovery). 
In designing these state retention techniques, software designers rely on an \emph{execution model} that abstracts hardware-level operations and represents behavior of intermittent systems necessary for software design.

Figure 1 illustrates this execution model. 
As energy accumulates, the voltage of the capacitor gradually increases.
And upon reaching the power-on threshold, the collected power is supplied to the system. 
The system begins operation at this point, and execution is halted when the capacitor reaches the power-off threshold. 
Software designers aim to leverage this execution model to implement intermittent systems at minimal cost.

\begin{figure}[t]
    \centering
    \includegraphics[width=\linewidth]{figs/cropped/intermittent_computing.pdf}
    \caption{Traditional execution model of intermittent systems.}
    \label{fig:introduction}
\end{figure}


In the meantime, researches on intermittent systems are increasingly exploring shorter operation time by using smaller capacitors (e.g., less than 1mF~\cite{ahmedEfficient2019}).
Operate on small capacitors is generally desirable, as it not only reduces device volume but also enhances the responsiveness by enabling the system to wake up more frequently~\cite{bakarProtean2023a,maengAdaptive2020,alsubhiStash2024}.
As a result, recent studies have targeted operation times in the range of tens of milliseconds~\cite{reymondSCHEMATIC2024,wuIntOS2024,yildizEfficient2023,choiCompilerDirected2022} or even microseconds~\cite{reymondSCHEMATIC2024,wuIntOS2024}.
However, as energy storage size decreases, the traditional execution model no longer provides an accurate abstraction of actual execution behavior.
% The challenge is that the traditional execution model does not provide precise abstraction of the real execution anymore when the energy storage is very small.
The major source of this discrepancy is the buffering effect of decoupling capacitors, which is overlooked in the traditional model, as their size was considered negligible compared to the main energy storage.

Decoupling capacitors are on-board capacitors that act as energy buffers.
They are mandatory components since the buffered energy prevent transient voltage drop when the system suddenly draws a large current such as during checkpointing (Sec.~\ref{sec:system_description}).
However, their buffering effect introduces discrepancies between the execution model and the actual system behavior.
For example, when the system powers on, decoupling capacitors are quickly charged using the energy in the storage, making the energy storage voltage an unreliable estimate of available energy.
This buffered energy also allows the system operate for a while at a sub-normal voltage after the power supply is stopped.
Additionally, between power cycles, decoupling capacitors discharge due to the resistance of the system, which significantly lowers the power efficiency.
In the systems with small capacitors, these effects dominate the behaviors that modeled in the traditional model.
Consequently, techniques that are highly efficient according to the traditional model may introduce substantial power overhead and even correctness issues in small-scale systems.
% Consequently, designing software techniques based on the traditional model brings significant power overhead and even correctness issues, even they are extremely efficient in the traditional model.
% While this seems merely delaying the start and the end of the operations at first glance, we will show that it significantly affects the power efficiency and even correctness of software designs.

% This execution model has served as the foundation for many successful intermittent system technologies. 
% However, it may introduce considerable inaccuracies when applied to recent research aimed at very short power supply durations. 
% Short power interruptions generally improve system responsiveness and are therefore considered a desirable trait. 
% Recent studies have explored technologies operating with power supply times in the range of tens of milliseconds or microseconds, often utilizing small capacitors of less than 1mF for energy storage. 
% When capacitors of this scale are used, the system operates in a way that significantly diverges from the traditional model. 
% The primary reason is the presence of a decoupling capacitor on the board—an essential component that maintains system voltage during sudden current changes.

% The decoupling capacitor acts as an energy buffer, creating a deviation from the ideal execution model. 
% When power is supplied to the system, the decoupling capacitor rapidly charges and reduces capacitor voltage. 
% Then the buffered energy continues to power the system even after the power-off threshold is reached. 
% Understanding this effect is crucial for intermittent system designers, as it has a significant impact on both system efficiency and correctness.

In this paper, we propose a detailed execution model for intermittent systems including the effects of decoupling capacitors. 
In Section 2, we demonstrate that understanding this model is critical for software designers. 
Our evaluation shows that intermittent systems designed upon the traditional model can be up to six times more energy-inefficient and may fail to predict power-off timings accurately, leading to unsafe checkpointing. 
Based on the insights from the detailed model, we propose design guidelines to implement efficient and safe intermittent systems.