L1 - Introduction
L1 - Introduction
Introduction to OS
Lecture 1
1
Overview
Operating Systems basic concepts:
What is OS?
Brief History
Motivation for OS
Overview of Modern OSes
Virtual Machines
[ CS2106 L1 - AY2021 S1 ]
2
What is OS?
Incorrect/Incomplete definition:
It is the desktop when you boot up your PC
The "thing" that stores your games
Windows! (or Mac! ) (or Linux!)
Operating System
Hardware
A simplified view:
Will be refined as we move along
[ CS2106 L1 - AY2021 S1 ]
4
Example of Common OS
On Computer:
Windows 10/9/8/XP
Mac OS X
Linux distros: Ubuntu, Redhat, CentOS, Debian
Solaris
On Smartphone:
iOS, Android, Windows Mobile
[ CS2106 L1 - AY2021 S1 ]
5
To invent the future, you must understand the past
BRIEF HISTORY OF OS
[ CS2106 L1 - AY2021 S1 ]
6
Brief History of OS
Essentially, OS evolves with:
Computer hardware
User application and usage pattern
Harvard Mark I:
1944
[ CS2106 L1 - AY2021 S1 ]
7
OS for the first computers
OS Type: User Program
NO OS
Hardware
Advantage:
Minimal overhead
Disadvantage:
Not portable
[ CS2106 L1 - AY2021 S1 ]
8
Mainframes: The "Big Iron"
Commonly used by large corporations in 60s, 70s
Common features:
No interactive interface
Accept programs in the form of:
Paper tape, magnetic tape, punch card
Support batch processing only
Very costly
Usually "rented" instead of owned
Example:
IBM 360
Cost 5 billion US dollars in 1964
[ CS2106 L1 - AY2021 S1 ]
9
OS for Mainframes
OS Type:
Batch OS User Program
OS
Hardware
Batch OS:
Execute user program (a.k.a job) one at a time
Load job from media, execute, collect result
User Job:
Still interact with hardware directly
With additional information for the OS
Resource required
Job specification
[ CS2106 L1 - AY2021 S1 ]
10
OS for Mainframes: Improvements
Simple batch processing is inefficient:
CPU idle when perform I/O
[ CS2106 L1 - AY2021 S1 ]
11
Time-Sharing OS
Features:
Allow multiple users to interact with machine using terminals (teletypes)
User job scheduling
Illusion of Concurrency
Memory management
Famous Examples:
CTSS developed at MIT 1960s
Multics (1970s)
Considered as the parent of Unix
Pushed the state of art in virtual memory, security
Not so different from using Unix servers today but more primitive
[ CS2106 L1 - AY2021 S1 ]
12
Time-sharing OS: Illustration
☺ ☺ ☺ Multiple Users
Programs
UP UP …. UP initiated by user
OS
Hardware
Virtualization of hardware:
Each program executes as if it has all the resources to itself
[ CS2106 L1 - AY2021 S1 ]
13
Minicomputer and Unix
Minicomputer follows the mainframe:
A "mini" version of mainframe:
Smaller and cheaper
Example:
Digital Equipment Corp (DEC) PDP-11
Famous OS:
Unix
Developed by AT&T employees, including Ken Thompson, Dennis Ritchie,
Douglas McIlroy, and Joe Ossanna
Ken Thompson and Dennis Ritchie
Invented the C programming language as well!!
[ CS2106 L1 - AY2021 S1 ]
14
Personal Computer
Apple II PC:
First successfully produced mass home computer
Designed by Steve Wozniak (alone!)
IBM PC:
The first generic PC
PC becoming truly a collection of commodity hardware components
Leads to dominance of Microsoft OS in PCs: MSDOS then Windows
[ CS2106 L1 - AY2021 S1 ]
15
OS on Personal Computer
Machine (can be) dedicated to user, not timeshared between
multiple users
Give rise to personal OS
Several Models:
Windows model:
Single user at a time but possibly more than 1 user can access
Dedicated machine
Unix model:
One user at the workstation but other users can access remotely
General time sharing model
[ CS2106 L1 - AY2021 S1 ]
16
Why do we need OS?
MOTIVATIONS OF OS
[ CS2106 L1 - AY2021 S1 ]
17
Motivation for OS: Abstraction
Large variation in hardware configurations
Provides:
Efficiency and portability
[ CS2106 L1 - AY2021 S1 ]
19
Motivation for OS: Resource Allocator
Program execution requires multiple resources:
CPU, memory, I/O devices etc
OS is a resource allocator
Manages all resources
CPU, Memory, Input/Output devices
Arbitrate potentially conflicting requests
for efficient and fair resource use
[ CS2106 L1 - AY2021 S1 ]
20
Motivation for OS: Control Program
Program can misuse the computer:
Accidentally: due to coding bugs
Maliciously: virus, malware etc
OS is a control program
Controls execution of programs
Prevent errors and improper use of the computer
Provides security and protection
[ CS2106 L1 - AY2021 S1 ]
21
Motivation for OS: Summary
Manage resources and coordination
process synchronization, resource sharing
Simplify programming
abstraction of hardware, convenient services
Enforce usage policies
Security and protection
User Program Portability:
Across different hardware
Efficiency
Sophisticated implementations
Optimized for particular usage and hardware
[ CS2106 L1 - AY2021 S1 ]
22
The families of modern OS
OVERVIEW OF MODERN OS
[ CS2106 L1 - AY2021 S1 ]
23
Modern OS: Overview
PC
[ CS2106 L1 - AY2021 S1 ]
24
Common Architecture for OS
OS STRUCTURE
[ CS2106 L1 - AY2021 S1 ]
25
Operating System Structures
We have identified the major capabilities of an OS
i.e. the specification of the OS
[ CS2106 L1 - AY2021 S1 ]
26
Illustration: High level view of OS
PowerPoint Chrome DOTA
User
Mode
User Interface Software
Kernel
Mode Operating System
Hardware Hardware
OS
A B B
Hardware
[ CS2106 L1 - AY2021 S1 ]
28
OS as a Program
OS is also known as the kernel
Just another program with some special features
Deals with hardware issues
Provides system call interface
Special code for interrupt handlers, device drivers
Consider this:
Normal programs use OS: what does OS use?
[ CS2106 L1 - AY2021 S1 ]
29
Implementing Operating System
Programming Language: Common code organization:
Historically in assembly/machine 1. Machine independent HLL
code 2. Machine dependent HLL
Now in HLLs: 3. Machine dependent assembly
Especially C/C++ code
Heavily hardware architecture Challenges:
dependent
“No one else” to rely on for nice
services
Debugging is hard
Complexity
Enormous Codebase
[ CS2106 L1 - AY2021 S1 ]
30
OS Structures
Several ways to structure an OS:
Monolithic
Microkernel
Layered
Client-Server
Exokernel
etc
[ CS2106 L1 - AY2021 S1 ]
31
Monolithic OS
Kernel is:
One BIG special program
Various services and components are integral part
Good SE principles is still possible with:
modularization
separation of interfaces and implementation
This is the traditional approach taken by:
Most Unix variants, Windows NT/XP
Advantages:
Well understood
Good performance
Disadvantages:
Highly coupled components
Usually devolved into very complicated internal structure
[ CS2106 L1 - AY2021 S1 ]
32
Monolithic Kernel Illustration
User
User Programs Mode
Device Driver
Hardware
Advantages:
Kernel is generally more robust and more extendible
Better isolation and protection between kernel and high level services
Disadvantages:
Lower Performance
[ CS2106 L1 - AY2021 S1 ]
34
Microkernel Components
User Programs
Kernel
Hardware Mode
[ CS2106 L1 - AY2021 S1 ]
35
Other Operating System Structure
Layered Systems:
Generalization of monolithic system
Organize the components into hierarchy of layers
Upper layers make use of the lower layers
Lowest layer is the hardware
Highest layer is the user interface
Client-Server Model
Variation of microkernel
Two classes of processes:
Client process request service from server process
Server Process built on top of the microkernel
Client and Server process can be on separate machine!
[ CS2106 L1 - AY2021 S1 ]
36
Ways of running OSes
VIRTUAL MACHINES
[ CS2106 L1 - AY2021 S1 ]
37
Motivation: Why Virtual Machines
Operating system assumes total control of the hardware:
What if we want to run several OSes on the same hardware at the
same time?
[ CS2106 L1 - AY2021 S1 ]
38
Definition: Virtual Machine
Virtual Machine:
A software emulation of hardware
Virtualization of underlying hardware
Illusion of complete hardware to level above: memory, CPU, hard disk etc…
Normal (primitive) operating system can then run on top of the virtual
machine
[ CS2106 L1 - AY2021 S1 ]
39
Type 1 Hypervisor
UP UP UP UP
Type 1 Hypervisor
Hardware
Type 1 hypervisor:
Provides individual virtual machines to guest OSes
eg. IBM VM/370
[ CS2106 L1 - AY2021 S1 ]
40
Type 2 Hypervisor
UP UP UP
Guest OS
Type 2 Hypervisor
Hardware
Type 2 hypervisor OS
Runs in host OS
Guest OS runs inside Virtual Machine
e.g. VMware
[ CS2106 L1 - AY2021 S1 ]
41
Summary
Definition of Operating System
[ CS2106 L1 - AY2021 S1 ]
42
Reference
Modern Operating System (4th Edition)
By Andrew S.Tanenbaum
Published by Pearson
[ CS2106 L1 - AY2021 S1 ]
43
FYI: MODERN OS FAMILY
(AS OF 2016)
[ CS2106 L1 - AY2021 S1 ]
44
Modern OS: An Overview
Several dominant desktop OSes:
Microsoft Windows family
Unix and its variants
Mac OS family
Specialized OSes:
Real-time OS
Embedded System OS
Mobile OS
Distributed OS
[ CS2106 L1 - AY2021 S1 ]
45
Microsoft OS Family
16-bit:
MS-DOS (various versions, v1.0 in 1985)
Windows 1.X – 3.X, Windows 9X, Windows ME (2000)
32-bit:
Windows NT (32-bit, v3.1 in 1994)
Windows 2000, XP, 2003, Vista, 7, 8, 10 (2015)
64-bit:
Windows XP (2005), Vista, 7, 8, 10 (2015)
[ CS2106 L1 - AY2021 S1 ]
47
Unix and its Variants
Many Unix Variants:
Unix System V versions
Sun Solaris
Linux
[ CS2106 L1 - AY2021 S1 ]
48
Unix Variants: Rough timeline
[ CS2106 L1 - AY2021 S1 ]
51
Characteristics of Modern PC OS
Multitasking:
Concurrent execution of programs
On multiple cores
Multi/single user:
Unix usually multi-user
Windows usually single-user at a time
Examples:
Critical Systems: aircraft flight system, nuclear power plant, radar system
Consumer appliances: mobile phones, mp3, video players
Examples:
(Older)Smartphones, microwave oven, car, smart cards, game consoles,
etc
Usually:
Not general purpose: cannot run any application
Cannot be modified: Mostly stored in Read-Only Memory (ROM
[ CS2106 L1 - AY2021 S1 ]
54
Mobile OS
OS for smartphones, tablets, PDAs, or other mobile devices
Examples:
Android, iOS, Windows Phone, etc
Characteristics:
Essentially a customised version of PC OS
Common features: Touchscreen, Cellular, (Video) Camera, etc…
[ CS2106 L1 - AY2021 S1 ]
55
Distributed OS
OS for computers/processors connected using network
Loosely or Tightly coupled
Loosely coupled:
Autonomous nodes, network may be wide area
Communication is asynchronous
Reliability issues:
communication may not be reliable, nodes may fail
Resources are distributed
eg. distributed filesystem, P2P storage
Tightly coupled:
Specialized node (e.g. Computing nodes) that shares other resources (e.g. Memory / Harddisk
etc), nodes in close proximity
Examples:
Tembusu2 cluster compute nodes:
~100 Intel Xeon nodes running CentOS
[ CS2106 L1 - AY2021 S1 ]
56