Dr Christos Kloukinas
- Advanced Programming: Concurrency
Dr Christos Kloukinas Reader
Office A304H
Department of Computer Science
City St George's, University of London
Northampton Square
London EC1V 0HB
C.Kloukinas (at) CityStGeorges.Ac.UK
tel: +44 20 7040 8848
Staff.City.Ac.UK/c.kloukinas
Reaching the College building (where my office is) from Angel. (https://bit.ly/fdc0K2)
Reaching the main University building from Angel. (https://bit.ly/fNKDnq)
Advanced Programming: Concurrency
General Material
- The module follows the book "Concurrency: State Models & Java Programs" (either edition will do - GET THE BOOK!)
- Check the Further Reading section of the Concurrency Java SE tutorial :-)
- Handouts in PDF
<-- !!!!
- Some extra study notes for the slides <-------- !!!!!!!!!!!!!!!!!!!!!!!!
- Revision tips Well, since 2020 there's no longer an exam for this module but this is a quick summary of what you'll hopefully learn in it.
- Book supplement - Program Verification
- We will be analyzing our models using the LTSA model analyzer (you can download a copy of your own from Download LTSA - contains all examples in the book)
- Executable jar of all the book applets
Textbook Exercises
You can try out the exercises from the first 5 chapters of the textbook.Why Study Concurrency?
Cause it's damn difficult to get right... and testing alone does not help, must be designed right!- Therac-25 - Concurrency killing humans:
- What really happened on Mars? - Concurrency bug in
the Mars Pathfinder (and how at NASA
they "strongly believe in the `test what you fly and fly what
you test' philosophy.", leaving debugging/etc. code
in the final mission code)
- The issue had to do with priority inversion
- Sudden unintended acceleration
- Even experts get concurrency
wrong: Issues with the Java Memory Model
- Paul E. McKenney's "Memory Barriers: a Hardware View for
Software Hackers" (or why the sequence of your
program's instructions is rarely respected...)
- The more I add, the less I get!
Lab Sessions:
Note: User and password for the lab answers is "s" (lab answers are released once the lab concludes)
- Lab 1
- Lab 2
- Lab 3
- Lab 4
- Lab 5 (building an app with a GUI either as a deprecated Java applet or a normal Java application)
- Lab 6
- Lab 7
- Lab 8
- FSP "tricks":
- You can use a number as an action by putting it
inside brackets:
[3]
See the bistable (exercise 2.3) in Lab 2. - You can pass a label as a parameter, by quoting
it with a single quotation mark:
P(label='left)
See Announcer-Lstener.lts from Chapter 11 (provided inside LTSA).
- You can use a number as an action by putting it
inside brackets:
Programming Tools
You can use whichever IDE you want for Java. But note that you should check that your programs work with the basic development tools, that is: javac (Java Compiler), java (Java Virtual Machine), etc.I do not have any IDE on my system (no Eclipse, BlueJ, etc.) so I will not be able to compile your program if it needs one of those, in which case you will lose marks (quite a few...).
So either develop your programs using the aforementioned standard tools or make sure that they can compile your program once you've finished developing it (and before submitting it...).
Executing/coding applets
- The book applets come with a Java wrapper that allows us to execute them using a normal Java VM, without needing appletviewer - just run (above the concurrency folder that contains the applets): java concurrency/viewer/Viewer
- Lab 5 describes how to do a basic GUI app either as a (deprecated) Java applet (like the textbook does) or as a normal Java application.
Formal Methods
- In 2013, Leslie
Lamport was the recipient of the ACM
A. M. Turing award (highest award in Computer Science), ``for fundamental
contributions to the theory and practice of distributed and concurrent
systems, notably the invention of concepts such as causality and logical
clocks, safety and liveness, replicated state machines, and sequential
consistency.''
Do spend a little time to read Lamport's Turing Lecture: The Computer Science of Concurrency: The Early Years (the PDF version is easier to read as the figures are placed in the text and have the right size). The text should be understandable by all and is a great summary of the main problems in concurrency - if you are puzzled by something, feel free to ask!
- The FSP language we model systems in is
a process
algebra
- A very famous (and early) process algebra is CCS, developed by another ACM Turing laureate (1991) Robin Milner (who had worked at City as well at some point! :-) ).
- Another famous process algebra is CSP, developed by yet another ACM Turing laureate (1980) Tony Hoare.
- Model
checking (what the LTSA tool does), is a formal method for
which three researchers received the ACM Turing award in 2007:
Ed Clarke,
Allen Emerson,
and Joseph Sifakis
- In 2022, three ACM Turing laureates (Cerf, Sifakis, and Lamport) had a very interesting discussion:
Misc
- Reference cards for various things (and more)
- Andrei Alexandrescu (C++'s Standard Template Library creator) - what's the best text editor? (the same one that Linus Torvalds uses!)
Notes to historians...
|
To execute an applet you can use the (deprecated) program
appletviewer, which comes with
the JDK.
Use it as: appletviewer -J"-Djava.security.policy=java.policy.applet" file.html where file.html contains a link to your applet, for example: <!-- Contents of file.html --> <applet code="MyApplet.class" width=800 height=250> </applet>appletviewer is fast, doesn't need much memory and can be easily killed if your applet goes wrong. ( The -J... option is needed to override the default security policy of the JVM, since Java applets are currently considered a security risk. The policy file needed is linked in the command above - store it locally where your file.html is. Here is the link to the policy file again.) |