concurrency - Concurrent programming and nondeterminism -


first , have declare , not familiar concurrent / parallel programming, job web(php) developer, interested on such topic.

i reading "seven concurrency models in 7 weeks" @ moment.

on chapter one, author stated:

this unfortunate because concurrent programs nondeterministic — give different results depending on precise timing of events. if you’re working on genuinely concurrent problem, nondeterminism natural , expected.

i not understand why concurrent programs non-dererministic in natural? can 1 give me concrete real live example?

also , "a genuinely concurrent problem"? non-genuinely concurrent problem.

by way, beginner book concurrent/parallel book? not math/cs guru, , please suggest book coding examples, not full pages of theories , math formulas.

i can read java/c code

genuinely concurrent problems involve interactions real world (which made of sorts of different things, happening concurrently, shouldn't surprising).

here's real-world example of unavoidable nondeterminism: imagine have $100 in bank account, , 2 different companies try charge debit card @ same time, 1 trying take $90, other $80.

depending on exact details of happens within bank's computers, 1 of these transactions "win" , other rejected. might end $10 left in account, or might end $20. both these outcomes "correct" can't predict in advance you'll (and if same thing again, might different result).

non-genuinely concurrent problems result our attempts parallelise should deterministic process (incidentally, why it's helpful understand difference between concurrency , parallelism). 1 example book summing numbers between 0 , 10000000. answer should always 49999995000000. if use concurrent tools (such threads , locks) create parallel implementation of problem, , don't our synchronisation exactly right, might end code (wrongly) behaves non-deterministically.


Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -