CSC 543 Multiprocessing & Concurrent Programming, Spring 2023, Mon 6-8:50 PM.

Dr. Dale E. Parson, http://faculty.kutztown.edu/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.
 
parson@kutztown.edu, Office hours: https://kutztown.zoom.us/j/94322223872
Office Hours Monday 3-5 PM, Tuesday 3-4 PM, Friday (Zoom only) 3-5 PM, or by appt.
Monday & Tuesday office hours are either Zoom using the above link or at Old Main 260.

Friday April 28 Zoom office hours will be at 12 - 2 PM because of the KTech picnic.

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

I have put a copy of the textbook on reserve in Rohrbach Library for the semester. You can go to the front desk & borrow it overnight.
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 mcgonagall.kutztown.edu, 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 RaceJython.py and RaceJava.java
        jython RaceJython.py ; javac RaceJava.java ; CLASSPATH=. java RaceJava
Example code is at /export/home/faculty/parson/multip on acad.kutztown.edu (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 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/gpssearch.java 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/StepVM.java 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 secure copy of C++ Concurrency in Action is posted here.
A secure 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.

Assignment 1 on building & running a thread-safe data pipeline is due via make turnitin on February 23.
      Deadline was bumped from 2/16 to 2/23 at the 1/30 class.
"Neither the Java Language Specification nor the Java Memory Model formally defines immutability, but immutability is not equivalent to simply declaring all fields of an object final. An object whose fields are all final may still be mutable, since final fields can hold references to mutable objects. An object is immutable if:
Its state cannot be modified after construction;
All its fields are final; and
It is properly constructed (the this reference does not escape during construction).
Immutable objects can still use mutable objects to manage their state. (Parson: No means for class-external mutation.)
See textbook page 47 for more information.
Parson: 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.
Examples of queues in Processing: https://acad.kutztown.edu/~parson/CSC543DemoImagePipelineQueues.zip  Source code only.

Assignment 2 on using implicit locks and explicit locks due via make turnitin by end of Sunday March 12.
    A mutex without a condition variable versus a mutex with a condition variable (added March 6).

Assignment 3 on using latches, barriers, semaphores & atomic arrays is due by end of Saturday April 8.

Assignment 4 on Executor thread pools & related due via make turnitin by end of Friday April 28.
    A related assignment from 2011.
 
Assignment 5 Slides to 10-minute talk and code in a ZIP file due via D2L Assignment 5 May 8 at 11:59 PM.
    Ideas and specs from last time.

Each talk will run 10 minutes, including setup time & questions / answers.
Plan on talking about 8 minutes. Inform your talk by writing demo code.
The intent of the code is to familiarize yourself in a concrete way with the topic. It is demo code, not an entire application.
It does have to have at least some custom work. It cannot just be downloaded from the net.
You may download & enhance. Talk with me about the scope of the code if you are uncertain.
You do not need to write a paper. Pretend to be doing a professor's job for 8 to 10 minutes.
Grading will be on clarity of the talk, clarity of the slides with optional demo, ability to answer questions.

Grading criteria, 25% each:
    Is the work non-trivial, e.e., not just downloaded?
    Is the presentation clear?
    Are the materials complete and clear?
    Can the presenter answer questions about the project?

 1 18:00      Reilly Walther, Concurrency in PHP and SQL
 2 18:10      Nicholas Morello, Using Python coroutines to drive parallel Weka processes
 3 18:20      Dylan Herbst, java.util.concurrent.ForkJoinTask
 4 18:30      Paul Barton, C++ Concurrency in Breadth-First Search
 5 18:40      Edwin Cadiz, Multithreading in Unity
 6 18:50      Travis Bubb, C# Concurrency
 7 19:00      Aaron Harman, Concurrency in Rust - different application
 8 19:10      Wyatt Blizard, Unix shared memory & semaphores for multi-process concurrency
   19:20      BREAK
 9 19:30      Matthew Lingenfelter, PlayerExplicit in C++
10 19:40      Matthew Bartlett, Topological sort in Rust
11 19:50      Thaddeus Hall, Concurrency in Javascript & Node.js
12 20:00      Pei Hua Lin, PlayerExplicit using Python threads and RLock and/or Semaphore
13 20:10      Nik Golombek, Python threads of assignment 1 pipeline2023 using the queue library.
14 20:20      Haris Bhatti, Python client-server interprocess communications using sockets
15 20:30      Nathan Rew, Different project in Javascript

http://www.gnu.org/software/make/manual/  has the make manual.


Zoom Archives

Jan 23 class Intro to course plan, examination of processor<->memory paths on various architectures.
Jan 30 class Went over slides for week 2 and CSC543DemoImagePipelineQueues to illustrate a 2-stage pipeline using Queues and BlockingQueues from java.util.concurrent.
Feb 6 class mechanisms and requirements for Assignment 1.
Feb 13 class Went over CSC543DemoImage* examples and slides through week 3 above.
    Examples from class: CSC543DemoImageImplicitLock CSC543DemoImageExplicitLock CSC543DemoCollectionsSynchronized CSC543DemoImageAtomic
Feb 20 class Mostly going over Assignment 2 handout + some Assignment 1 Q&A + above "Slides for week 3".
Feb 27 class Assignment 1 post-mortem, Chapter 4 slides on Composing Objects, important guidelines for Assignment 2, much coughing.
March 6 class Additional locking classes from java.util.concurrent & .locks, code listings for Chapter 4, examples.
March 20 class Went over Assignment 2 solution, Assignment 3 handout, related Java libraries.
March 27 class Went over FutureTask & related task decoupling from worker thread.
   
FutureTask interface used in CSC220Fall2022PaintingAssn5, Mutators, and Threading code tabs.
    Full CSC220 handout code + data is here.

April 3 class Went over slides, Javadoc, tasks for decoupling application logic from worker threads;
     Composing Objects, Building Block Classes from java.util.concurrent, started Executor / thread pools.
April 10 class Went over Assignment 3 solutions & Assignment 4 handout.
    Please email me your Assignment 5 topic idea before next class on April 17.
    Try to finish Assignment 4 a week early. Once you have one server, each subsequent server may be only a one-line change.
    Since your Assn5 presentation will be 10 minutes, write or extend some demo code & then give an overview of the topic with time for questions.
    Concurrency in C# is now taken.
April 17 class Mostly going over a client-server thread pool assignment from 2011.
April 24 class Going over pipeline project re-coded as Python coroutines, Chapter 8 on applying thread pools.
May 1 class go over Assignment 4. Slides from Chapters 9 through 12.
May 8 final exam session consists of recorded student presentations.