You're code locks too much.
The entire prime_process function is faulty. There's no way that each number in the sequence should be treated as a separate "job." Those jobs are delegated out to separate processes using mutexes for locking. prime_process is called to loop through all i less than the current job. Then, more mutexes are used to report the results back to the main process.
For HALF of the numbers, the entire calculation consists of
1) lock mutex
2) get "job" (variable n)
3) unlock mutex
4) if n%2 == 0, not prime
5) lock mutex
6) report not prime
7) unlock mutex
Half of all numbers are divisible by 2. As you deal with odd numbers, step 4 repeats, but come on. In a majority of cases, you are getting/releasing two separate mutexes in order to perform one operation! Code like that can't scale; I'm surprised that you're seeing the results that you are.
You should divide up all of the jobs to the processes during startup. That way, each process has all of it's jobs at the start. Then, you only need one mutex at the very end to report the status of all jobs.
Edit:
Why are you even bothering to check the prime numbers? This entire program is just a locking performance test. It would be interesting to modify your code to not calculate anything. Just do the mutex operations.