Posts

Showing posts from July, 2017

An Ada Publish-Subscribe Producer-Consumer Exercise

There are many ways to express the classic producer-consumer problem in Ada. Following is a problem which illustrates some of the interesting features of Ada protected objects. Problem Statement This producer-consumer problem has several requirements: ·          There shall be one producer and many consumers. ·          The number of consumers shall be established at run-time through user input. ·          The producer shall produce a series of random floating point numbers ·          All consumers shall read each number produced by the producer exactly once. ·          The producer shall not know the number of consumers The requirement that the producer shall not know the number of consumers prohibits the use of the Ada Rendezvous mechanism for direct communication betw...