Transcript Ch-1_3431x

Chapter 1 – Introduction (Pgs 3 – 42)
CSCI 3431: OPERATING SYSTEMS
Architecture Review
 SGG see a computer system as:
1. Hardware : CPU, Memory, I/O, communication
2. *Operating System* - The rest of the course
3. Applications: Programs that do stuff (and which
may be layered, connected)
-- Middleware: Connects multiple apps to users
4. Users: All users are not equal
O/S is software that sits
between the applications and the hardware.
(Another)
Simplistic Layered View of Computing
The Factors
 Usability – Easy and intuitive to use,




e.g., Android , iOS
Efficiency – Fair and “optimal” use of
resources (i.e., hardware), e.g., IBM z/OS
Reliability – Uptime, MTF (real-time O/S),
e.g., QNX, VxWorks (Mars landers, Phoenix, Airbus A400,
Boeing 787, Motorola modems)
Security – e.g., NSA Sectera Edge w. Win CE
Size – for embedded O/S
Views
 Users
 Varying levels of ability/experience
 “User” Interface (UI)
 Often view Windowing System as “The” UI
 System
 Programmers, Administrators
 API, Admin tools
 Performance
 Components
My Views
 PC = Personal Computer, it does NOT mean a
computer that runs Microsoft Windows
 KiloByte = 210 bits (1024) NOT 1000 bits
 WWW is a group of protocols and
applications that USE the Internet, it is NOT
the Internet (also FTP, e-mail, Skype)
 OOPL have inclusion (subtype)
polymorphism, not parametric polymorphism
or just “polymorphism”
Bootstrap Loader
 When it is started, a CPU needs to start
somewhere (e.g., thread 0 in core 0 in processor 0 starts up
fetching code from address 0xfffffff0)
 At that address is the Bootstrap Loader
 Stored in non-volatile memory so its always there
 Setup registers (stack, PC, etc.)
 Find and load the O/S
 Often just loads an O/S loader/init (e.g., lilo, grub)
Windows Boot
 address 0xfffffff0 resides in BIOS (non-volatile ROM)
 Initialise the system: CPU; RAM, Interrupt, DMA controllers;





Basic hardware
Run user interface if selected
Attempt to load boot sector (drive A, platter 1, cylinder 1,
sector 1) to ox7C00
Boot sector contains Bootmgr.exe
Bootmgr.exe: Copies Winload.exe to RAM and transfers
control to it
Winload.exe: Prepares disk for general use, loads the kernel,
sets up basic drivers (memory etc.), and the transfer control to
the kernel
Interrupt
 Event that triggers O/S operation
 E.g., incoming packet on ethernet
 Requires hardware support in CPU
 Actual wires for hardware interrupts
 Special instruction for software interrupts
 Interrupt is usually used as an offset into an array
of addresses – “Interrupt Vector”
 At each address is a routine that performs the
task needed – “Interrupt Handler”
 Some interrupts can be “masked” (and then
ignored)
System Call
 Operating systems are designed to support





applications
Can do common tasks such buffer and report
key strokes
Applications use these O/S facilities
Accessing the O/S is done using System Calls
Do setup then perform an interrupt to call
Often hidden from programmers by
compiler/library writers
Stuff you SHOULD KNOW
(already)
 1.2.2 Storage Structure (memory)
 1.2.3 I/O Structure
 Will talk more about DMA later
 1.3 Computer Architecture
 Single vs. Multiprocessors, Multi-core
 Symmetric vs. Asymmetric Multiprocessing
 Non-Uniform Memory Access (and UMA)
O/S - Definitions
 “Program that manages the computer
hardware.” (pg 3)
 “Environment in which programs are
executed.” (pg 18)
 “An OS is software, consisting of programs
and data, that runs on computers, manages
computer hardware resources, and provides
common services for execution of various
application software.” (wikipedia)
Events
 Most O/S are interrupt driven – they are reactive
to interrupts
 A trap is an interrupt caused by an identifiable
error, e.g., writing to non-existent memory
 Not to be confused with untrappable CPU errors





0x00000000 Divide by Zero Error
0x00000004 Overflow
0x00000005 Bounds Check Fault
0x00000006 Invalid Opcode (Instruction)
0x00000008 Double Fault
Operation Modes
 CPU support for an O/S – “mode bit”
 User (protected) Mode: CPU is executing
user-level application
 Kernel (supervisor, system, privileged) Mode:
CPU is executing O/S code
 Also, instructions exist to DISABLE interrupts
(which is useful when processing an interrupt)
O/S Structure
 Jobs (or Tasks): Code + Data that needs




executing
Job Pool: All jobs awaiting execution
Multitasking – executing more than one job
at a time
Pre-emptive multitasking (1 CPU) – do part of
each job in sequence (same as time sharing)
Time slice = amount of time given to a task
before a context switch occurs
Computer Operation
 Interrupt Storm: When a CPU can’t execute
user tasks because its busy executing
interrupt handlers
 Context Switch: Changing the executing task
 Job Scheduling: Selecting the executing task
(done by the O/S which is itself a task)
 PROCESS: A program (and its data) loaded
into memory and executing (pg 20).
O/S
in
Action
O/S Responsibilities
 Process Management




Scheduling – start, suspend, resume
Creating, deleting
Synchronising
IPC – inter-process communication
 Memory Management
 Virtual memory, pages, swapping
 Fragmentation control
 Caches (level 3)
 Storage Management
 Files & Directories
 Free space, storage allocation, disk scheduling, search
 I/O Control - Printers, Scanners, Network connections
 User Administration and Security/Access Control
Operating Systems
 Distributed: Permit a user to use resources on
multiple machines (e.g., access files or run tasks
on other computers)
 Embedded: Inside a device such as a cell phone,
microwave, airplane
 Real-time: Performance subject to rigid time
constraints (almost all embedded systems)
 Compact: Power, UI, & memory restrictions exist
(e.g., iOS, PalmOS, Android)
 Special Purpose: e.g., Google O/S on search
hardware
To Do:
 Read Chapter 1 (pgs 3-42; this lecture): All
material is very introductory and testable
 Read Chapter 2 (pgs 49-91; next lecture): All
material is testable