A broadcast is similar to a multicast except that ALL intended recipients must receive the data. A package specification for the Broadcast abstraction is given below:
package Broadcast is
-- for 10 tasks
procedure Send (I : Integer);
procedure Receive(I : out Integer);
end Broadcast;
Consider, for example, a system with 10 recipient tasks. These tasks all call the Receive procedure when they are ready to receive the broadcast. The tasks are blocked by this call. A sender task indicates that it wishes to broadcast data by calling the Send procedure. The Send procedure waits until all ten tasks are ready to receive the broadcast before releasing the recipients and passing the data. If more than one call to Send occurs, then they are queued.
Show how the body of the Broadcast package can be implemented using the semaphore package given in Exercise 5.18.