\documentclass[10pt,oneside]{memoir}
\usepackage{soul}
\usepackage[xetex]{hyperref}
\usepackage[table,usenames]{xcolor}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{xltxtra}
\usepackage{fontspec}
\usepackage{textcomp}
\usepackage{enumerate}
\usepackage{enumitem}

\usepackage[margin=0.85in]{geometry}
\usepackage{hyperref}
\usepackage{listings}
\usepackage{makecell}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{cancel}
% compact itemized and then enumerated
\setlist{leftmargin=*,
  noitemsep,
  topsep=5pt,
  parsep=0pt,
  partopsep=0pt,
}

\setlist[enumerate]{leftmargin=*,
  itemsep=2pt,
  topsep=0pt,
  parsep=0pt,
  partopsep=0pt,
}

\usepackage{pstricks}

% ----- Fonts -----
\defaultfontfeatures{Scale=MatchLowercase}
\setmainfont{Gentium Book Basic}
\setmonofont{Comic Code}
\setsansfont{Arial}
% ----- Fonts -----

\newfontfamily\lstlistingfamily{Comic Code}
\lstset{
  basicstyle=\lstlistingfamily,
}

\setstocksize{11in}{8.5in}
\settrimmedsize{11in}{8.5in}{*}
\setlrmarginsandblock{0.75in}{0.75in}{*}
\setulmarginsandblock{0.75in}{0.75in}{*}
\setlength{\topskip}{1.6\topskip}
\checkandfixthelayout
\sloppybottom

% classname
\newcommand\className{Operating Systems}
\newcommand\classNumber{CIS~310}
\newcommand\classFullName{\classNumber~\className}
\newcommand\semester{Fall 2023}
\newcommand\semesterNumber{202309}
% /classname

\begin{document}
\title{Syllabus: \classFullName}
\author{Brian C. Ladd}
\date{\semester}
\maketitle

\section*{Catalog Description}
\begin{quote}
  \texttt{Principles of operating systems, concurrency, scheduling,
    virtual memory, device management, security and protection,
    deadlocks, introduction to networking. Prerequisite: CIS 205 and
    CIS 300. Fall
  }
\end{quote}

\section*{Overview}

What is the \textbf{operating system} (OS) on a \emph{digital},
\emph{binary}. \emph{general-purpose} computer? At a very (very) high
level, it is a \emph{resource manager}, controlling each running
process's access to the CPU, the RAM, and the I/O (I love TLAs;
\footnote{\emph{Three Letter Acronym}} I blame the Army, even though
CS has no shortage of them). Beyond that, the OS \emph{shares} those
resources so that the computer is not limited to only running a single
process at a time.

The operating system starts and stops \emph{processes},
\textbf{running} computer programs along with all the metadata needed
to let them share the hardware with other processes. The program part
of the process is the \emph{machine code} that tell the CPU what to
do. The \textbf{general-purpose} nature of the modern computer is laid bare
because the OS treats the code as \textbf{data} that it manipulates
while the CPU can interpret and run the \textbf{algorithm} encoded in
the instructions. The same memory pattern has two \emph{simultaneous}
meanings as code and data.

Our text for the semester talks about ``three easy pieces'' of
an operating system:
\begin{enumerate}
\item Virtualization --- Using hardware safely requires careful
  programming \footnote{The Hercules Monochrome Graphics Adapter
    (c. 1980) could be set on fire from software. Fun times, fun
    times.}. Rather than trust each programmer to get it right, the OS
  transparently ``pretends'' to be hardware, \emph{virtual
    hardware}. This interposition can enforce protection of the real
  hardware, provide a higher-level of abstraction to the programmer,
  and share the resources across multiple processes at the ``same''
  time.
\item Concurrency --- If multiple processes, or even \emph{threads}
  within one process, are active \emph{concurrently}, then access to
  hardware must be partitioned (in time, space, or both). The
  operating system (and the physical hardware) provide low-level
  primitives for implementing safe concurrency.
\item Persistence --- Memory in a computer, RAM, is \emph{volatile}
  (it can only maintain state while it has power); the OS implements
  file systems on \emph{nonvolatile} devices (\emph{e.g.} hard disk
  drives (HDD), solid-state drives (SSD), etc.) in order to
  keep/restore digital data across reboots.
\end{enumerate}

Each of these pieces requires some level of hardware support and each
provides a higher-level, abstract machine for the programmer. The
higher abstraction smooths out many of the rough edges of programming
the computer.

\subsection*{Calendar Considerations}
\begin{itemize}
\item The last day to \textbf{add/drop}: 2023-09-01.
\item The last day to withdraw or select S/U: 2023-11-03.
\item \textbf{Fall Recess}: 2023-10-09 -- 2023-10-10 (no classes on
  these dates).
\item \textbf{Thanksgiving Recess}: 2023-11-22 -- 2023-11-24 (no classes
  on these dates).
\item \textbf{Last Day of Classes}: 2023-12-08.
\item \textbf{Final Exam}: 2023-12-15 1015-1215.
\item Additional Calendar Information:
  \href{http://www.potsdam.edu/academics/calendar}{SUNY Potsdam Academic Calendar}.
\end{itemize}

\section*{Student Learning Outcomes}

\emph{Operating Systems} provides a thin stalk reaching from just above the
physical hardware of the machine to just below the run-time library of
your favorite high-level programming language. Upon completing this
course, students should be able to:

\begin{enumerate}
\item \textbf{OSTEP} \emph{Explain}, individually and in combination, the ``three
  easy pieces'' of operating systems: \emph{persistence},
  \emph{virtualization}, and \emph{concurrency} along with how
  \emph{abstraction} is an ever present \textbf{fourth} piece.
\item \textbf{Hardware} \emph{Explain} multiple instances of
  \emph{hardware assistance} required for various operating system
  mechanisms such as interrupts, context-switches, concurrency
  primitives, translation from a disk block number to a
  platter-track-sector coordinate, and limited-direct execution.
\item \textbf{System-level Programming} \emph{Implement} system
  simulations and write tools that interact with the operating system
  in the \lstinline{C++} language. This includes \textbf{locks},
  \textbf{file systems}, \textbf{scheduling}, and \textbf{memory
    address translation}.
\item \textbf{Low-level Execution} \emph{Trace} operating system
  actions from interrupt to completion, for example \textbf{context
    switching}, \textbf{page-based memory address translation}, and
  using \textbf{atomic} assembly instructions to implement safe
  concurrency.
\end{enumerate}

\paragraph{Note:} It would be a very good idea to review this section
of the syllabus before exams (especially the final). You can also use
it when filling out course evaluations to review what the class taught
and what it was expected to teach.

\subsection*{Computer Science Program Student Learning Objectives}

The Computer Science department has adopted five \textbf{program}
learning objectives for students completing any undergraduate major in
the department [See \href{url}{https://cs.potsdam.edu} for the complete
list.] \lstinline{Foundations of Computer Science} addresses PSLO \#1:

\noindent
Students graduating from the Computer Science department at SUNY
Potsdam are expected to be able to

\begin{quote}
  2. \emph{Solve problems through analysis and implementation of
    tested programs that use data structures and algorithms.}

  \textbf{System-level Programming} focuses on programming in
  \lstinline{C++} to learn how operating systems work.

  3. \emph{Program the multiple layers (e.g., compiler, operating
  system, network, assembly language) between a high-level programming
  language and the underlying hardware.}

  \textbf{OSTEP} outlines the multiple layers in an operating system
  and \textbf{Hardware} explores the interface to the lowest
  layers. Both \textbf{Low-level Execution} and \textbf{System-level
    Programming} work with the \emph{interfaces} for programming at
  lower levels of abstraction.

\end{quote}


\section*{Feedback}
It is important to me (Dr. Ladd) that you \emph{learn} how operating
systems work, how to interact with them programmatically, and how to
communicate about related technical topics. This is a 300-level, core
course in the Computer Science majors and one of the points where a
non-Java programming language is introduced.

To the end of learning to \textbf{think} about operating systems and
\textbf{communicate} that thinking, you will be doing a lot of
programming, a lot of reading, and a lot of group work. The
assignments are designed to reinforce each other: the readings explain
topics explored in the programs which build on exercises you have done
in groups.

There are also \emph{reflection} exercises, small written responses
where you will explain what (and sometimes how) you learned the
material. Reflection is \textbf{very important}: cognitive scientists
have shown that reflection greatly improves the fixation of new
knowledge for the learner; your answers provide me with a moving
snapshot of how you are learning.

You are also expected to write \emph{readable} code. Comments, white
space, appropriate variable names, appropriate scope of functions
(single-concern), etc.

\subsection*{Grading}

You will be assigned a grade at the end of the semester as that is
required. I am much more interested in what you learn than in
putting a number on it.

\begin{tabular}{lr}
  Reading&\textbf{No Grade}\\
  Homework&10\%\\
  In-class Work&10\%\\
  Programs&40\%\\
  Exams&20\%\\
  Final Exam&20\%\\
\end{tabular}

\begin{description}
\item[Reading] Not optional but not directly graded, the readings of
  the text, assignments, and other provided information are provided
  to give you something to \textbf{think} about OS. Note that
  \textbf{Reflection} will often require you to refer to recent (and
  not-so-recent) readings to provide evidence for your thinking.

\item[Homework] Designed and assigned to help you grow your knowledge
  about \emph{operating systems}, this is primarily
  \textbf{practice}. That does not mean \emph{optional}: just as
  playing an instrument, speaking a foreign language, or participating
  in a sport requires practice, so, too, does learning something as
  involved as OS.

  Cognitive science shows that thinking about thinking
  has an outsized impact on learning. Guided reflection, where you are
  asked to think about specific questions about the material and what
  you know about it is a way that I can teach you how to self-reflect
  for learning deeper in the future. This carries a grade; it will
  come from the seriousness with which you approach the process and
  the \textbf{evidence} you bring to any statements that you make.

\item[In-class Work] To include group work. This, too, is practice for
  you. The point of doing it in class? So that I can ask, ``What makes
  you say that?`` as I eavesdrop or you present your answers to the
  class. I will be using a class roster to select call-on-order so
  that I do not default to the first (or last) raised hand.

\item[Programs] Programs for learning C++ and several multi-week
  projects.

  \textbf{It is imperative that you read assignments when they are
    assigned!}

  Some assignments will have \emph{multiple phases}, perhaps a design
  document and then working code or a test plan. Always read the
  assignment as early as possible so that you can ask questions if you
  happen to not understand it and also so the your subconscious can be
  plugging away at it in the background.

  All programs \textbf{must} compile so that I have something to
  assess. If you have been given tests, those are expected to pass,
  too. I count on \emph{you} to start early enough that if you run
  into problems, you can \textbf{talk to me}.

\item[Quizzes, Exams \& Final] Exams are my chance to assess what you
  know from reading, doing the homework, programming, and the work in
  class. They are done without access to ChatGPT or
  StackOverflow. Thinking about operating systems still requires
  facility with \emph{details}. Expect a majority of the questions to
  be \emph{novel}, compared to previous in-class and home work.
\end{description}

\section*{Textbook and Readings}

Arpaci-Dusseau, R. and Arpaci-Dusseau, A., \emph{Operating Systems:
  Three Easy Pieces 1.01E}.

\emph{Operating Systems: Three Easy Pieces} (OSTEP) is available for
free on-line: \url{https://pages.cs.wisc.edu/~remzi/OSTEP/}; that page
also has references for electronic and print copies from various
locations.

\textbf{Readings} are a primary way you will learn the material is
this course. You should make sure you read assigned sections
\emph{before} class to activate your brain in the realm of operating
systems. You will probably have to read any given chapter two or three
times to integrate the information; this is normal when
\emph{learning} something for the longer term.

% -------------------------------------------------------------------
\section*{Schedule}
\definecolor{learning}{rgb}{0.2, 0.0, 0.5}
\definecolor{due}{rgb}{0.0, 0.5, 0.2}
\definecolor{exam}{rgb}{0.5, 0.2, 0.0}
\definecolor{break}{rgb}{0.5, 0.5, 0.5}
\newcommand{\rd}[1]{\textbf{Read:} #1}
\newcommand{\wt}[1]{\textbf{Watch:} #1}
\newcommand{\fm}[1]{\textbf{Forum:} #1}
\renewcommand{\wr}[1]{\textbf{Write:} #1}
\newcommand{\rr}[1]{\textbf{Rewrite:} #1}

\begin{center}
  \begin{tabular}{|r|c|l|}
  \hline
  \multicolumn{1}{|c|}{\textbf{Week}}&
  \multicolumn{1}{c|}{\textbf{Unit Concept}}&
  \multicolumn{1}{c|}{\textbf{Topics}}\\\hline

  1&\multirow{8}{*}{\makecell{\emph{Getting Started}}} % Unit Concept
   &{\scriptsize\makecell[lt]{\textbf{Programming in C++}\\Course Introduction\\C++ and
  \lstinline|make|\\TDD in C++}} % Topics for week
  \\ % Media and Assignments
  \cline{1-1}\cline{3-3}

  2& % Unit Concept
   &{\scriptsize\makecell[lt]{\textbf{What is a
     \emph{computer}?}\\Three Easy Pieces --- The
  Hardware\\Hardware, Software\\The
  \lstinline|List| ADT}} % Topics
  \\ % Assignments
  \cline{1-1}\cline{3-3}

  3&
   &{\scriptsize\makecell[lt]{\textbf{What is an \emph{operating
     system}?}\\Resource Manager\\Interrupts\\\color{exam}{Exam
  1: High-level Operating Systems}}} % Topics
  \\ % Assignments
  \hline

  4&\multirow{8}{*}{\makecell{\emph{Persistence}}} % Unit Concept
   &{\scriptsize\makecell[lt]{\textbf{I/O
     Devices}\\Device Interface\\Using What We Know\\File and \emph{Directory}
  API}} % Topics for week
  \\ % Media and Assignments
  \cline{1-1}\cline{3-3}

  5& % Unit Concept
   &{\scriptsize\makecell[lt]{\textbf{File System
     Implementation}\\What is a \emph{File}?\\Finding the
  \lstinline|inode|\\What is slow?}} % Topics
  \\ % Assignments
  \cline{1-1}\cline{3-3}

  6& % Unit Concept
   &{\scriptsize\makecell[lt]{\textbf{Faster, Bigger, Safer}\\What is
  \emph{still} slow?\\What could go wrong?\\\color{exam}{Exam 2: Persistence}}} % Topics
  \\ % Assignments
  \hline

  7&\multirow{8}{*}{\makecell{\emph{Virtual}\\\emph{Processors}}} % Unit Concept
  &{\scriptsize\makecell[lt]{\textbf{Programming w/
    Processes}\\\color{break}{Fall Break}\\Context,
  \emph{k-stack}, Switch\\\lstinline|fork|, \lstinline|exec|}} % Topics for week
  \\ % Media and Assignments
  \cline{1-1}\cline{3-3}

  8& % Unit Concept
   &{\scriptsize\makecell[lt]{\textbf{Code as Data}\\Program
  $\Rightarrow$ Process\\Who's Next: Scheduling\\Batch Scheduling}} % Topics
  \\ % Assignments
  \cline{1-1}\cline{3-3}

  9&
   &{\scriptsize\makecell[lt]{\textbf{Scheduling}\\MLFQ I\\ MLFQ
    II\\\color{exam}{Exam 3: Virtual Processors}}} % Topics
  \\ % Assignments
  \hline

  10& \multirow{11}{*}{\makecell{\emph{Virtual}\\\emph{Memory}}} % Unit Concept
   &{\scriptsize\makecell[lt]{\textbf{Address Spaces}\\Virtual
  $\rightarrow$ Physical\\Segments in Virtual Memory\\More and More Segments}} % Topics for week
  \\ % Media and Assignments
  \cline{1-1}\cline{3-3}

  11& % Unit Concept
   &{\scriptsize\makecell[lt]{\textbf{Paging}\\No \emph{External}
  Fragmentation\\Page Table Translation\\Table Lookaside Buffer}} % Topics
  \\ % Assignments
  \cline{1-1}\cline{3-3}

  12& % Unit Concept
   &{\scriptsize\makecell[lt]{\textbf{Paging and the Heap}\\Address
  Translation\\\lstinline|malloc|/\lstinline|free|\\Fragmentation Redux}} % Topics
  \\ % Assignments
  \cline{1-1}\cline{3-3}

  13&
   &{\scriptsize\makecell[lt]{\textbf{Thanksgiving}\\\color{exam}{Exam
  4: Virtual Memory}\\\color{break}{Thanksgiving}\\~}} % Topics for week
  \\ % Media and Assignments
  \hline

  14&\multirow{6}{*}{\makecell{\emph{Concurrency}}}
   &{\scriptsize\makecell[lt]{\textbf{The Parallelism
     \emph{Problem}}\\What could go wrong?\\Atomic
  Instructions\\Tracing Concurrency}} % Topics
  \\
  \cline{1-1}\cline{3-3}

  15& % Unit Concept
   &{\scriptsize\makecell[lt]{\textbf{Building Locks}\\Atomic
  Assembler $\rightarrow$ Lock\\Locks, Queues, Process State\\\textbf{Deadlock}}} % Topics
  \\ % Assignments
  \hline

  Exam
  &\multicolumn{2}{c|}{{\makecell[lt]{}}}\\
  \hline
  \end{tabular}
\end{center}

% -------------------------------------------------------------------
\section*{General Rules}

Your choices make your fate. Information arms you to make your best
decisions and enjoy the best fate. This section describes the class
expectations so that you can meet them (or decide not
to).

\subsection*{Instructor Expectations of Students}
\label{sec:instr-expect}

\subsubsection*{Communication}
\label{sec:communication}

Read/respond to e-mail. Read/respond to the course Moodle site. These
are the two primary means of communication in the class. You should
make use of them.

Moodle is the communications hub of this class. It is where readings,
writings, programs, presentations, and homework deadlines appear. If
you find any discrepancies or have questions about due dates or the
meaning of assignments \textbf{ask in person, in class, or in
  e-mail}. My office hours are listed in my Moodle profile.

Students are expected to have a copy of the textbooks (if any) and are
expected to complete reading assignments \emph{before} the beginning
of class the day they are due. In-class participation requires you to
have engaged the reading.

Students are expected to listen actively in class. They are also
expected to take notes in class. These two activities (which are
linked) correlate strongly with understanding the material
presented. Do not copy slides or board notes directly: digest them and
restate them in your own words. Mark where you expect test questions
to lurk (sometimes the instructor will even help with this).

Advanced courses often use a version control system (such as
\texttt{git}) to retrieve and submit source code and programming
assignments. This requires you to understand how to use \texttt{git},
to understand the difference between the \emph{class} repository
(which belongs to the instructor) and \emph{assignment} repositories
(which belong to you).

\subsubsection*{Attendance}

American undergraduates are old enough to join the army, vote, and
even get married. You are each mature enough to make your own
decisions about attending class. Be aware that you decisions have
\emph{consequences}.

Students are expected to attend every class. Students are responsible
for all material covered in every class meeting. There is no taking of
attendance in this class (see `old enough' in the previous paragraph).

The study of computer science is cumulative; past experience shows a
strong correlation between high absences and low grades.

The registrar schedules the final exams every semester; I am not able
to move them and do not give early finals. Take-home final exams are
due \emph{before} the end of the scheduled exam period (it \emph{will}
be accepted early).

\subsubsection*{Do Your Own Work}

Do your own work. That should go without saying but it appears that
for some students it bears repeating. Doing your own work means
\textbf{not} using online resources such as \lstinline{chegg.com} to
look up answers or asking \emph{ChatGPT} (or the generative AI of the
moment) to solve problems or design code. Those constitute
\textbf{academic dishonesty.}

Code you plan to turn in for an individual grade should not be shared
with any other student; you should never look at another student's
project code, not even for `guidance.'

I \emph{want} you to discuss assignments and show off results of your
playing with programming different things. Discussion at a high-level,
even if it includes details on data structures is fine; debugging
assistance is also acceptable though the depth of code analysis
necessary for debugging skates on thinner ice; directing someone else
on exactly what methods a given class should have or the exact format
of a programmer-controlled file should take is beyond the pale.

This does \emph{not} apply to group work: in a group project, all
members of the team are expected to see and understand all parts of
the project. Cross-disciplinary understanding is a highly valued skill
in the real world and a major reason for group work in our curriculum.

\subsubsection*{Turning In Work}
Start early, everything takes longer than you think.

As mentioned earlier, reading is to be done \emph{before}
class. Homework assignments are also due at the beginning of class so
please complete them before class.

Assignments have a due time: a date and a time when they are due. If
they are due electronically (they all are), make sure you submit them
the expected way by the expected hour.

Make sure you check the spelling and arithmetic in your
assignments. It does not help your grade (or my mood) to turn in
sloppy work.

\subsubsection*{Attitude}

Learning is not always easy. Learning is not always
comfortable. Students must actively engage the material and be able to
ask for help. This does not mean look at the problem for fifteen
seconds and throw up your hands because it is `hard.' It does mean
beating your head against it for a bit and then asking me for
guidance.

Be respectful. Trust me that I actually have a plan and I know where
we are going (okay, I don't \emph{always} know exactly where we are
going at every moment but I do have a plan). The readings, the
assignments, the lectures, they all go together.

\textbf{Start early!} Everything takes longer than you think.


\subsection*{Student Expectations of the Instructor}
\label{sec:stud-expect-instr}

\subsubsection*{Communication}

You may expect me to state and keep office hours (you know where my
office is, right? 301 Dunn Hall) They are part of my Moodle profile.

You may expect fairly prompt answers to e-mail (next morning is
typical).

You may expect confidentiality: I will not discuss your grades with
anyone except my departmental colleagues (and then only to make sure
that I am doing my job correctly). I will not share work you have done
without your permission.

\subsubsection*{Attendance}
\label{sec:attendance}

You may expect me to be prepared. This means for class every day and
it means with assignments, too. You should expect adequate time to
complete an assignment after it is published. You may expect some
flexibility (with in the limitations of getting through the course
materials) in due dates.

\subsubsection*{Assignments}
\label{sec:assignments}

Expect assignments to be clear (correct spelling, correct
grammar). Expect most sample code to compile and run. Expect
assignments to be accompanied by a clear system by which they will be
evaluated. Expect me to follow that system.

Students should expect that their work will be evaluated on its own
contained merits and not based on how closely it follows the
instructor's personal/political views (unless I put parroting my
political views into the rubric).

\subsection*{Student Expectations of One Another}
\label{sec:stud-expect-one}

Wait, students have expectations of one another? Yes, they should. The
most important expectation we should all have of each other is to
create a safe learning environment. By safe I mean we should all feel
safe to ask questions, to admit mistakes, to try and to be wrong.

Students should be willing to help one another and should all be aware
of the limits.

In group work, all students in the group should expect equitable
division of labor and should expect to evaluate every member of the
group.

Students should expect to evaluate other students'' work (and to be
evaluated by other students). Both parts of this process have valuable
learning outcomes.

Students should expect to feel safe being different. What does this
mean in computer science? I actually am not sure. It means respecting
each other, evaluating each other in openly communicated terms related
to computer science (since that is the topic of the course), and being
flexible, accommodating each other whenever possible.

\section*{Grading Grievances}
When graded work is returned you may have questions about how it was
graded. If the question pertains to process (\emph{e.g.,} addition,
number of points per subsection), by all means ask me as soon as
possible. Typically, if the grade is changed, you will be asked to
e-mail me the grade update so that the Moodle grade book is current.

If, however, you feel that your grade fails to reflect the quality of
your work (you want to argue that your answer is, in fact, correct,
rather than incorrect), take a deep breath and wait. You must wait no
less than one and no more than seven days after the work is returned
to you to raise the issue with me.

After the cooling-off period, resubmit the work along with a
\emph{written} explanation of your concern. This is to assure that
your concern gets a cool, thoughtful consideration. If I agree to
regrade the work, I will regrade the entire project, replacing the old
grade with the new one.

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
