Cω - Samples

Santa Sample

The Santa Claus problem is originally due to Trono and has been used by Ben-Ari in a comparison of the concurrency mechanisms of Ada and Java. This sample shows how the concurrency mechanisms of Cω may be used to solve the problem simply and neatly.

The problem may be stated as follows:

Santa repeatedly sleeps until wakened by either all of his nine reindeer, back from their holidays, or by a group of three of his ten elves. If awakened by the reindeer, he harnesses each of them to his sleigh, delivers toys with them and finally unharnesses them (allowing them to go off on holiday). If awakened by a group of elves, he shows each of the group into his study, consults with them on toy R&D and finally shows them each out (allowing them to go back to work). Santa should give priority to the reindeer in the case that there is both a group of elves and a group of reindeer waiting.
More details about the problem may be found in More information about the Cω solution may be found in

Sample Files

Files for the Santa sample are located in the \samples\Concurrency\Santa subdirectory under the path where you installed Cω, which by default is C:\Program Files\Microsoft\Comega.

To run this sample, load the santa.cwproj project in Visual Studio and press F5.