CSC 543 Multiprocessing & Concurrent Programming, Spring 2024, Mon 6-8:50 PM, Old Main 158.

Dr. Dale E. Parson,
Class-time Zoom link for CSC543 OR See D2L Course CSC543 -> Content -> Overview for the link.
PRIVATE ZOOM CHAT to me for questions.
Student instructions for using Zoom
Please fill out & email Dr. Parson this permission to record slip. I will use it to take attendance in week 1.
The course is 100% via Zoom at class time. I will record & post class videos, but want you there at class time. Thanks., Office hours:
Office Hours Monday 3-5 PM, Tuesday 3-5 PM, Thursday 10-11 AM, or by appt.
All office hours are either Zoom (preferred) using the above link or at Old Main 260.

First day handout (syllabus that is specific to this semester).

Students can meet in person in OM 158 OR live on-line via Zoom.
    I will post links to recorded archives at the bottom of this page within a day after each class.

We will be multiprocessing on, which are accessible via ssh from acad:
        ssh -l yourloginname mcgonagall
        ssh -X -l yourloginname mcgonagall  # The -X enables X11 GUI I/O.

Handouts from Spring 2011 through present.
Slides for week 2, Chapters 1, 2, 3 and 13 on Introduction, Thread Safety, Sharing Objects and Explicit Locks.
    Week 2 added slides on Race Conditions, Critical Sections & Composing Thread-safe Objects.
    Week 2 Jython code to demonstrate using java.lang.Runnable, java.lang.Thread, and a race condition.
    In acad ~parson/multip see and
        jython ; javac ; CLASSPATH=. java RaceJava
Example code is at /export/home/faculty/parson/multip on (and on mcgonagall via NFS).
Locks and condition variables slides from September 21 class session.
Slides for week 3, Chapters 15, 16 and Appendix A on Atomic Variables, Nonblocking Synchronization, the Java Memory Model and Annotations for Concurrency. (4/1/2015)
A problem from the Spring 2011 midterm that uses atomic variables instead of a lock-based monitor.
Slides for week 4, Chapter 4 on Composing Objects. (4/1/2015)
    Code listings for Chapter 4
Slides for week 5, Chapter 5 on Building Block Classes from java.util.concurrent. (4/1/2015)
    Code listings for Chapter 5
    D. Parson and D. Schwesinger, "Minimum-Blocking Parallel Bidirectional Search,"
            Proceedings of PDPTA'12: 2012 Intl. Conf. on Parallel Processing Techniques and Applications , Las Vegas, NV, July 16 - 20, 2012.
             Here are the slides for the talk.
             CyclicBarrier, CountDownLatch, and using these & related mechanisms in parallel bidirectional search.
             See code on acad at ~parson/multip/pennydime CoinPuzzle CoinPuzzleDataflow & CoinPuzzleDataflowMultiQ.
FutureTask interface used in CSC220Fall2022PaintingAssn5, Mutators, and Threading code tabs.
    Full fall 2023 CSC220 handout code + data is here.
Slides for week 7, Chapter 6 on using Executor to schedule tasks using thread pools from java.util.concurrent. (4/8/2015)
"Creative Graphical Coding via Pipelined Pixel Manipulation, " Proceedings of the 33rd Annual Spring Conference of the Pennsylvania Computer and Information Science Educators (PACISE) Shippensburg University of PA, Shippensburg, PA, April 6-7, 2018.
Processing (Java) code for sketch PhotoArchMontage and its helper active class ImageLoader demonstrating starting a thread.
    Video and some stills from a digital art exhibit in Munich on September 14, 2018.
    This sketch uses my multithreading package PixelVisitor that we will examine in detail.
    Acad ~parson/multip/PixelVisitor has my Java library for Processing that uses Java thread pools.
