Disclosed are a method, a device, and a single-tasking system for implementing multi-tasking in a single-tasking system. The method includes: performing a master task; allocating a hardware timer to a slave task on a central processing unit (CPU); configuring an interrupt period of the hardware timer; and generating, by the hardware timer, a hardware interrupt periodically based on the interrupt period to trigger the performance of the slave task. Therefore, independent and concurrent execution of the master task and slave task can be achieved in a single-tasking system, without the need to add an unwieldy multitasking scheduling framework to the operating system. Furthermore, the slave task is executed only when the hardware timer generates hardware interrupts, so less system resources will be consumed and the unwieldy inter-process communication mechanisms as adopted in traditional multi-tasking systems won't be needed. Example inter-process communication mechanisms may include, semaphores, spinlocks, etc.
展开▼