摘要
如何协调地在同一个多线程中完成定时任务和随机任务以及数据交换是多线程程序设计的一个重要任务。文中总结分析了2种多线程的实现方法,即用户接口线程方式和工作者线程方式。为了在同一多线程中执行定时任务和随机任务,将多种任务封装成一个对象,在多线程中根据指令进行调度。文中将多线程看作一个虚拟的下位机,主线程等采用串行通信协议的原理实现与多线程之间的多种任务复杂数据交换和通信。
A key task in design of a multithread program is coordinated performance of timed tasks and random tasks and data exchange in the same multithread. The paper proposes two methods for multithread implementation, namely, user-interface thread and worker thread. To execute timed tasks and random tasks in the same multithread, multiple tasks are encapsulated as one object for dispatch in the multithread according to instructions. The multithread is viewed as a virtual machine. The main thread communicates and exchanges data with the multithread in accordance with serial communication protocols.
出处
《飞行器测控学报》
2006年第6期91-94,共4页
Journal of Spacecraft TT&C Technology
关键词
多线程
定时任务
随机任务
通信协议
Multithread
Timed Task
Random Task
Communication Protocol