179k views
5 votes
You may use any of the following: Decision, Merge, Fork, Join, Action, Object and any other nodes.

(i) You have green, red and blue marbles in a single box. The marbles are sorted in the following way by color. One marble is picked at a time from this box, the color of the marble is checked and placed in a green box if it is green, blue box if it is blue and red box if it is red. This process continues until all marbles have been placed in the respective boxes. The marbles are picked in sequence one after another.
After this step, the marbles in each box are counted and each box is labeled with the color and count. This task is done in parallel for each of the boxes.
The three boxes are then placed in the garage. Assume placing the sorted boxes in the garage is a single task. (Note, the counting is NOT done while sorting the colors).
(ii).Modify the counting to happen while picking each color marble from the single box and provide a different version of the original diagram as well.
(iii) What do you propose to do if three people can pick one marble each simultaneously from the initial single box? Only provide an answer to this problem. No diagram is required.

User Kavinda
by
8.0k points

1 Answer

1 vote

Final answer:

In this scenario, marbles are sorted based on color into different boxes. To make the counting happen while picking marbles, a fork node can be used. If three people pick marbles simultaneously, a join node can be used to synchronize their actions.

Step-by-step explanation:

In this scenario, the marbles are being sorted based on their color into three separate boxes - green, blue, and red. The marbles are picked one at a time and placed in the respective boxes until all marbles have been sorted. After sorting, the marbles in each box are counted and labeled accordingly. This process is done for each box in parallel.

To modify the counting to happen while picking each color marble from the single box, we can use a fork node. A fork node allows us to perform multiple actions simultaneously. In this case, one branch of the fork node will continue the process of picking marbles and sorting them into boxes, while the other branch will count the marbles and label the boxes. This will save time and make the process more efficient.

If three people can pick one marble each simultaneously from the initial single box, we can use a join node to synchronize their actions. A join node allows multiple branches to converge into one. Each person will pick one marble and place it in the respective box simultaneously. Once all three marbles have been picked, the join node will synchronize the actions and continue with the next step of counting and labeling the boxes.

User Arturo Sbr
by
8.6k points