161115-SafeConcurrencyGuidelines.pdf

If standard libraries are so good then why learn

Info icon This preview shows pages 10–11. Sign up to view the full content.

If standard libraries are so good, then why learn about concurrent programming at all? For the same reason that educated computer engineers and scientists need a basic un- derstanding of sequential data structures in order to pick the right ones and use them correctly (e.g., designing a good hash function), concurrent programmers need to un- derstand how to debug and performance tune their use of libraries (e.g., to avoid con- tention). Moreover, standard libraries do not typically handle all the necessary synchronization for an application. For example, ConcurrentHashMap does not support atomically re- CPEN 221 – Fall 2016
Image of page 10

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Guidelines for Safe Concurrent Programming 11 moving one element and inserting two others. If your application needs to do that, then you will need to implement your own locking protocol to synchronize access to a shared data structure. Understanding race conditions is crucial. While the examples in these notes consider race conditions on simple data structures like stacks, larger appli- cations using standard libraries for concurrent data structures will still often have bad interleavings at higher levels of abstraction. 3 Summary In this reading, we discussed some guidelines for writing robust concurrent programs. Reasoning about concurrency is challenging and these guidelines help us, partially, in developing software that is safe from bugs . Some aspects of these guidelines are also about conventions, which makes concurrent programs easy to understand (or at least, as easy as possible). Lastly, thinking about these guidelines carefully can help in soft- ware that is ready for change . CPEN 221 – Fall 2016
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.
  • Fall '17
  • satish
  • Concurrent computing, Safe Concurrent Programming

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern