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;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.