Browse > Article
http://dx.doi.org/10.9708/jksci.2016.21.4.001

An Implementation of Single Stack Multi-threading for Small Embedded Systems  

Kim, Yong-Seok (Department of Computer and Communications Engineering, Kangwon National University)
Abstract
In small embedded systems including IoT devices, memory size is very small and it is important to reduce memory amount for execution of application programs. For multi-threaded applications, stack may consume a large amount of memory because each thread has its own stack of sufficiently large size for worst case. This paper presents an implementation of single stack multi-threading, called SSThread (Single Stack Thread), by sharing a stack for all threads to reduce stack memory size. By using SSThread, multi-threaded applications can be programmed based on normal C language environment and there is no requirement of transporting multi-threading operating systems. It consists of several library functions and various C macro definitions. Even though some functional restrictions in comparison to operating systems supporting complete multi-thread functionalities, it is very useful for small embedded systems with tiny memory size and it is simple to setup programming environment for multi-thread applications.
Keywords
Multi-threading; Stack sharing; C preprocessor; IoT;
Citations & Related Records
연도 인용수 순위
  • Reference
1 K. Kim and J. Shin, "Early Stage of IoT Market, From Things rather than Internet", LG Business Insight, LG Economic Research Institute, pp.2-13 March 2015.
2 P. A. Laplante, Real-Time Systems Design and Analysis, 3rd ed., IEEE Press, 2004.
3 H. J. Park and C. H. Lee, "An Efficient Real-Time Middleware Scheduling Algorithm for Periodic Real-Time Tasks," Springer-Verlag, Artificial Intelligence and Simulation, pp 304-312, 2005.
4 Atmel Microcontrollers, http://www.atmel.com/products/microcontrollers/avr/.
5 W. P. McCartney and N. Sridhar, "Stackless Preemptive Multi-Threading for TinyOS," Proceedings of the 2011 International Conference on Distributed Computing in Sensor Systems (DCOSS), pp. 1-8, 2011.
6 T. Reusing, "Comparison of Operating Systems TinyOS and Contiki," Network Architectures and Services, pp. 7-13, August 2012.
7 I. C. Bertolotti and T. Hu, Embedded Software Development: The Open-Source Approach, CRC Press, 2015.
8 T.P. Baker, "Stack-Based Scheduling of Realtime Processes", The Real-Time Systems Journal, pp.67-100, March 1991.
9 P. Levis, S. Madden, J. Polastre, R. Szewczyk, K. Whitehouse, A. Woo, D. Gay, J. Hill, M. Welsh and E. Brewer, "TinyOS: An Operating System for Sensor Networks," Ambient Intelligence, Springer, pp. 115-148, 2005.
10 K. Klues, C.J.M. Liang, J. Paek, R. Musaloiu-E, P. Levis, A. Terzis, and R. Govindan, "TOSThreads: thread-safe and non-invasive preemption in TinyOS," Proceedings of the 7th ACM Conference on Embedded Networked Sensor Systems, pp. 127-140, 2009.
11 A. Dunkels, O. Schmidt, T. Voigt and M. Ali, "Protothreads: Simplifying Event-Driven Programming of Memory-Constrained Embedded Systems," Proc. LCN'04, IEEE Computer Society, pp. 455-462, 2004.
12 TinyOS Community Website, http://www.tinyos.net.