Abstract. In wireless sensor networks, each sensor node has severe resource constraints in terms of energy, computing device, and memory space. Especially, the memory space of the platform hardware is much smaller than that of the other computing systems. In this paper, we propose a OTL, which is an on-demand thread stack allocation scheme for MMU-less real-time sensor operating systems. The OTL enables to adaptively adjust the stack size by allocating stack frame based on the amount of each function's stack usage. The amount of the function's stack usage is checked at compile-time, and the adaptive adjustment of the stack occurs at run-time. Our experimental results show that the OTL significantly minimizes the spatial overhead of the threads' stacks with tolerable time overhead compared with fixed stack allocation mechanism of the existing sensor operating systems.