In this project, we are to design and implement a multithreaded or multiprocessed program to determine if a given number is a perfect number. The objectives of this project are,

computer science

Description

Project : Perfect Number on Multicore Systems

In this project, we are to design and implement a multithreaded or multiprocessed program to

determine if a given number is a perfect number. The objectives of this project are,

• to design and implement multithreaded or multiprocessed programs;

• to gain hands-on experience to speed up computation on multicore systems;

• to identify critical sections in multithreaded or multiprocessed programs;

• and use appropriate synchronization primitives (e.g., mutex locks, semaphores) to coordinate

multiple threads or processes.

1 Project Description

An positive integer N is a perfect number if the sum of all its factors excluding itself is N, where a

factor is a perfect divisor of N. Let’s examine the following examples.

• Given number 6, we know its factors are 1, 2, and 3 excluding itself. Since 1 + 2 + 3 = 6, 6

is a perfect number.

• Given number 28, its factors are 1, 2, 4, 7, and 14 excluding itself, and since 1+2+4+7+14 =

28, 28 is also a perfect number.

• Given number 496, its factors are 1, 2, 4, 8, 16, 31, 62, 124, and 248 excluding itself, and

since 496 = 1 + 2 + 4 + 8 + 16 + 31 + 62 + 124 + 248, 496 is too a perfect number.

• Given number 30, its factors are 1, 2, 3, 5, 6, 10, and 15 excluding itself, since 1 + 2 + 3 +

5 + 6 + 10 + 15 = 426= 30, 30 isn’t a perfect number.

You are to design and implement either a multithreaded or a multiprocessed program to deter-

mine whether a number is a perfect number. Your program must meet the following requirements,

1. The input to the program is an integer, denoted as N. The output of the program is 0 if N is

a perfect number and 1 otherwise. The program will read the number N from the command

line, and the program does not print out the output, instead, it returns to the calling process

with exit code 0, 1, and -1. As indicated, 0 means that the number is a perfect number, 1

otherwise, and -1 if error occurs.


Related Questions in computer science category


Disclaimer
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.