Technical Women

011
Figure 1. Augusta Ada Lovelace King

$ ps -aux # Processes

  • Operating system abstractions.

  • Processes.

  • Inter-process communication (IPC).

  • Process examples.

$ cat announce.txt

  • If you are enrolled in the class you should be receiving course emails. If you would like to sign up for the email list, here is the link: https://www.ops-class.org/mailman/listinfo/ub

  • Syllabus is online and updated.

  • Videos are up. (Sorry they’re blurry—​we’ll fix that starting

  • today.)

  • Recitations will start next week.

  • The add/drop deadline is next Monday February 6th.

    • You still have time to examine the assignments and decide if this course is right for you right now.

ASST0

  • ASST0 is "due" today.

  • If you are not done, please come by office hours this afternoon to finish up.

  • Recitations next week will cover ASST1.

Office Hours Scheduling

  • A preliminary schedule will be up this evening.

  • Here’s the algorithm we’re going to use:

    • If you can attend at least four office hours, then stop.

    • If not, determine some extra hours that you would like to attend.

    • We will distribute a form for suggesting extra office hours.

    • Based on your suggestions we will add extra office hours.

Office Hours Protocol

  • Location—we’re going to try and use the first floor lounge this year. We’ll see how that goes.

  • Please be respectful of the TAs and ninjas:

    • Bother them relentlessly during office hours…​

    • and leave them alone outside of office hours.

Cold Calling

  • I will cold call students during class, possibly using a tool integrate with the slides.

  • Cold calling is not designed to make anyone uncomfortable! Feel free to pass or say "I don’t know."

Operating System Abstractions

Abstractions simplify application design by:
  • hiding undesirable properties,

  • adding new capabilities, and

  • organizing information.

Abstractions provide an interface to application programmers that separates policy—what the interface commits to accomplishing—​from mechanism—how the interface is implemented.

Example Abstraction: File

What undesirable properties do file systems hide?
  • Disks are slow!

  • Chunks of storage are actually distributed all over the disk.

  • Disk storage may fail!

What new capabilities do files add?
  • Growth and shrinking.

  • Organization into directories.

What information do files help organize?
  • Ownership and permissions.

  • Access time, modification time, type, etc.

Preview of Coming Abstractions

  • Threads abstract the CPU.

  • Address spaces abstract memory.

  • Files abstract the disk.

  • We will return to these abstractions. We are starting with an organizing principle.

thread

addressspace

file

The Process

Processes are the most fundamental operating system abstraction.
  • Processes organize information about other abstractions and represent a single thing that the computer is "doing."

  • You know processes as app(lication)s.

Organizing Information

Unlike threads, address spaces and files, processes are not tied to a hardware component. Instead, they contain other abstractions.

Processes contain:
  • one or more threads,

  • an address space, and

  • zero or more open file handles representing files.

process
Figure 2. The Process

Process as Protection Boundary

The operating system is responsible for isolating processes from each other.

  • What you do in your own process is your own business but it shouldn’t be able to crash the machine or affect other processes—or at least processes started by other users.

  • Thus: safe intra-process communication is your problem; safe inter-process communication is an operating system problem.

Intra-Process Communication: Easy

intraprocess
  • Communication between multiple threads in a process is usually accomplished using shared memory.

  • Threads within a process also share open file handles and both static and dynamically-allocated global variables.

  • Thread stacks and thus thread local variables are typically private.

Intra-Process Communication: Easy…​ Maybe

intraprocess
  • Sharing data requires synchronization mechanisms to ensure consistency.

  • We will return to this later.

Inter-Process Communication: Harder

interprocess
  • A variety of mechanism exist to enable inter-process communication (IPC), including shared files or sockets, exit codes, signals, pipes and shared memory.

  • All require coordination between the communicating processes.

  • Most have semantics limiting the degree to which processes can interfere with each other.

    • A process can’t just send a SIGKILL to any other process running on the machine!

$ wait # IPC: return codes

returncode
  • Simplest and most-limited form of IPC.

  • Allows processes to return a single int to the process that created them.

  • 0 typically indicates success; non-0, failure.

  • Analogous to older computers that would transform a set of punch cards into a "result."

  • bash exposes return codes as $?:

returncode bash

$ p | pes # IPC: pipes

pipes
  • Pipes create a producer-consumer buffer between two processes.

  • Allows the output from one process to be used as the input to another.

  • The operating system manages a queue for each pipe to accommodate different input and output rates.

  • Facilitates the canonical chaining together of small UNIX utilities to do more sophisticated processing.

Systems programming:

A series of pipes!

Next Time

  • Continue exploring the process abstraction and lifecycle.