% Class 4: Once Upon a Process
% David Evans
% 2013-09-10

<!--
Title: Class 4: Once Upon a Process
Date: 2013-09-10
Category: Classes
Tags: operating systems, processes, shell, bash, Wahoowa
Author: David Evans
Slug: class4
-->

## Action Items

<div class="startaction"></div>

Assignments due: [**Problem Set 1**](|filename|../../pages/ps/ps1/ps1.md) is
due on Tuesday, September 10 (11:59pm).  \footnotesize
 Note: given the instructor's belief that sensible countries should [have national holidays when they
qualify for world cups](http://espnfc.com/news/story?id=349349&cc=5901)
and that the [University should observe national holidays](http://www.cs.virginia.edu/~evans/cs200-spring2004/lectures/notes2.html), though, in the
event that the [US qualifies for World Cup 
2014](https://en.wikipedia.org/wiki/2014_FIFA_World_Cup_qualification_(CONCACAF)#Fourth_round)
before 11:59pm tonight, the assignment will be accepted without penalty
until 11:59pm tomorrow.  Before assuming you can safely rely on this, though, you
should carefully consider the US team's injury and yellow card
situation, and the likelihood that you'll have to deal with a grumpy
instructor if you are asking for an extension under the scenario where
the team fails to win tonight.\normalsize

**Problem Set 2** will be posted by Thursday and due on 24 September.
For PS2, you are **required to work with a partner** (you can choose on your
own), so try to find a partner you want to work with now.  To help find
a partner, you can use the [Piazza teammates
forum](https://piazza.com/virginia/fall2013/cs4414).    
<div class="endaction"></div>

# Processes

What is a process?

<div class="gap">
#
</div>

Some terminology (not really important, but you'll hear people use
them):

- **Multiprogramming** - program gets to run until it gets stuck, then
    supervisor takes over and selects another program to run.
- **Non-pre-emptive multi-tasking** (sometimes called _co-operative
    multi-tasking_ - program gets to run until it
    voluntarily gives control back to the supervisor.  (Sometimes used
    to mean the programs are all scheduled statically to recieve a
    particular processing time slice.)
- Normal (pre-emptive) **multi-tasking** - program gets to run until
    (approximately) supervisor decides its someone else's turn.

(For historical reasons, the terms and hyphenating-conventions are
confusing, using "program", "task", and "process" to essentially
interchangably, except that the historical term _multiprogramming_ is
different from _multitasking_.)

What are some consequences of the difference between _non pre-emptive
multi-tasking_ and _pre-emptive multi-tasking_?





![Imperious Interruptus](interruptus.png)


How often should the kernel timer interrupt (a.k.a., "supervisor's alarm
clock") go off?
<div class="gap">
#
</div>

What programs should be able to change the kernel timer interrupt frequency?

<div class="gap">
#
</div>

Who prefers the kernel timer interrupt interval to be shorter?  Who
prefers it to be longer?

<div class="gap">
#
</div>



### Links

I'm not certain this is completely reliable, but here's what I used to
determine the kernel timer frequency for my MacBook Air: [How To
determine Linux Kernel Timer Interrupt
Frequency](http://www.advenage.com/topics/linux-timer-interrupt-frequency.php)

    :::shell
    $ gcc timer.c ; ./a.out
    kernel timer interrupt frequency is approx. 4016 Hz or higher

It is worth a **midterm exemption** (and Rust sticker!) for the first
person (or team of two people) who writes an accurate kernel timer in
Rust.
