Skip to main content

Understanding Shared-Variable Concurrency

  • Chapter
Understanding Concurrent Systems

Part of the book series: Texts in Computer Science ((TCS))

  • 2082 Accesses

Abstract

Here we look at shared variables in depth, including a study of dirty variables via the bakery algorithm and Simpson’s 4-slot algorithm (where we propose a version that avoids known difficulties arising from dirty flag variables). We also define what it means for one shared variable program to refine another one, and introduce various ideas necessary to create finite model-checked proofs of programs (such as the bakery algorithm) that involve unbounded integer types.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

eBook
USD 16.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD 54.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    We have already seen one mutual exclusion algorithm, namely the bakery algorithm, in which no location is written by more than one thread. A second is Knuth’s algorithm [77], an implementation of which can be found with the examples accompanying this chapter.

  2. 2.

    In the theory of concurrent algorithms, researchers sometimes consider a parallel machine model in which multiple processors are allowed to make simultaneous writes to the same location, but only if all the written values are the same: a Parallel Random Access Machine with Common Concurrent Writes, see [39].

  3. 3.

    Note that this, and the earlier checks in this section, resemble the check for a data-independent process being a buffer described on p. 406.

  4. 4.

    It is legitimate to make clean writes to locations such as this and okread[i] that are shared between threads and introduced by us for specification purposes, because they are not part of the algorithm itself, merely tools to help us observe it.

  5. 5.

    This type of context also applies to any case where there is no parallelism in the complete system.

  6. 6.

    In the case of integer locations we only consider the case of writes of values within the content type of the given location, since, thanks to our error regime, no thread will attempt any other write.

  7. 7.

    refsva.csp does not disable the other functions of svacomp.csp, and in fact the parser in SVA’s front end always uses the combination of these two files, even when no refinement between SVL terms is tested.

  8. 8.

    Furthermore, this replacement only created a problem with at least 5 threads.

  9. 9.

    Another, seemingly more efficient, way of achieving this effect is set out on p. 472.

  10. 10.

    Indeed, it is practically better to have all three of these slots replaced by a single one randi representing a random value. The most efficient way to achieve a random value is to make a variable such as randi or randb writable by the external environment. See the example scripts.

References

  1. Bornat, R.: Separation logic and concurrency. In: Formal Methods: State of the Art and New Directions. Springer, Berlin (2010)

    Google Scholar 

  2. Fich, F.E., Ragde, P.L., Wigderson, A.: Relations between concurrent-write models of parallel computation. In: Proceedings of the Third ACM Symposium on Principles of Distributed Computing (1984)

    Google Scholar 

  3. Henderson, N., Paynter, S.: The formal classification and verification of Simpsons 4-slot asynchronous communication mechanism. In: FME 2002. Springer, Berlin (2002)

    Google Scholar 

  4. Knuth, D.E.: Additional comments on a problem in concurrent programming control. Commun. ACM 9, 5 (1966)

    Article  Google Scholar 

  5. Lamport, L.: A new solution of Dijkstra’s concurrent programming problem. Commun. ACM 17, 8 (1974)

    MathSciNet  Google Scholar 

  6. Rushby, J.: Model checking Simpson’s four-slot fully asynchronous communication mechanism. SRI Technical Report (2002)

    Google Scholar 

  7. Simpson, H.R.: Four-slot fully asynchronous communication mechanism. IEE Proc. Comput. Digit. Techn. 137, 1 (1990)

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to A. W. Roscoe .

Rights and permissions

Reprints and permissions

Copyright information

© 2010 Springer-Verlag London Limited

About this chapter

Cite this chapter

Roscoe, A.W. (2010). Understanding Shared-Variable Concurrency. In: Understanding Concurrent Systems. Texts in Computer Science. Springer, London. https://doi.org/10.1007/978-1-84882-258-0_19

Download citation

  • DOI: https://doi.org/10.1007/978-1-84882-258-0_19

  • Publisher Name: Springer, London

  • Print ISBN: 978-1-84882-257-3

  • Online ISBN: 978-1-84882-258-0

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics