c - What are the benefits of using wait() and signal()? -


this question has answer here:

why should use wait() , signal() operation in multithreading applications?

i'm relatively new multithreading , understand mutual exclusion need better understanding of how wait() , signal() come equation.

it seems i'm achieving thread safety using lock() , unlock(). wrong?

can give me example of wait/signal being used , wait , signal not being used lock/unlock? benefits using wait/signal on lock/unlock?

thanks.

i work computational maths/science examples come there.

if doing reduce operation such dot product (need sum many calculations) lock , unlock useful order of sum not matter , if it's free thread should go it.

if solving pde on time before can take next time step previous time step needs completed, lock/unlock wouldn't work if data free modification prerequisite calculations may not have been done, use wait/signal.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -