[erlang-questions] Imagine every (active) entity is a process

Doug Edmunds dougedmunds@REDACTED
Mon Nov 5 21:30:22 CET 2007

I put together a little example called
Shopper meets Bagboy3
which starts about midway down on:

There, each 'shopper' is a process. The
shopper adds to the shopping cart, then
when ready to checkout, the one and only 'bagboy' process is
called.  Bagboy 'talks'. (Mainly what the bagboy does is put
a max of 2 things in each bag, so if a shopper has
7 items, there are 4 bags).

As designed there is only one bagboy process, but
there could be a pool of rotating bagboys, so if
the first was 'busy' the next would be called.

I'll leave it to someone else to figure out if the
bagboy could possibly put a shopper's
items in another shopper's bags if the
shoppers were in a checkout 'race'.

Just food for thought.... (pun intended)

More information about the erlang-questions mailing list