Problem (Description)

Four researchers want to execute a series of calculations for their research. However, their systems have processors which are very fast for only specific calculations. For example, W’s computer executes addition fast but is slower when it comes to multiplications. These are the constraints:

1)W’s computer can only do addition fast

2)X’s computer can only do subtraction fast

3)Y’s computer can only do multiplication fast

4)Z’s computer can only do division fast

Therefore there is a need to create a distributed system that will utilize the optimized hardware in each computer and execute a series of calculations in the shortest possible time.

Each unique calculation takes 1 seconds to execute.

Rules

During the execution a process can only take care of the calculations that it specializes and must obtain help from other processes for other calculations. Simple mathematical rules of priority must be utilized to ensure correctness of calculations.

Solution

You can download the source code from here

And the problem report, where i explain every line of the code here

Part of the report is in Greek language, but you will find it easy to understand my code.

Remember

and then we run one by one the clients (client1.c, client2.c, client3.c and client4.c)

## 2 comments:

can i use more than 4 clients in your code?

yes you can, just make one copy of a client (e.g client1.c) and rename it as clientx.c, where x is the client number. The only thing you have to change in the code is the the id of the client

Post a Comment