Share
Explore BrainMass

Threads

C program that creates three pthreads, each of which executes a different slave process.

The first slave prompts the user for two integers x and n and the uses a loop to calculate xn and outputs the result.

The second slave outputs the phrase "Hello from slave 2" ten times inside the nested for loops

For(I=0; i<10; i++)
{for(j=0; j<10000; j++)
x++;
printf("Hello from slave 2n");
}

The third slave prompts the user for an integer n and uses a loop to calculate n!. It repeates this action 10 times. Each slave should identify itself in each output statement.

$2.19