Question: this is a C program, please note the question says You * have * to implement condition variable to obtain this output. Not using Semaphores.

this is a C program, please note the question says "You *have* to implement condition variable to obtain this output". Not using Semaphores.
Assume you have two threads; ThreadA and ThreadB. ThreadA prints "HELLO"
ten times and ThreadB prints "WORLD" ten times.
Write a C code to create these two threads such that the output of your code must be
as follows:
You have to implement condition variable to obtain this output. It's your choice to
select an appropriate predicate variable. You can follow this hint.
Hint:
Declare a variable named turn of type character. Initially this variable has the value 'A'.
Then, ThreadA prints "HELLO" only if the content of the variable turn is 'A'. Similarly,
ThreadB prints "WORLD" only if the content of the variable turn is 'B'.
Use only one condition varaible.
 this is a C program, please note the question says "You

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!