Slides for week 10, Chapter 7 on Interruption, Cancellation and Shutdown. (3/25/2015)
More slides for week 10, Chapter 8 on Applying Thread Pools. (4/8/2015)
Slides for week 11, Chapter 9 on GUI Applications. (4/8/2015)
    Tutorial on multithreading in Java FX (GUI framework that supplants Swing.
    Acad ~parson/multip/multip/csc580spring2011/Projects/csc580gps4/ has the Swing example that uses a single-threaded ExecutorService to run the worker thread discussed on 11/30.
More slides for week 11, Chapter 10 on Avoiding Liveness Hazards. (4/15/2015)
Slides for week 12, Chapter 11 on Performance and Scalability. (4/15/2015)
More slides for week 12, Chapter 12 on Testing Concurrent Programs. (4/15/2015)
~parson/Compiler1/optimize5/stepvm/ helper class HeapData has the 12/7 example code for lazy evaluation. Search for:
        class HeapData, HeapData.flatten(...), HeapData.helpflatten(...)
        In optimize5/ see collect_reduce.txt (look for reduce and collect), programqsort1p.txt (reduce), programqsort1p_O2.debug.out (STEP_FORK & STEP_JOIN)
Slide on critical sections, race conditions, & related concepts
Slide on deadlock
Material in my UNIX account
~parson/multip has a lot of documentation & code examples on current programming.
~parson/multip/spring2015 is where I will work out some code examples for class.
~parson/JavaLang/net/jcip/examples has all example code from our textbook.

Older material
Here is my Summer 2010 study of these machines with a January 2015 update for Dumbledore.
Mcgonagall's CPU and memory configuration.
    NVIDIA Tesla K40c is added for deep learning & other number crunching.
Goetz et. al. Java Concurrency in Practice textbook web site. Code exacadamples on  are under ~parson/JavaLang/net/jcip/examples.
Herlihy / Shavit The Art of Multiprocessor Programming web site.
A copy of C++ Concurrency in Action is posted here.
A copy of Scala in Depth is posted here.
Parallelism on the Desktop, IEEE Software, January/February 2015 (vol. 28 no. 1) (password restricted access).

Assignments -- From acad you must "ssh mcgonagall" to build & test all assignments.

If you are new to working on our Linux systems, you can bring up a Windows CMD prompt and from there:

It is possible to use the scp, ssh-based file copy command in Mac or Windows command line utilities.
If you do not have a favorite Linux text editor, try running nano on acad. Assignments must run on mcgonagall.  has the make manual.

Assignment 1 due by 11:59 PM on Thursday February 15 via make turnitin
We will walk through the spring 2023 solution to their Assignment 2 as example code.
Dataflow diagram added to the bottom of assignment page on February 3, 2024 
I added an example doc on using control-\ to see stack traces for a hung Java process on 2/6.

Assignment 2  due on Thursday March 7 via make turnitin

    Examples of queues in Processing: 
        Source code only.
    Prep: Last year's Assignment 1 is now available on acad in ~parson/multip/
    From 2023:
A marker interface Queue<E> <- java.util.concurrent.ThreadSafeQueue<E> <- BlockingQueue<E>
        would have allowed pipeline construction using only thread-safe queues.
        As it stands the Queues may not be @ThreadSafe.

Assignment 3 builds on on Assignment 2, due 11:59 PM Thursday March 28 via make turnitin.
    It employs thread-safe non-blocking queues & atomics to put / take FiveTuples and TenTuples. as a Java interface specifying the data exchange functions. is an adapter using thread-safe queues that support non-blocking functions. uses java.util.concurrent.
AtomicReference. uses java.util.concurrent.AtomicReferenceArray.
        ~parson/multip/ is a Jython script about non-blocking Producer->Consumer spinning.

Assignment 4 is an Executor-based client-server simulation,
        due 11:59 PM Thursday April 11 via make turnitin.
    Demo in Jython from acad ~parson/multip/CSC543s24ServerDemo/, see Jython docs.
    Demo assignment from spring 2011 in ~parson/multip/

Assignment 5 of Individual Student Topics due 11:59 PM May 6 via D2L.
    This includes a 12-15 minute student presentation at class time May 6.

Zoom Archives

Jan 22 Course Intro, hardware multi-context cores, memory paths, & need for thread synchronization.
Jan 29 Class Went over initial slides, locks & condition variables, and Assignment 1 handout.
Feb 5 Class week 3 and week 4 slides, more explanation of assn 1 mechanisms, Q&A during work session.
    I added an example doc on using control-\ to see stack traces for a hung Java process on 2/6.
Feb 12 Class went over control-\ on previous line, then Chapter 5 slides on java.util.concurrent.
Feb 19 Class went over my solution to Assignment 1, then Assignment 2 handout.
    We will have some in-class work time next Monday.
Feb 26 Class CyclicBarriers & lock-free dataflows in bidirectional search, prep links for Assignment 3 above.
    Final hour was a work session using a breakout room for debugging student code.
March 4 Class More on atomic data exchanges, then slides & demo on Executors factory methods,
    ExecutorService, Future tasks, and Executor Completion Service.
March 18 Class Assignment 2 solution, Assignment 3 handout and Q&A, 1 hour work time.
March 25 Class Walk-through of Jython demo of thread pools & tasks and then Assignment 4 handout.
    There will be some work time next week.
April 1 Class Chapter 7 slides on Interruption, Cancellation, & Shutdown, ran an experiment with
    premature shutdownNow on Assignment 4's server, found a bug where Futures return by submit
    on a previously shutdownNow server hang in Future.get()! 45 minutes of project work time.
April 8 Class Chapter 8 slides on Applying Thread Pools, Chapter 9 on worker threads for GUIs, examples in Processing.
Related work:
    Creative Graphical Coding via Pipelined Pixel Manipulation (PACISE 2018 Best Faculty Paper)
    [De]fragmenting Architecture, (Debuted at Computer Vision Art in Munich December 2018)
    A Distributed Model-View-Controller Design Pattern for a Graphical Remote Control
        of a Multi-user Application (PACISE 2020 COVID), here are the slides.
April 15 Class Assn3 & Assn4 post-mortem, Chapter 10 slides and
    walked through the first two entries just above here on Related work.