Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Task Management (Cont’d)<br />
• Task Stack<br />
Task Stack , <strong>OS</strong>_STK <br />
.<br />
Stack ( ) ()<br />
.<br />
static <strong>OS</strong>_STK MyTaskStack[stack_size];<br />
<strong>OS</strong>_STK MyTaskStack[stack_size];<br />
Static Stack<br />
<strong>OS</strong>_STK *pstk;pstk = (<strong>OS</strong>_STK *)malloc(stack_size);<br />
if (pstk != (<strong>OS</strong>_STK *)0) { /* Make sure malloc() has enough space */<br />
Create the task;<br />
}<br />
Using malloc() to allocate stack space for a task<br />
Embedded System Lab. <strong>II</strong> 42