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.

void pend (int ps) void post (int ps) pend post Context Switch yes no PSE PS-1 return return

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

0 0
Add a comment Improve this question Transcribed image text
Answer #1

void pend(int *pS)

{

while(!*pS <=0)

{

*pS=*pS-1;

}

}

void post(int *pS)

{

*pS=*pS+1;

}

Add a comment
Know the answer?
Add Answer to:
Consider the simple flowcharts below for pend and post functions for use with a cooperative multitasking...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • How to write the insert, search, and remove functions for this hash table program? I'm stuck......

    How to write the insert, search, and remove functions for this hash table program? I'm stuck... This program is written in C++ Hash Tables Hash Table Header File Copy and paste the following code into a header file named HashTable.h Please do not alter this file in any way or you may not receive credit for this lab For this lab, you will implement each of the hash table functions whose prototypes are in HashTable.h. Write these functions in a...

  • LANGUAGE IS C++ Lab Ch14 Recursion In this lab, you are provided with startup code which...

    LANGUAGE IS C++ Lab Ch14 Recursion In this lab, you are provided with startup code which has six working functions that use looping (for, while, or do loops) to repeat the same set of statements multiple times. You will create six equivalent functions that use recursion instead of looping. Although looping and recursion can be interchanged, for many problems, recursion is easier and more elegant. Like loops, recursion must ALWAYS contain a condition; otherwise, you have an infinite recursion (or...

  • I've posted 3 classes after the instruction that were given at start You will implement and...

    I've posted 3 classes after the instruction that were given at start You will implement and test a PriorityQueue class, where the items of the priority queue are stored on a linked list. The material from Ch1 ~ 8 of the textbook can help you tremendously. You can get a lot of good information about implementing this assignment from chapter 8. There are couple notes about this assignment. 1. Using structure Node with a pointer point to Node structure to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT