How to "share state" with Erlang Style Concurrency?

Erlang works with passing messages between participants as a concurrency model.

Suppose I have 3 actors who sell items . The total number of items is 7. How do they sell 7 items ? How do they coordinate themselves? We can have one actor with the number of available items, acting on the message "buy" (actor inventory). It will be SPOF , though.

The same applies to concurrency in other languages, such as Java, when using message queues for concurrency instead of locks.

(Best without Amdahl bottleneck )

+3
source share
3 answers

You have a process that is a thing - in this case inventory. When other processes want to buy, they ask for inventory, do you have one? can i buy it?

The process representing the delivery will tell the inventory, here are 20 new things ...

+3
source

, , . dets Mnesia backend. , , , . - 3 , , - , , . , , , , .

+2

? 7 , 7 . , .

+1

Source: https://habr.com/ru/post/1705187/


All Articles