作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2009, Vol. 35 ›› Issue (11): 43-45. doi: 10.3969/j.issn.1000-3428.2009.11.015

• 软件技术与数据库 • 上一篇    下一篇

lwThread:轻量级通用多线程

杜 敏,章 莉,朱 琨,吴百锋   

  1. (复旦大学计算机与信息技术系,上海 200433)
  • 收稿日期:1900-01-01 修回日期:1900-01-01 出版日期:2009-06-05 发布日期:2009-06-05

lwThread: Lightweight General Multithreading

DU Min, ZHANG Li, ZHU Kun, WU Bai-feng   

  1. (Dept. of Computer & Information Technology, Fudan University, Shanghai 200433)
  • Received:1900-01-01 Revised:1900-01-01 Online:2009-06-05 Published:2009-06-05

摘要: 针对嵌入式系统开发中多线程技术可移植性较差的问题,提出一种通用的轻量级多线程模型——lwThread,采用标准C语言实现,在源程序级实现线程的切换。与同类技术相比,lwThread不但可以实现线程的优先级,还可以为每个线程动态分配独立的栈空间,同时介绍确定共享栈池大小的理论依据。实验结果表明,lwThread模型可以有效提高开发效率,并降低资源消耗。

关键词: 通用多线程, 共享栈, 嵌入式系统, 计算机体系结构

Abstract: Aiming at the lack of portability problem of multithreading technology in embedded system development, a lightweight general multithreading model called lwThread is proposed, which is developed in pure C language. The threads context switch in standard C statement is implemented. Compared with other thread models, lwThread combines the priority scheduling with dynamic stack allocation in shared-stack pool. This paper also presents a method to determine the maximum stack usage in the shared stack. Experimental results show this lwThread model can improve the efficiency of development and reduce consumption of resources.

Key words: general multithreading, shared stack, embedded system, computer architecture

中图分类号: