| Forth operating system has a wide range of applications in the embedded field due to its many advantages such as scalability,reconfigurability,transplantability and so on.The early Forth multitasking operating system was based on the CPU scheduling methods,although this method can handle the emergent events in real time but it breaks the working rhythm of the Forth virtual machine,it's real-time acquisition is at the cost of consuming a large amount of information storage time and storage space during task switching.Therefore,the operating system based on Forth virtual machine scheduling has become a hot topic in the field of research.In the operating system based on the Forth virtual machine,the task execution information is transferred through the stack.When the task switched,the system only needs to save and restore the data stack pointer to complete context switching,which greatly reduces the memory space occupation and time consumption.However,there are some defects in the operating system based on the Forth virtual machine.Its scheduling time must be synchronized with the instruction cycle of the Forth virtual machine.The existing scheduling mechanism does not support real-time scheduling,resulting in limited application.To solve this problem,this thesis has defined a task type-interrupt task in the operating system based on Forth virtual machine,and designed a set of interrupt task processing mechanism.By creating an interrupt task and linking an incident execution body,the interrupt task,terminal task,and background task are linked together to form a task cycle linked list.When an unexpected event occurs,the interrupt task is ready by triggering an interrupt.Under the premise of ensuring the stability of the multi-task scheduling of the original Forth system,the interrupt task is scheduled to handle the incident,in order to increase the ability of the Forth system to handle real-time emergencies.The above works have been verified on the Arduino UNO hardware platform and ransplanted with the open source AmForth system.The experimental results demonstrate that the waiting time for interrupt task in improved Forth operating system is significantly less than the original system.It verified the feasibility and effectiveness of real-time multi-tasks scheduling based on Forth virtual machine proposed in this thesis.The innovation of this topic: to ensure the inherent characteristics of Forth virtual machines and compatible with existing round robin scheduling,enables Forth multitasking operating systems to have the ability to handle incidents through real-time scheduling. |