I bought the book and read through the chapter on Java threads, it mentioned several issues with the traditional threading model. The obvious one was deadlock. One thing that surprised me was how the JVM would reorder certain instructions.
On page 13, the bottom code under mysterious memory. The ordering of line 6 and 7, the JVM may optimize. I tried running that code and could not reproduce it. Does anyone have an example that can reproduce that issue? If what the book says is true, it is really hard to know where to synchronize. On Tuesday, June 14, 2016 at 7:13:07 PM UTC-7, Pedro Medeiros wrote: > > Well I can say that there's a book about that. :D > > https://pragprog.com/book/pb7con/seven-concurrency-models-in-seven-weeks > > It starts using some Java examples and goes deep in other types of > concurrency model. Also there's some talks about it from the elixir > meetups. To summarize things, when you are dealing with threads you are > also dealing with mutable shared data that can be modified in one thread > and affect the other one. When dealing with erlang process (actor > concurrency model) there's no shared data and also there's no need for lock > some variable or code execution. > > There's this old talk about the subject that started to open my mind about > concurrency. > > https://www.youtube.com/watch?v=4o89mWFL-2A > > On Fri, Jun 10, 2016 at 10:01 PM, Peter Hamilton <[email protected] > <javascript:>> wrote: > >> There are two things at play here. One is functional programming and the >> other is the concurrency model. >> >> For functional programming, here are some interview questions I've >> personally gotten that are much simpler with Elixir. >> https://gist.github.com/hamiltop/3013ab0f9d886b813283#file-funprog-ex >> >> For the concurrency model, it's hard to compare. Sometimes its a lot like >> using threads, except your system can trivially create half a million of >> them. Other times it's wildly different and your architecture and design >> reflect that. >> >> On Fri, Jun 10, 2016, 4:20 PM Michael Ni <[email protected] >> <javascript:>> wrote: >> >>> Does anyone have a simple example demonstrating Elixir's functional >>> programming's benefits over a more traditional imperative threaded approach >>> like Java? >>> >>> I'm looking for the same logic but shown in both, lets say, Elixir and >>> Java to cross compare. >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "elixir-lang-talk" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected] <javascript:>. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/elixir-lang-talk/d3fd8aa3-cc43-46e3-85b8-ce10c7a3de8e%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/elixir-lang-talk/d3fd8aa3-cc43-46e3-85b8-ce10c7a3de8e%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "elixir-lang-talk" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/elixir-lang-talk/CAOMhEnwEi50jhFkAQMWJ6BNMzO%3D-02OK3stEvKLrQCPEWJrgVQ%40mail.gmail.com >> >> <https://groups.google.com/d/msgid/elixir-lang-talk/CAOMhEnwEi50jhFkAQMWJ6BNMzO%3D-02OK3stEvKLrQCPEWJrgVQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Pedro Henrique de Souza Medeiros > ---------------------------------- > Cel: +55 (61) 9197-0993 > Email: [email protected] <javascript:> > > Beautiful is better than ugly, > Explicit is better than implicit, > Simple is better than complex, > Complex is better than complicated. > > The Zen of Python, by Tim Peters > -- You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/f782660b-2cdf-4044-8dd4-75c9c4ed7b34%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
