What is an Operating System?

Definition

Operating System: Program that runs on bare hardware to help bridge the gap between user and computer hardware.

Role & Goals

Role of the Operating System:

Goals of the Operating System:

Example: Hardware v.s. User Needs
ComponentCapabilitiesUser Needs
CPULow-level machine instructions.Arrays, lists, and other high-level data structures and operations.
Main memoryLinear sequence of addressable bytes / words.A heterogeneous collection of entities of various types and sizes, accessed by different operations.
Secondary storageMulti-dimensional structures that require complex sequences of low-level operations to store and access data organized in discrete blocks.Ability to access and manipulate programs and data without knowledge of disk organization.
I/O devicesOperated by reading and writing registers of the device controllers.Simple, uniform interfaces to access different devices without detailed knowledge of the access and communication protocols.

Kernel

Kernel: “The one program running at all times on the computer”

On Course Scope: For this class, we don’t care about:

The OS as an Extended Machine

Abstraction: Act of removing unimportant details or attributes of objects to make more general and less complex objects.

Example: Abstraction at the Programmer and User Level

User Abstraction: “Copy file f1 to file f2”

OS:

  1. Create file f2
  2. Open file f1 for reading
  3. Repeat for all blocks i of f1
  4. Read block i into memory buffer
  5. Allocate new block j for file f2
  6. Write memory buffer to block j

Programmer Abstraction: “Read block n into memory at location m

OS:

  1. Compute block location on disk
  2. Move read/write arm into position.
  3. Check for positioning errors.
  4. Transfer data to memory starting at m.
  5. Check for read errors.

Virtualization: Act of creating the illusion of having one or more objects with more desirable properties than the real object.

Example: Virtual memory

Virtual memory creates the illusion that each program has access to a large, contiguous address space, even though the actual physical memory may be fragmented, shared with other programs, or partially stored on disk.

Four Components of a Computer System

  1. User
  2. System & Application
  3. Operating System
  4. Hardware

What Operating Systems Do

Depends on POV.

User:

System:

Resource Management

OS as a Resource Manager:

Multiprogramming: Technique that keeps several programs active in memory and switches execution among the different programs to maximize the use of the CPU and other resources.

Time-Sharing (Multitasking): Extension of multiprogramming where the CPU is switched periodically among all active computations to guarantee acceptable response times.

Example: More on I/O and CPU-Bound

Suppose the following:

cpu-bound instruction 1
cpu-bound instruction 2
cpu-bound instruction 3
print(4)
cpu-bound instruction 5

print, in this example, is I/O bound (need to do the slow task of communicating to a peripheral to print).

Multiprogramming: When we hit print, we context switch to a separate process so CPU can stay busy with other CPU-bound instructions. Once the I/O bound portion is done, we signal we are done via interrupt, and the CPU will get back to us.

Time-Sharing: Imagine a timer on a process. When that timer runs out, the CPU will context switch to a different process and the process will have to wait for its turn.

Sequential: Run through processes sequentially. CPU simply waits through I/O instructions.

Example

Processes p1 and p2 share a single CPU and 2 independent I/O devices. Each process executes a compute-bound phase of 10 time units followed by an I/O bound phase of 10 units.

Sequential: 40 TU

CPUAB
IO 1A
IO 2B

Multiprogramming: 30 TU

CPUAB
IO 1A
IO 2B

Timesharing: 20 TU (if context switching is negligible)

CPUABAB
IO 1A
IO 2B

Startup

Bootstrap Program: Firmware that initializes all aspects of system.

Organization

Device controllers connect through common bus providing access to shared memory.

Operation

Device Controller:

Storage

Structure

CPU can load instructions only from memory.

Example: Starting an IO operation
  1. Device driver loads appropriate registers within the device controller
  2. Device controller examines contents of these registers to determine what action to take
  1. Controller starts transfer of data from device to local buffer.
  2. One transfer complete, device controller informs device drivers via interrupt it is finished.
  3. Device driver returns control to OS.

We can use DMA to speed this up.

Hierarchy

Ordered fastest to slowest and most expensive to cheapest:

  1. Registers
  2. Cache
  3. Main Memory
  4. SSD
  5. HDD
  6. Optical Disk
  7. Magnetic Tapes

Note: 1—3 are volatile, 4—7 are non-volatile.

Caching

Cache: Information in use copied from slower to faster storage temporarily.

Direct Memory Access (DMA)

Used for high speed I/O devices so that can transmit information at close to memory speeds.

Architecture

Many years ago, most systems only had one general-purpose processor (one CPU with a single processing core).

Multiprocessor: Growing in use and importance.

Two Types of Multiprocessors

Dual Core: Recent trend in TODO

Clustered Systems: Like multiprocessor, but it’s multiple systems instead.

Two Types of Clustered Systems: TODO

Major Functions of the OS

Reminder: Definitions

Things to Think About:

Memory Management:

Computing Environments

Traditional

We are used to standalone general-purpose machines.

Distributed

Collection of separate, possible heterogeneous, systems networks together.

Common Network Types:

Cloud

Deliver computing, storage, and/or apps as a service across a network.

Major Types:

  1. Public: Available to anyone willing to pay
  2. Private: Run by a company for internal use.
  3. Hybrid: Includes public and private cloud components.

Service Types:

Real-Time Embedded Systems

Special/limited purpose computers.

Examples: Embedded systems

Open Source Operating Systems

Make available in source-code rather than just binary closed-source.

Examples: Open Source OSes