Purchase Solution

Thread Synchronization

Not what you're looking for?

Ask Custom Question

C program that runs under cygwin which again declares three pthreads. The main program prompts the user for the values x, y, z all integers.

It then starts the threads. Thread1 calculates the average of x, y and z and puts the value into a shared variable w.

Thread2 calculates the product and puts the value into v.

Thread3 finds the largest value and puts the value into u. Each thread waits for the other threads to finish writing using a join statement.

Then threard1 computes the sum of u,v and w and puts the result into x.

Thread2 computes the product and puts it in y. Thread3 computes the largest value and puts it in z.

The main program waits for each thread to complete and outputs x, y and z.

Purchase this Solution

Solution Summary

Thread Synchronization is noted.

Purchase this Solution


Free BrainMass Quizzes
Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

C++ Operators

This quiz tests a student's knowledge about C++ operators.

Javscript Basics

Quiz on basics of javascript programming language.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

C# variables and classes

This quiz contains questions about C# classes and variables.