Find Jobs
Hire Freelancers

Write some Software -- 2

$10-30 USD

已关闭
已发布超过 9 年前

$10-30 USD

货到付款
Computation of prime numbers on Master/Slaves architecture One method to determine prime numbers in a given interval is to divide the search space into several subintervals and to assign the search task in each subinterval to a process created by the father process. Thus, if we divide the interval [1, N] into p subintervals, the father process creates p children and each child k searches in the interval [k*N/p + 1, (k+1) N/p], k = 0,…, p – 1. This technique can be used on parallel machines composed of p processers where each subinterval is assigned to one of the p processors. Parallel computation allows us to reduce the execution time. However, this technique has the drawback of assigning unbalanced computation load to the different processes. Thus, process 0 finishes the search on its assigned [1, N/p] interval, earlier than the process p-1. Therefore, this technique does not allow us to benefit from the parallelism in an optimal way. One solution (that you should implement) to balance the load of different processes is to create a pool of p processes and to assign successively small intervals of size T <<N/p to the processes. When a child process finishes it assigned task, the father assign to it a new interval not yet explored. Solution hints · The master is the father process and the p slaves are the children processes. · The father process uses p pipes to communicate with its children. However, all the children processes use the same tube to communicate with the father process. · The communication protocol is the following: o Father -> child: two integers representing the interval o Child -> father: each found prime number in its assigned interval (0 is sent to inform the father that the child has finished). The child precedes each sent prime number by its identifier. · When the whole interval is checked, the father kills all slaves using signals. · The interval and the number of slaves are passed to the father process as command-line arguments.
项目 ID: 7004637

关于此项目

远程项目
活跃9 年前

想赚点钱吗?

在Freelancer上竞价的好处

设定您的预算和时间范围
为您的工作获得报酬
简要概述您的提案
免费注册和竞标工作

关于客户

LEBANON的国旗
Beirut, Lebanon
5.0
2
会员自1月 20, 2015起

客户认证

谢谢!我们已通过电子邮件向您发送了索取免费积分的链接。
发送电子邮件时出现问题。请再试一次。
已注册用户 发布工作总数
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
加载预览
授予地理位置权限。
您的登录会话已过期而且您已经登出,请再次登录。