example

Observer pattern

tags:

Description

The Observer pattern example should be considered a work in progress. During the development of SCOOP for EiffelStudio, Eiffel Software engineers began to think in terms of the impact that SCOOP might have on our own software. One area that emerged was the parsing of Eiffel software text during compilation. You know that Eiffel systems are composed of modules called classes. In a non-concurrent compilation process, the classes are parsed one after another. However, there is no reason why parsing could not take place on multiple, concurrently executing SCOOP processors.

Counter

tags:

Description

Unlike many of the other examples, this one is not really a problem to be solved. Rather, the Counter example uses multiple instances of the simple class COUNTER to explore various concurrent scenarios. Each instance of COUNTER has a unique identifier, a current value, and a speed. A counter's speed is that time that it takes to perform a single increment. You will see that some of the tests start multiple counters at different speeds.

Faneuil Hall

tags:

Description

The Faneuil Hall example is one of several examples that comes to us from Allen Downey's book The Little Book of Semaphores. Downey credits Grant Hutchins as the originator of the example. Faneuil Hall itself is an historic building in Boston which dates from 1742 an has served as a public meeting and market place.

Quicksort

tags:

Description

The quicksort example is a concurrent implementation of the well-known quicksort sorting algorithm developed by computer scientist C. A. R. Hoare. Quicksort uses a "divide and conquer" strategy to sort a structure. It applies a basic algorithm to the structure which leads to a division of the elements into to two substructures. Then it applies the same algorithm to each of the substructures, and so on, until the whole structure is sorted.

Senate bus

tags:

Description

According to Allen Downey in his text The Little Book of Semaphores, the Senate bus example was inspired by the Senate Bus at Wellesley College. Passengers come to a bus stop to catch the Senate bus. The bus can hold 50 passengers. When the bus stops at the bus stop, the waiting passengers board. If the bus fills up, then any passengers who cannot board, must wait until the bus shows up again.

Search-insert-delete

tags:

Description

The Search-insert-delete example involves a shared data structure that is being accessed concurrently by three types of independent actors. Searchers access the list without changing it. So, any number of concurrent searchers can be accessing the structure safely. Inserters have the ability to add new elements to the end of the structure. Only one inserter can access the structure at any given time, but can work concurrently with any number of searchers. Lastly, Deleters can remove items from any position in the structure.

Barbershop

tags:

Description

The barbershop, sometimes called the sleeping barber, models a barbershop with one barber, one barber's chair, and a waiting room with several chairs. The alternative name of the problem comes from the fact that if there is no one waiting for a haircut, the barber flops in his chair and falls asleep.

Also involved are a number of shaggy-haired customers. A customer entering the barbershop looks around and assesses the situation.

Dining savages

tags:

Description

The problem of the dining savages (an allusion to the classic dining philosophers) is based on the arguably tasteless analogy of a number of members of a primitive culture, hereinafter called the "savages", sharing a meal from a single pot. The primary abstractions are the savages themselves, a cook, and the pot. The pot contains a certain number of servings of savage sustenance (the nature of which will be left to your imagination). Each of the savages can freely remove a serving from the pot so long as the pot is not empty.

Dining philosophers

tags:

Description

In the dining philosophers a number of philosophers (five, in our example) are seated at a round table. On the table are five plates of food, one in front of each philosopher, and five forks, one between each adjacent pair of plates. So each philosopher has a plate in front of him and a fork to his left and a fork to his right.

The philosophers spend all their time in either of only two states: they are thinking or they are eating.

Producer-consumer

tags:

Description

The producer-consumer problem is a classic software concurrency problem. The problem features one or more "producers" and one or more "consumers". All producers and consumers must share access to a "buffer" into which producers insert the products they produce, and from which consumers take the products they consume. The shared buffer is "bounded", that is, it has a maximum capacity.

So at any time, the buffer could be empty, precluding any consumer from withdrawing a product.

Syndicate content