A server task has the following Ada specification:
task Server is
entry Service_A;
entry Service_B;
entry Service_c;
end Server;
Write the body of the Server task so that it performs all of the following operations.
- If client tasks are waiting on all the entries, the task should service the clients in a cyclic order; that is, accept first a Service_A entry, and then a Service_B entry, and then a Service_C entry, and then a Service_A entry and so on.
- If not all entries have a client task waiting, the Server should service the other entries in a cyclic order. The server tasks should not be blocked if there are clients still waiting for a service.
- If the Server task has no waiting clients then it should NOT busy-wait; it should block waiting for a client's request to be made.
- If all the possible clients have terminated, the Server should terminate.
Assume that client tasks are not aborted and issue simple entry calls only.