Dr Christos Kloukinas
- Advanced Programming: Concurrency
Dr Christos Kloukinas
Reader
Office A205
Department of Computer Science
City St George's, University of London
Northampton Square
London EC1V 0HB
C.Kloukinas (at) City.Ac.UK
tel: +44 20 7040 8848
fax: +44 20 7040 0244
Staff.City.Ac.UK/c.kloukinas
Reader
Office A205
Department of Computer Science
City St George's, University of London
Northampton Square
London EC1V 0HB
C.Kloukinas (at) City.Ac.UK
tel: +44 20 7040 8848
fax: +44 20 7040 0244
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
Material
-
General:
- The module follows the "Concurrency: State Models & Java Programs" book (either edition will do - GET THE BOOK!)
- Introductory slides
- 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.
- 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
-
Exercises from the Book
You can try out the exercises from the first 5 chapters of the textbook.
Lab Sessions:
Note: User and password for the lab answers is "s". (lab answers are released one week after the lab)
- Lab 1
- Lab 2
- Lab 3
- Lab 4
- Lab 5 (building an app with a GUI either as a 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
- To execute an applet you can use the program appletviewer. This comes in 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.)
- 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 app either as a Java applet (deprecated) or a normal Java application.
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!)
- Why study this module? Cause it's damn difficult to get 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.)
- Paul E. McKenney's "Memory Barriers: a Hardware View for Software Hackers" (or why the sequence of your program's instructions is rarely respected...)
- Check the Further reading section of the Concurrency chapter of the Java SE tutorial :-)
- 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! - 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 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: