CSC 343 - Operating Systems, Spring 2020, MonWed 3-4:20 PM.

Dr. Dale E. Parson
Spring
2020 Office Hours: Tu 2:30-4:30, Wed 12:00-2:00, Fri 1:30-2:30, or by appointment.
Parson office hours for last two weeks of spring 2020:
Tuesday Apr 28 2-3 PM (changed from 2:30-4:30)
Wed Apr 29 12-2 PM as usual
Fr May 1 1:30-3:30 (extra hour added)
Final exam week hours:
Tuesday May 5 2:30-4:30 PM as usual
Wed May 6 12-1 PM (one hour less)
Thursday May 7 1:30-3:30 (Friday's usual office hour cancelled)
*****
Assignment 5, Final Exam project, migrating preemptive round-robin CPU scheduling to preemptive short remaining time first (the preemptive variant of shortest job first), AND replacing a condition variable model with a counting semaphore model.

This assignment is due via make turnitin from the seme_srtf_final_2020 directory by 11:59 PM on Saturday May 9. I will not accept any late assignments after 9 AM Sunday May 10.

The only time I will answer questions about this assignment is during our final exam period Monday, May 4, 2020, 11:00 a.m. – 1:00 p.m. in our Zoom room. I will hand this out and send email a few days ahead, and will only answer questions that clarify what you need to do, e.g., for unclear wording.
*****

Real-time on-line teaching via Zoom to commence March 23 through end of semester.
     You can attend interactively at normal class time if possible VIA THIS ZOOM ROOM LINK from summer 2019.
     Use the Chrome browser if possible. Click the link before March 23 to auto-install Zoom and check it out.
     I will post  a link to a video recording of each class within 24 hours at the bottom of this course page.
     My office hours will take place at the normal times VIA THIS DIFFERENT, OFFICE HOUR ZOOM ROOM.
     Please watch your email & this course page. If Zoom runs out of steam, I will post YouTube videos & send email.

First day handout (syllabus that is specific to this semester).
I have put a copy of the hard bound textbook (9th edition) textbook and the Essentials Edition on reserve in Rohrbach Library for the semester. You can go to the front desk & borrow one of them for a day. The chapter numbers differ in the various editions.

Handouts


Here is initial documentation on the State Machine language (STM) that we will use for projects.
    STM.doc.txt documents the STM's library functions and events.
    (Edit 8/26/14: Added :/usr/bin to the PATH in the above document. Added export TERM="xterm".
     We will ssh mcgonagall to run our projects. Do not run them on acad!)
Here is Fall 2015's project 1 that models a semester.
    Here is the state machine diagram that is generated from Semester1.stm.
    Code is on mcgonagall or acad in ~parson/OpSys/semester1_2015/.
I added a STM to simulate a 10-person game of tag on Jan. 28, 2020. It sends events between thread state machines.
    Code is in ~parson/OpSys/tag_2020 on acad and mcgonagall.
Here is a conference paper on the Fall 2013 use of STM in the course.

Link to the Java 8 class libraries.

UNIX "man -s3" library functions and "man -s2" system calls and the user mode / kernel mode diagram.


Assignments


Assignment 1 on the Iterated Prisoner's Dilemma is Due by end of Wednesday February 19.
    Attendance at the in-class work session on Wednesday February 5 is mandatory and is worth 15% of this assignment.
    I will need to see a formal excuse from the Health Center or a medical professional or faculty member for allowing a miss of this class.

Assignment 2 on using locking mechanisms to solve a multi-thread to solve a race condition is due by end of March 25 via make turnitin.
    On 3/12 I slid the due date from March 18 to March 25 to accommodate the school shutdown the week after spring break.
    Deadline extended to end of Friday March 27.

Assignment 3 on thread-to-context scheduling algorithms is due by end of Friday April 17 via make turnitin.
    Updated with instructions on debugging codeTable[] run-time errors on April 7, see last page of handout.

Assignment 4 on using FIFO and min-priority queues for memory request scheduling is due by end of Friday May 1 via make turnitin.
    Bullet A near bottom of page 3 is updated.


Textbook slides (KU password protected)

    Chapter 1 -- Introduction
    Chapter 2 -- Operating System Structures
    Chapter 3 -- Processes
    Chapter 4 -- Threads
    Chapter 5 -- Process Synchronization
    Chapter 6 -- CPU Scheduling
   
The handout on the STM sample(...) function will be useful in upcoming assignments.
    State machines for first-come first-served, shortest job first, and round robin CPU schedulers
    Chapter 7 -- Deadlocks
    Chapter 8 -- Main Memory
    Chapter 9 -- Virtual Memory
The 2013 STMs for PAGING -- FIFO paging, LRU paging & LRU paging with dirty bit consideration -- have the same graph.
        FIFO uses a FIFO queue, LRU uses a priority queue sorted on use recency, and LRU w. dirty bit sorts on clean-vs-dirty status & recency.
        FIFO puts each new (page -> frame) mapping in a FIFO queue, pulls a victim frame from front when no free frame is available.
        LRU uses simulation time() as priority for a min-queue, removes from queue and reinserts on every memory reference.
            This queue manipulation is for simulation only. Hardware bits in TLB track most recent usage for each page -> frame reference.
        LRU-dirty uses (dirty, time()) as priority for min queue, preferring clean-page victims because it doesn't have to page them out,
            because there is already an identical clean copy sitting on disk. Dirty victims need to be paged out when victimized.
    Chapter 10 -- Mass Storage Systems
    Chapter 11 -- File System Interface
    Chapter 12 -- File System Implementation
    Chapter 13 -- I/O Systems
    Chapter 14 -- Protection
    Chapter 15 -- Security
    Chapter 16 -- Virtual Machines
    Chapter 17 -- Distributed Systems
    Chapter 18 -- The Linux System
    Chapter 19 -- Windows 7
    Appendix A -- Free BSD

ZOOM Recordings
    January 27 - Introductory tutorial on programming in the STM (State Machine), Python-based framework.
    January 29 - Detailed inspection of the state machine that uses inter-thread communication to play a game of tag.
    February 3 - Going over instructions for Assignment 1.
    March 23 - first 10ish minutes answer questions about assn2, then start CPU Scheduling, Chapter 6 slides above
    March 25 - Questions and answers about Assignment 2, which is now due end of Friday March 27 via make turnitin.
    March 30 - Slides on FCFS, SJF, and RR CPU scheduling algorithms, started going over related Assignment 3.
    April 1 - (REMOVED) My solution to Assignment 2; finish going over Assignment 3 handout.
    April 6 - Finish Chapter 6 slides above on CPU Scheduling, using Assignment 3 & mcgonagall to illustrate.
        mpstat -P ALL 5 is the command to measure CPU on all contexts on acad using 5-second snapshots
        top show the top CPU-consuming processes
        iostat -cdnhk 5 shows I/O activity using 5-second snapshots
    April 8 - Work session with Q&A on Assignment 3.
    April 13 : Overview of deadlock avoidance, then on to Memory Management,
        YOU NOW HAVE TO TYPE A STUPID PASSWORD TO VIEW THE VIDEO. HERE IT IS: 
j8#A.0#I
    April 14: Office hours Q&A about round robin modeling assignment.
        Here is a text file of the Python commands I typed to emulate the variables that you need.
    April 15: Continuing Memory Management including swapping, segmentation, page tables, and TLBs.
        blowup.c screen trace from a C code example for creating a segmentation fault by going outside process memory.
    April 20: (REMOVED) Went over solution to CPU sched assn3, and the new handout for assn4 for swapping variations.
        After make testrr, you can use egrep '((running,(ARRIVE|DEPART))|(ready,ARRIVE))' rr.log |less to see the RR running trace.
    April 22: Finished going over assn4 handout & starting code.
    April 27 Slides & acad-bash examples of page & start of demand paging.
        Code examples blowup.c, blowstack.c, and blowheap.c different causes of segmentation faults.
        Example runs of these are in the Zoom video.
    April 29 Finished going over "Virtual Memory" slides above on demand paging, page replacement algorithms, thrashing, working set.
    May 4 (REMOVED) Went over my solution to Assignment 4, then went over handout Assignment 5 / Final Exam.
        From an email I sent out during class repeating a change that is in this video recording:
            Q4: Even though the MEAN spin times for Producers and Consumers
                in Condvar 10 and Semaphore 10 are the same (1 tick), the
                SUMs of spin times in Semaphore 10 are about half of their
                counterparts in Semaphore 10 (1000/2000) = 0.5. Why?
            CHANGE TO
            Q4: Even though the MEAN spin times for Producers and Consumers
                in Condvar 10 and Semaphore 10 are the same (1 tick), the
                SUMs of spin times in Semaphore 10 are about half of their
                counterparts in Condvar 10 (1000/2000) = 0.5. Why?
        Some syntax examples that I went over in this Zoom recording:
            processor.messageBuffer[processor.producerSemaphore.atomicBufferPointer] = product ;
            processor.messageBuffer[processor.consumerSemaphore.atomicBufferPointer] = None ;
            product = processor.messageBuffer[processor.consumerSemaphore.atomicBufferPointer];
            incrProducerPointer;
            incrConsumerPointer;