Consider the simple flowcharts below for pend and post functions for use with a
ID: 3815671 • Letter: C
Question
Consider the simple flowcharts below for pend and post functions for use with a cooperative multitasking programs written with cxlib. The operator “<=” is a less than or equal test. The variable pS is a pointer of type int so that *pS refers to the value referenced by pS. Write functions pend and post, the corresponding prototypes are given below.
Consider the issues that could cause a pend function written according to the given flowchart to not be reentrant. Give your answer in a few sentences
void pend (int ps) void post (int ps) pend post Context Switch yes no PSE PS-1 return returnExplanation / Answer
void pend(int *pS)
{
while(!*pS <=0)
{
*pS=*pS-1;
}
}
void post(int *pS)
{
*pS=*pS+1;
}