CodePudding user response:
For help, you great spirit is a small lifeCodePudding user response:
X is the critical resource, each process add a protection lockCodePudding user response:
I the most headache is multithreaded, but, according to common sense, a variable two processes used at the same time, you make me once, what it must, I think it is a problem for certain,CodePudding user response:
1, the concurrent execution of process, can be performed at the same time, no problem!2, the concurrent execution of thread, can also be performed at the same time, is x may be random
CodePudding user response:
First question is whether correct, shows that it is impossible to perform correctly (in the case of parallel execution),Correct word is critical resources, thread lock,
CodePudding user response:
Is upstairs said several, x has a problem, cannot obtain reliable resultsCodePudding user response:
The answer is obviously not, because at the same time use the public variables X, (in the case of abnormal queuing system error) such as execution of public variables X into the lock, when operating P1 to X, P2 unable to X, if not to lock the X when the execution, P1, P2 value assigned to X will influence each other, the inside of the solution is to change the X to local variables, or add a X1 P2 use,And, of course, so long didn't knot stick, estimate answered also useless,