Question: Q.No.5 Write a C# complete class named SynchDemo which will have four(04) functions, named FuncA(), FuncB(), FuncC(), FuncD(). Each function will have a for loop
Q.No.5 Write a C# complete class named SynchDemo which will have four(04) functions, named FuncA(), FuncB(), FuncC(), FuncD(). Each function will have a for loop of 100 iterations and each iteration takes 02 seconds to complete. You need to create an object of the class SynchDemo in Main and call each function in a separate thread immediately. Following are details for each function and their synchronization using signaling. [10 marks]
I. FuncA() will print integer values from 1 100 using for loop, during its half way (i.e. 50th iteration) it will send signal to FuncB() to proceed. Then at 70th iteration, it will send another signal to FuncC() to prceed.
II. FuncB() will wait for FuncA()s singal, and print integer values from 101 200 using for loop, once singal is received.
III. FuncC() will also wait for FuncA()s signal, and print integer values from 201 300 using for loop, once signal is received. FuncC() will send signal to FuncD() at 10th iteration.
IV. FuncD() will wait for FuncC()s signal, and print integer values from 301 400 using for loop, once signal is received.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
