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

Thread Control Block的更多相关文章

  1. Thread control block & thread

    https://en.wikipedia.org/wiki/Thread_control_block Thread Control Block (TCB) is a data structure in ...

  2. 【APUE】Chapter12 Thread Control

    今天看了APUE的Chapter12 Thread Control的内容,记录一下看书的心得与示例code. 这一章的内容是对Chapter11 Threads(见上一篇日志)的补充,大部分内容都是理 ...

  3. P4语法(4)Control block

    Control block Control block之中用于放置设计好的Table和Action. 可以把control block认为是pipeline的一个模板,之前用的v1model中就是in ...

  4. CUDA中确定你显卡的thread和block数

    CUDA中确定你显卡的thread和block数 在进行并行计算时, 你的显卡所支持创建的thread数与block数是有限制的, 因此, 需要自己提前确定够用, 再进行计算, 否则, 你需要改进你的 ...

  5. 【并行计算-CUDA开发】CUDA编程——GPU架构,由sp,sm,thread,block,grid,warp说起

    掌握部分硬件知识,有助于程序员编写更好的CUDA程序,提升CUDA程序性能,本文目的是理清sp,sm,thread,block,grid,warp之间的关系.由于作者能力有限,难免有疏漏,恳请读者批评 ...

  6. 进程控制块(Process Control Block, PCB)

    是为了管理进程设置的一个数据结构.是系统感知进程存在的唯一标志.通常包含如以下的信息:(1)进程标识符(唯一)(2)进程当前状态,通常同一状态的进程会被放到同一个队列:(3)进程的程序和数据地址(4) ...

  7. 线程的简述Thread

    为什么有进程? 原来操作系统只能处理一件任务,有了进程就可以让操作系统处理多个任务.因为进程与进程之间是完全隔离的,涉及到了内存空间.数据的切换,所以就有了进程的概念. 已经有了进程,为什么还要线程? ...

  8. Windows内核 基本数据结构

    驱动对象: 每个驱动程序都会有唯一的驱动对象与之对应,并且这个驱动对象是在驱动加载时被内核中的对象管理程序所创建的.驱动对象用DRIVER_OBJECT数据结构表示,它作为驱动的一个实例被内核加载,并 ...

  9. CMSIS OS None

    /* ---------------------------------------------------------------------- * Copyright (C) 2011 ARM L ...

随机推荐

  1. html5中canvas(2)

    1.绘制图片(drawImage)(重点) 1.1 基本绘制图片的方式 context.drawImage(img, x, y); 参数: img 可以为:图片.视频或者canvas画布 x,y 绘制 ...

  2. UDP协议总结

    我们已经讲解了物理层.连接层和网络层.最开始的连接层协议种类繁多(Ethernet.Wifi.ARP等等).到了网络层,我们只剩下一个IP协议(IPv4和IPv6是替代关系).进入到传输层(trans ...

  3. Cacti部署之配置防火墙

    因为SNMP协议通信会使用udp 的161端口和tcp的199端口,因此需要在防火墙上将其开启 开启入站端口   保存数据或者重启服务   测试SNMP工具连接是否可获取信息     注意:要能使用s ...

  4. python字符串、列表、元组

    字符串的常用方法: name.count('h')统计h在name中出现的次数 name.find('h')查找h的索引 '?'.join(name)使用问好拼接 name.encode('gb231 ...

  5. Linux入门学习

    什么是Linux? Linux是一个操作系统软件.和Windows不同的是,Linux是一套开放源代码程序的.并可以自由传播的类Unix操作系统,它是一个支持多用户.多任务.多线程和多CPU的操作系统 ...

  6. 【HiJ1m】在NOIP2017前写过的有用的东西汇总

    http://www.cnblogs.com/Elfish/p/7544623.html 高级树状数组 http://www.cnblogs.com/Elfish/p/7554420.html BST ...

  7. [读书笔记] R语言实战 (三) 图形初阶

    创建图形,保存图形,修改特征:标题,坐标轴,标签,颜色,线条,符号,文本标注. 1. 一个简单的例子 #输出到图形到pdf文件 pdf("mygrapg.pdf") attach( ...

  8. Swoole WebSoctet 使用 zlib 压缩之 PHP 与 pako.js

    一些理论知识 先说一下deflate算法吧,deflate是zip压缩文件的默认算法, 其实deflate现在不光用在zip文件中, 在7z, xz等其他的压缩文件中都用, 实际上deflate只是一 ...

  9. LeetCode 11. Container With Most Water 单调队列

    题意 Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai ...

  10. Qt之窗体透明

    简述 关于窗体透明,经常遇到,下面我们针对常用的透明效果进行讲解: 全透明(主窗体.子窗体均透明) 主窗体透明(子窗体不透明) 子窗体透明(主窗体不透明) 简述 正常状态 全透明 效果 源码 主窗体透 ...