TCB是什么?

yangfancs 2010-08-13 10:57:50
TCB是什么?看到描写他的数据结构是WIND_TCB ,具体是怎样的类型呢?获得TCB能对task进行什么操作呢?
...全文
2814 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
l830603lq 2011-08-05
  • 打赏
  • 举报
回复
CSdn上说,在组策略里面可以添加tcb权限,怎么添加啊?
yangfancs 2010-08-20
  • 打赏
  • 举报
回复
多谢各位回答!
zhangyinxun 2010-08-15
  • 打赏
  • 举报
回复
任务控制块
murhpy 2010-08-15
  • 打赏
  • 举报
回复
TCB是任务控制块,相当于每个任务的信息都保存在这个结构中,这样在任务切换时,这个任务的信息就可以保存在任务上下文中。
有些操作(如taskInit)需要TCB地址做参数,参看手册。
需要TCB地址时可以通过taskTcb从taskID获取TCB地址,参看手册。
WIND_TCB的具体数据结构定义在taskLib.h中有定义,是:
typedef struct windTcb /* WIND_TCB - task control block */
{
Q_NODE qNode; /* 0x00: multiway q node: rdy/pend q */
Q_NODE tickNode; /* 0x10: multiway q node: tick q */
Q_NODE activeNode; /* 0x20: multiway q node: active q */

OBJ_CORE objCore; /* 0x30: object management */
char * name; /* 0x34: pointer to task name */
int options; /* 0x38: task option bits */
UINT status; /* 0x3c: status of task */
UINT priority; /* 0x40: task's current priority */
UINT priNormal; /* 0x44: task's normal priority */
UINT priMutexCnt; /* 0x48: nested priority mutex owned */
struct semaphore * pPriMutex; /* 0x4c: pointer to inheritance mutex */

UINT lockCnt; /* 0x50: preemption lock count */
UINT tslice; /* 0x54: current count of time slice */

UINT16 swapInMask; /* 0x58: task's switch in hooks */
UINT16 swapOutMask; /* 0x5a: task's switch out hooks */

Q_HEAD * pPendQ; /* 0x5c: q head pended on (if any) */

UINT safeCnt; /* 0x60: safe-from-delete count */
Q_HEAD safetyQHead; /* 0x64: safe-from-delete q head */

FUNCPTR entry; /* 0x74: entry point of task */

char * pStackBase; /* 0x78: points to bottom of stack */
char * pStackLimit; /* 0x7c: points to stack limit */
char * pStackEnd; /* 0x80: points to init stack limit */

int errorStatus; /* 0x84: most recent task error */
int exitCode; /* 0x88: error passed to exit () */

struct sigtcb * pSignalInfo; /* 0x8c: ptr to signal info for task */
struct selContext * pSelectContext; /* 0x90: ptr to select info for task */

UINT taskTicks; /* 0x94: total number of ticks */
UINT taskIncTicks; /* 0x98: number of ticks in slice */

struct taskVar * pTaskVar; /* 0x9c: ptr to task variable list */
struct rpcModList * pRPCModList; /* 0xa0: ptr to rpc module statics */
struct fpContext * pFpContext; /* 0xa4: fpoint coprocessor context */

struct __sFILE * taskStdFp[3]; /* 0xa8: stdin,stdout,stderr fps */
int taskStd[3]; /* 0xb4: stdin,stdout,stderr fds */

char ** ppEnviron; /* 0xc0: environment var table */
int envTblSize; /* 0xc4: number of slots in table */
int nEnvVarEntries; /* 0xc8: num env vars used */
struct sm_obj_tcb * pSmObjTcb; /* 0xcc: shared mem object TCB */
int windxLock; /* 0xd0: lock for windX */
void * pComLocal; /* 0xd4: COM task-local storage ptr */
REG_SET * pExcRegSet; /* 0xd8: exception regSet ptr or NULL */
EVENTS events; /* 0xdc: event info for the task */
WDB_INFO * pWdbInfo; /* 0xe8: ptr to WDB info - future use */
void * pPthread; /* 0xec: ptr to pthread data structs */
int reserved1; /* 0xf0: possible WRS extension */
int compiler1; /* 0xf4: compiler reserved extension */
int spare1; /* 0xf8: possible user extension */
int spare2; /* 0xfc: possible user extension */
int spare3; /* 0x100: possible user extension */
int spare4; /* 0x104: possible user extension */

/* ARCHITECTURE DEPENDENT */

#if (CPU_FAMILY==MC680X0)
EXC_INFO excInfo; /* 0x108: exception info */

/* REG_SET must be aligned on a 4 byte boundary */

REG_SET regs; /* 0x11c: register set */
UINT16 foroff; /* 0x164: format/offset from frame */
UINT16 pad2; /* 0x? : pad format/offset to UINT */
#endif /* CPU_FAMILY==MC680X0 */

#if (CPU_FAMILY==COLDFIRE)
EXC_INFO excInfo; /* 0x108: exception info */
REG_SET regs; /* 0x11c: register set */
#endif /* CPU_FAMILY==COLDFIRE */

#if (CPU_FAMILY==MIPS)
EXC_INFO excInfo; /* 0x108: exception info */

/* REG_SET must be aligned on a ?? byte boundary */

REG_SET regs; /* 0x128: register set */
#endif /* CPU_FAMILY==MIPS */

#if (CPU_FAMILY == PPC)
EXC_INFO excInfo; /* 0x108: exception info */
UINT pCoprocCtx; /* 0x12c: pointer to Coprocessor Ctx */

/* REG_SET must be aligned on a 16 byte boundary */

REG_SET regs; /* 0x130: register set */
#endif /* (CPU_FAMILY == PPC) */

#if (CPU_FAMILY == SPARC)
EXC_INFO excInfo; /* 0x0108: exception info */

/* REG_SET must be aligned on an 8 byte boundary */

UINT regSetPad; /* 0x011c: double-word alignment */
REG_SET regs; /* 0x0120: register set */
#endif /* CPU_FAMILY == SPARC */

#if (CPU_FAMILY==SIMSPARCSUNOS || CPU_FAMILY==SIMSPARCSOLARIS)
EXC_INFO excInfo; /* 0x0108: exception info */

/* REG_SET must be aligned on an 8 byte boundary */

REG_SET regs; /* 0x0128: register set */
#endif /* CPU_FAMILY==SIMSPARCSUNOS || CPU_FAMILY==SIMSPARCSOLARIS*/

#if (CPU_FAMILY==SIMNT)
EXC_INFO excInfo; /* 0x0108: exception info */

/* REG_SET must be aligned on a 4 byte boundary */

REG_SET regs; /* 0x011c: register set */
int args[MAX_TASK_ARGS];
HANDLE windowsThread;
unsigned int windowsThreadId;
CONTEXT windowsContext;
unsigned int windowsContextValid;
#endif /* CPU_FAMILY==SIMNT */

#if (CPU_FAMILY==SIMHPPA)
EXC_INFO excInfo; /* 0x0108: exception info */

/* REG_SET must be aligned on a ?? byte boundary */

REG_SET regs; /* 0x0268: public register set */
#endif /* CPU_FAMILY==SIMHPPA */

#if CPU_FAMILY==I960 /* ARCHITECTURE DEPENDENT */
EXC_INFO excInfo; /* 0x108: exception info */

/* REG_SET must be aligned on a 16 byte boundary */

UINT32 pad0[2]; /* 0x128: pad to align REG_SET */
REG_SET regs; /* 0x130: register set */
UINT32 dbgPCWSave; /* 0x?: PCW saved for debugger */
#if CPU==I960KB
UINT8 intResumptionRec[16];
#endif
#endif /* CPU_FAMILY==I960 */

#if (CPU_FAMILY==I80X86)
EXC_INFO excInfo; /* 0x108: exception info */

/* REG_SET must be aligned on an 8 byte boundary for PENTIUM */

REG_SET regs; /* 0x160: register set */
#endif /* CPU_FAMILY==I80X86 */

#if (CPU_FAMILY==SH)
EXC_INFO excInfo; /* 0x108: exception info */

/* REG_SET must be aligned on a 4 byte boundary */

REG_SET regs; /* 0x11c: register set */
#endif /* CPU_FAMILY==SH */

#if (CPU_FAMILY==ARM)
EXC_INFO excInfo; /* 0x108: exception info */

UINT32 fpStatus; /* 0x118: fp status word */

/* REG_SET must be aligned on a 16 byte boundary */

UINT32 regSetPad; /* 0x11c: register set padding */
REG_SET regs; /* 0x120: register set */
#endif /* CPU_FAMILY==ARM */

struct dspContext * pDspContext; /* dsp coprocessor context */
WDB_INFO wdbInfo; /* target debug info */
} WIND_TCB;
qiaofeng2000 2010-08-14
  • 打赏
  • 举报
回复
TCB(Task Control Block)任务控制块,相当于操作系统的线程控制块。
Heaven_Redsky 2010-08-13
  • 打赏
  • 举报
回复
对于信号量的部分通常是通过在TCB中确定它挂接在那个阻塞队列的队列头来体现
Heaven_Redsky 2010-08-13
  • 打赏
  • 举报
回复
TCB任务描述块。确切的说,一个任务的几乎所有信息都包含在这个数据结构里了。
包括常规的任务名,任务优先级等,还包括类似该任务被阻塞在哪个信号量上等非常规信息。
所有关于该任务的操作都是通过TCB来进行。它就像是一个任务的档案和身份证一样。

2,184

社区成员

发帖
与我相关
我的任务
社区描述
xworks是美国 Wind River System 公司( 以下简称风河公司 ,即 WRS 公司)推出的一个实时操作系统。
社区管理员
  • VxWorks开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