Thread Control Block

The following is the declaration of the Thread Control Block.

struct tcb {
u32_t status;
struct reg_context thread_context;
void *stack;
struct thread_info thread_params;
u32_t executedTime;
struct tcb *recoveryTask;
u32_t sched_field;
u32_t magic_key;
};
  • unsigned int status

    This field holds the status information of the current thread. It can be one of THREAD_ON_CPU, THREAD_READY, THREAD_SUSPENDED THREAD_BLOCKED, THREAD_EXITED or THREAD_MISSED_DEADLINE.

    This field is not directly updated by the kernel. The kernel thread library informs the scheduler about the status of a thread through the Scheduler API. It is upto the scheduler object to keep this field consistent. For example when a thread exits, the kernel calls the function set_mode(curr_thread,THREAD_EXITED) of the scheduler API. This approach of calling a scheduler function to update the status helps, when the sheduler needs to do additional work (apart from setting it's status) whenever the status of a thread changes. For example, for periodic threads, it might reset them when they exit.

  • struct reg_context thread_context

    This structure stores the context of a thread. The structure reg_context is architecture specific. This field is accessed by the kernel thread library only. (The scheduler object should not mess with it).

  • struct thread_info thread_params

    This field holds the initial thread parameters, like the start function, stack size, deadline etc. This information is required for resetting threads.

  • void * stack

    This field is a pointer to the stack of the thread.

  • u32_t executedTime

    This field can be used for keeping profiling information for the thread. This is currently not being used.

  • u32_t sched_field

    This field is meant for use by the scheduler object. The kernel never accessed this field.

    Typically this field will be used by the scheduler object for constructing datastructure of tcb's. For example if the scheduler object stores the ready threads in a list, this field would be used as next pointer.

  • u32_t magic_key

    This field is used for debugging and should go away in the final release.

http://www.cse.iitd.ernet.in/~soumyadeb/projects/mtp/report/node56.html

最新文章

  1. MongoDb gridfs-ngnix文件存储方案
  2. Centos中文乱码的解决方法
  3. angularjs学习曲线
  4. onSaveInstanceState() 和 onRestoreInstanceState()
  5. Jquery get parameter value
  6. Linux信号列表
  7. Mysql日期函数,时间函数使用的总结
  8. Zeroc Ice开发环境搭建
  9. Number.toLocalString() js
  10. oracle填坑之PLSQL中文显示为问号
  11. 使用Spring Cache缓存出现的小失误
  12. webwork框架
  13. SpringBoot 推荐博客
  14. 【CF542D】Superhero's Job 暴力
  15. JavaSE习题 继承接口和泛型
  16. Spring4.3整合Hibernate4.3搭建Spring MVC
  17. CSS中float和Clear的使用
  18. linux命令-寻找超过100M的文件,并将其删除
  19. m2eclipse安装遇到的问题——备忘
  20. Python 排序---sort与sorted学习

热门文章

  1. ajax的post提交方式和传统的post提交方式哪个更快?
  2. Kattis - Association for Computing Machinery
  3. router+x
  4. node——进阶版服务器根据不同请求作出不同响应+响应html文件等文件
  5. js倒计时demo 天/时/分/秒
  6. 马上着手开发 iOS 应用程序
  7. SQL的运算符优先级
  8. STM32 关于头文件路径没添加错误问题(cannot open source input file "spi.h": No such file or directory)
  9. 【【henuacm2016级暑期训练】动态规划专题 N】Valid Sets
  10. shell 的变量