Practice meeting, August 5th

3 views
Skip to first unread message

Lyle Kopnicky

unread,
Jul 31, 2019, 1:29:03 AM7/31/19
to pdxfunc
When: Monday, August 5th, 6:30-8:30pm

Where: Collective Agency Downtown, Suite 1108, 511 SW 10th Ave, Portland, OR (opposite side of the floor from the elevators)

We'll continue with Chapter 10, "Software Transactional Memory", of Parallel and Concurrent Programming in Haskell, beginning with the section "Implementing Channels with STM" on page 184. Please read it beforehand. You may wish to try running the code examples from the book. At the meeting anyone will be able to present and contribute to the discussion.

Meetup link to RSVP:
https://www.meetup.com/Portland-Functional-Programming-Study-Group/events/qdhvfryzlbhb/

Hope to see you then!

Lyle Kopnicky

unread,
Aug 6, 2019, 12:34:44 AM8/6/19
to pdxfunc
Great meeting tonight! We finished up Chapter 10 on "Software Transactional Memory". We learned that:
  • Building channels using STM is a lot easier than building them out of MVars
  • Most of the time, MVars are more efficient than TVars, but sometimes STM can be more efficient, if it allows you to use simpler data structures (e.g. using plain lists in a queue)
  • STM gives us easy composability, and exceptions are simple to deal with
  • But STM doesn't give us the fairness guarantees that MVars do
  • We can't use a TVar to store any data that needs to persist even if the transaction is restarted
  • Long-running transactions can be both inefficient (due to readTVar taking time linear in the length of the log), and likely to be restarted because shorter transactions will finish first
And we learned how STM is implemented, how the transaction log works, and what causes transactions to restart.

Next time we'll do some exercises related to STM! I'll write about that in the announcement for the next meeting.

- Lyle
Reply all
Reply to author
Forward
0 new messages