Introduction

Welcome to CMSI 387: your portal into the outstanding world of operating systems!

Before we get started, some things to note about these course notes and the site you're currently viewing:

  • You can add notes inside the website so that you can follow along and type as I say stuff! Just hit SHIFT + N and then click on a paragraph to add an editable note area below. NOTE: the notes you add will not persist if you close your browser, so make sure you save it to PDF when you're done taking notes! (see below) Having said that, know that there is a lot of research that suggests taking hand-written notes to be far more effective at memory retention than typing them.

  • The site has been optimized for printing, which includes the notes that you add, above. I've added a print button to the bottom of the site, but really it just calls your printer functionality, which typically includes an option to export to PDF.

  • The coursenotes listed herein will have much of the lecture content, but not all of it; you are responsible for knowing the material you missed if you are absent from a lecture.

Any time you see a blue box with an information symbol (), this tidbit is a definition, factoid, or just something I want to draw your attention to; typically these will help you with the conceptual portions of the homework assignments.

Any time you see an orange box with a cog symbol (), this tidbit is a useful tool in your programming arsenal; typically these will help you with the concrete portions of your homework assignments.

Any time you see a red box with a warning symbol (), this tidbit is a warning for a common pitfall; typically these will help you with debugging or avoiding mistakes in your code.

Any time you see a yellow question box on the site, you can click on it...

...to reveal the answer! Well done!


For those of you viewing from home, at this point we'll review the class syllabus, located here:

 Syllabus


To get a gist for everyone's coding background, we'll also be performing the dreaded ice-breaker exercise! Tell me your:

  • Name

  • Year

  • If you've had experience programming in C

  • [To start an early flame war] Your favorite OS, and why?



What is an Operating System?

Certainly a reasonable question to ask, and somewhat difficult to answer! In general, there is no "universal definition" for an OS.

Defining what, precisely, an operating system is will differ from application to application (e.g., a PC vs. an embedded system), but there are certain characteristics common to almost every OS.


OS Overview


An Operating System (OS) can be defined, at some high level, by some of its properties:

  • An operating system is the one program that is running at all times on a computer.

  • An operating system is the program that executes all other programs.

  • An operating system is the program that provides the bridge between running software and the computer's hardware.

Modern Operating Systems include Microsoft Windows, Mac OS X, and a variety of Linux variants such as Ubuntu and Fedora.

Time for some definitions to formalize the above!

The OS kernel is the part of the OS that is always an active program.

Systems Programs are those that are associated with the functions of the OS, and provide platforms on which application programs are run, but are not part of the kernel.

Device Drivers are systems programs that provide a software interface to different computer hardware peripherals, keyboards and scanners.

Game Graphical Engines are systems programs that provide rendering, physics, and other foundational graphical elements for video game design.

Application Programs are all other programs not associated with the OS, like Microsoft Word.

In gist, the goal of the kernel and systems programs are to effectively serve all application programs from users.

We can think of application programs being built atop the operating system, which is built atop the hardware.

How do we typically view the "hardware" of a computer from the software viewpoint? Through what model, and what are its components?

The Von Neumann Architecture, in which we view hardware as composed of the CPU, Main Memory, and I/O (everything else).


That's a lot to digest! Let's take a pictorial perspective... a pictspective?


Looking at the above, what are some reasonable responsibilities for an OS?

  • *Process management, determining which programs gain access to processor time as a shared resource.

  • *Memory management, determining which programs obtain how much memory, when it can be acquired, and when released.

  • *File system management, determining how files are organized in disks, fetched, and then stored.

  • Peripheral interfacing, via device drivers.

  • Security, ensuring that vital OS processes are not tampered with.

  • etc.

* This class will focus on the first three important facets of an OS's responsibilities, though there are many other important roles they serve.


What this class is and is not


This class is an examination of the critical roles that an OS plays, and solutions to some of the algorithmic challenges faced along the way.

This class is NOT one in which we build our own OS (too cumbersome a goal for a 1 semester undergraduate class).

At points in the class, we'll have opportunities to build and modify small aspects of an existing OS, but will not have time to build anything from the ground-up.



OS Interaction

As earlier intimated, the goal of an OS and system programs are to provide platforms for the operation of applications; but who's running these applications, and how?

Why, the users of course!

From an OS perspective, a user is an individual who is employing the resources of a system, typically by using applications.

Most modern OS's are said to support multi-user software (capable of allowing multiple individuals to share a system's resources at once, like a server) and a multi-program environment (in which multiple applications may be running at once, but must share system resources).

Naturally, then, we should be curious how a user interacts with the OS and employs the resources of the system.

A user interface provides a bridge between the computing resources available to a user and the means by which a user can attain and command those resources.

What are the typical classes of user interfaces in computer systems?

  1. Graphical User Interfaces (GUIs) like windows that are commanded by mouse and keyboard

  2. Command Line Interfaces (CLIs) like command prompt and terminal, which are text-based and interacted with via the keyboard.

GUIs are beneficial for ease of interaction and appeal to a wide audience of users, including non-technical ones.

CLIs are beneficial for greater or customized control over the system at the cost of needing to learn and type certain non-trivial commands.

Most of us are familiar with GUIs from day-to-day computing, but this class will instill the value and power of CLIs in companion to a variety of important OS topics.


Shells


Shells are CLIs that provide a user interface unto the services offered by the OS.

For Windows OS's, you might be familiar with the command prompt, which is a CLI with Windows-specific commands.

For this class, we will begin by investigating the Unix shell known as bash.

Bash (Bourne-Again Shell) is a system shell used on a variety of Unix-based platforms (like Linux and OS X variants).

Bash provides a CLI for advanced OS mechanics, and will serve as a good launching pad for topics in this class.

As such, the first portion of this class will be devoted to OS "Power-Use", i.e., the ability to adeptly and efficiently navigate the tools provided by an OS via a popular CLI.

So, what OS will we begin by exploring, and how?



About Linux

Linux is the name of a class of open-source operating systems built around the Linux kernel, which was originally developed (and has since been community-curated and updated) by Linus Torvalds in 1991.

Unlike proprietary OS's like Windows and Mac OS X, Linux distributions are a palatable choice for an OS class for a variety of reasons:

  • Primarily: They are free and open-source, meaning that we can acquire and modify them at no cost. In this course, we will modify some components of a Linux distribution and see how our changes are manifest.

  • Linux and Mac OS X share a common ancestor in the Unix OS family, originally developed in 1970 for use in Bell Labs -- learning about the Linux environment will provide much of the same information about OS X as well.

  • Linux (primarily through bash) provides much transparency into running processes, managed memory, and core systems files that can otherwise be occluded in other OS's.


Installing Linux


Since everyone in class has different native systems on their computers, we'll start out with a distribution of Linux running on a Virtual Machine.

A virtual machine (VM) is an emulation of a computer system within the context of a running one.

Using a VM, we "trick" the OS running inside of the VM to think that it is its own computer, when in fact, the resources of a "host" computer are merely being shared with it.

Using this approach, we can run a VM with a Linux distribution within your own Windows or Mac OS's to do our work for this class -- we will make OS sandboxes!

The Oracle VirtualBox VM is well suited for this purpose, and installation instructions can be found below.


Before Lecture 2R, please have a flavor of Linux installed on your computer (e.g., via a Virtual Machine [like VirtualBox] or Boot Partition). If you need help with this, see me, but otherwise, the web is your friend -- Googling will get you to where you need to go!

In the first parts of class, we will be using the VirtualBox VM to run a distribution of Ubuntu for early examples.

Good VirtualBox Tutorial


  PDF / Print