Question: Solve the following three problems using Java with Akka Actors. Read the submission instructions carefully. Problem 3 (50 Points): Sorting. It is possible to sort

Solve the following three problems using "Java with Akka Actors". Read the submission instructions carefully.

Problem 3 (50 Points): Sorting. It is possible to sort a number of values using a pipeline of filter actors, each responsible for one value: the first actor picks the smallest values, the second, the second smallest and so on. Particularly, the first actor receives all the values, one by one. If there are more than one values received by an actor, it creates another actor; it keeps the smallest value received so far for itself, and sends all other values forward to the other actor. Each filter actor does the same thing.

Assume that each filter actor has local storage for only two values: to receive the next incoming value and to keep the minimum value received thus far.

A sentinel is used to indicate the end of the values to be sorted. The sentinel is then sent down the pipeline to inform all actors of the end of the input. On receiving the sentinel, each filter actor replies to the sender of the sentinel with its smallest value. All actors simply forward back the values they receive from actors down the pipeline from them, so that the first actor receives all the values in a sorted order, and sends them forward to the original requester, one value at a time.

Develop actor code to implement this for sorting positive integers. Use 0 to indicate the end of the values to be sorted.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!