Question: Thread Function The general flow of the findEvilNumbersCnt 1 ( ) and findEvilNumbersCnt 2 ( ) thread functions is as follows: Obtain the next block

Thread Function
The general flow of the findEvilNumbersCnt1() and findEvilNumbersCnt2() thread functions is as
follows:
Obtain the next block of numbers to check (via global variable, currentIndex)
increment the global counter by the block size
must be performed within a critical section (i.e., locked and unlocked)
While the next current number in the block is userLimit (globally available);
Check if the number is a Evil/Odious number
If the number is a Evil number, increment a local Evil number count
If the number is a Odious number, increment a local Odious number count
Update evil/odious count (as described below)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!