Download 1.01 - UCSB Computer Science

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Unix wikipedia , lookup

Library (computing) wikipedia , lookup

OS-tan wikipedia , lookup

Acorn MOS wikipedia , lookup

Burroughs MCP wikipedia , lookup

System 7 wikipedia , lookup

DNIX wikipedia , lookup

Plan 9 from Bell Labs wikipedia , lookup

RSTS/E wikipedia , lookup

Berkeley Software Distribution wikipedia , lookup

Mobile operating system wikipedia , lookup

Copland (operating system) wikipedia , lookup

Process management (computing) wikipedia , lookup

Spring (operating system) wikipedia , lookup

CP/M wikipedia , lookup

Distributed operating system wikipedia , lookup

Security-focused operating system wikipedia , lookup

VS/9 wikipedia , lookup

Paging wikipedia , lookup

Unix security wikipedia , lookup

Transcript
CS270 Operating Systems
 Understanding of operating systems and
fundamental design principle.
 Quick
review of multiprogramming,
process/thread management, memory and
storage management
 Study
a tiny/instructional OS: Nachos
 Advanced topics with selected research
papers
 Nachos programming assignments or special
projects.
Operating System Concepts – 8th Edition
1.1
Silberschatz, Galvin and Gagne ©2009
CS270 Operating Systems
 www.cs.ucsb.edu/~cs270t.
 cs270t.
Password: systems
 Recommended text book: Operating
System Concepts , by Silberschatz,
Galvin, Gagne.
 Old
edition is fine.
 The
web site contains slides and
practice exercises with solutions.
Operating System Concepts – 8th Edition
1.2
Silberschatz, Galvin and Gagne ©2009
Advanced Topics with Selected Papers
 Microkernel.
 OS scheduling (e.g. Lottery scheduling. Scheduler
activation).
 File systems and storage.

RAID. Log-structured file systems

Google file system
 Parallel distributed processing

Key-value stores (Bigtable, Dynamo)

Mapreduce/Hadoop

Clustering for Internet services (Neptune).
 Virtualization (Vmware, Xen)
Operating System Concepts – 8th Edition
1.3
Silberschatz, Galvin and Gagne ©2009
Workload
 3 Programming assignments (C++):

Understand Nachos code and extend with sample
code (2 persons/group).
 1 exam

Q/A for selected papers/slides from lectures (TBD).

Contributed questions from everybody
 Special project option to trade for other efforts
 Paper reading+ discussions/group presentation
Operating System Concepts – 8th Edition
1.4
Silberschatz, Galvin and Gagne ©2009
Special Project Options
 Parallel programming with Hadoop MapReduce in
data-extensive applications

Similarity comparison. Duplicate detection. Or
others.
 Architecture evaluation and benchmarking of open-
source data-store systems

Hive, Cassandra, Hbase, Hypertable (?)

Membase, memcached

MogoDB, VoldDB

HW3/HW2 may be replaced with project reports
(architecture, benchmarks, how to install/test,
presentations)
Operating System Concepts – 8th Edition
1.5
Silberschatz, Galvin and Gagne ©2009
Workload
 3 Programming assignments (C++):

Understand Nachos code and extend with sample
code (2 persons/group).
 1 exam

Q/A for selected papers/slides from lectures (TBD).

Contributed questions from everybody
 Special project option to trade for other efforts
 Paper reading+ discussions/group presentation
Operating System Concepts – 8th Edition
1.6
Silberschatz, Galvin and Gagne ©2009
Basic OS Concepts: Quick overview
 Computer Organization and Operations.

Impact on OS. Dual-modes. Interrupt handling.
 OS structure

Services:
Multiprogramming.
Process management.
Memory and storage management. Security.

Design and implementation principles
Modules/Layered
approach.
Microkernel
 Virtualization
Operating System Concepts – 8th Edition
1.7
Silberschatz, Galvin and Gagne ©2009
Operating Systems
Operating System Concepts – 8th Edition
1.8
Silberschatz, Galvin and Gagne ©2009
Operating Systems: Market Shares
Operating System Concepts – 8th Edition
1.9
Silberschatz, Galvin and Gagne ©2009
Operating Systems: Market Shares
Web server OS
Market shares
Smartphone market
Shares (World)
Nov 2010
Unix
64.2%
Windows
35.9%
W3Techs.com, 27
February 2011
Symbian
iOS Apple
Blackberry
Android
32%
21%
19%
11%
Smartphone market
Shares (US) 2011
Operating System Concepts – 8th Edition
1.10
Silberschatz, Galvin and Gagne ©2009
OS Services and Structure
Operating System Concepts – 8th Edition
1.11
Silberschatz, Galvin and Gagne ©2009
How a Modern Computer Works
Operating System Concepts – 8th Edition
1.12
Silberschatz, Galvin and Gagne ©2009
OS is interrupt-driven
Operating System Concepts – 8th Edition
1.13
Silberschatz, Galvin and Gagne ©2009
System Calls
 Programming interface to the services provided by the OS
 Typically written in a high-level language (C or C++)
 Mostly accessed by programs via a high-level Application
Program Interface (API) rather than direct system call use

Three most common APIs are Win32 API for Windows,
POSIX API for POSIX-based systems (including virtually all
versions of UNIX, Linux, and Mac OS X), and Java API for
the Java virtual machine (JVM)

Why use APIs rather than system calls?
Operating System Concepts – 8th Edition
1.14
Silberschatz, Galvin and Gagne ©2009
System Calls
 Programming interface to the services provided by the OS
 Typically written in a high-level language (C or C++)
 Mostly accessed by programs via a high-level Application
Program Interface (API) rather than direct system call use

Three most common APIs are Win32 API for Windows,
POSIX API for POSIX-based systems (including virtually all
versions of UNIX, Linux, and Mac OS X), and Java API for
the Java virtual machine (JVM)

Why use APIs rather than system calls? Portability.
Simplicity.
Operating System Concepts – 8th Edition
1.15
Silberschatz, Galvin and Gagne ©2009
Standard C Library Example
 C program invoking printf() library call, which calls write() system call
Operating System Concepts – 8th Edition
1.16
Silberschatz, Galvin and Gagne ©2009
System Calls and Due-Mode
 Dual-mode operation allows OS to protect itself and other system
components: User mode and kernel mode
Operating System Concepts – 8th Edition
1.18
Silberschatz, Galvin and Gagne ©2009
Examples of Windows and
Unix System Calls
Operating System Concepts – 8th Edition
1.19
Silberschatz, Galvin and Gagne ©2009
Multiprogramming
 Multiprogramming needed for efficiency

Single user cannot keep CPU and I/O devices busy at all times

Multiprogramming organizes jobs (code and data) so CPU always has one
to execute

A subset of total jobs in system is kept in memory

One job selected and run via job scheduling

When it has to wait (for I/O for example), OS switches to another job
 Timesharing (multitasking) is logical extension in which CPU switches jobs
so frequently that users can interact with each job while it is running, creating
interactive computing

Response time should be < 1 second

Each user has at least one program executing in memory process

If several jobs ready to run at the same time  CPU scheduling

If processes don’t fit in memory, swapping moves them in and out to run

Virtual memory allows execution of processes not completely in memory
Operating System Concepts – 8th Edition
1.20
Silberschatz, Galvin and Gagne ©2009
Process Management Activities
The operating system is responsible for the following activities in
connection with process management:
 Creating and deleting both user and system processes
 Suspending and resuming processes
 Providing mechanisms for process synchronization
 Providing mechanisms for process communication
 Providing mechanisms for deadlock handling
Operating System Concepts – 8th Edition
1.21
Silberschatz, Galvin and Gagne ©2009
Memory Management
 All data in memory before and after processing
 All instructions in memory in order to execute
 Memory management determines what is in memory when

Optimizing CPU utilization and computer response to users
 Memory management activities

Keeping track of which parts of memory are currently being used
and by whom

Deciding which processes (or parts thereof) and data to move into
and out of memory

Allocating and deallocating memory space as needed
Operating System Concepts – 8th Edition
1.22
Silberschatz, Galvin and Gagne ©2009
Storage Management
 OS provides uniform, logical view of information storage
 File-System interface

Files usually organized into directories
 Access control on most systems to determine who can access
what
 OS activities include
Creating and deleting files and directories
 Primitives to manipulate files and dirs
 Mapping files onto secondary storage


Backup files onto stable (non-volatile) storage media.
 Massive storage management (e.g. disk drive)

Free-space management

Storage allocation

Disk scheduling
Operating System Concepts – 8th Edition
1.23
Silberschatz, Galvin and Gagne ©2009
Level of storage
 Movement between levels of storage hierarchy can be explicit or
implicit.
Operating System Concepts – 8th Edition
1.24
Silberschatz, Galvin and Gagne ©2009
Clustered Systems
 Like multiprocessor systems, but multiple systems working together

Usually sharing storage via a storage-area network (SAN)

Provides a high-availability service which survives failures


Asymmetric clustering has one machine in hot-standby mode

Symmetric clustering has multiple nodes running applications,
monitoring each other
Some clusters are for high-performance computing (HPC)

Applications must be written to use parallelization
Operating System Concepts – 8th Edition
1.25
Silberschatz, Galvin and Gagne ©2009
Protection and Security
 Protection – any mechanism for controlling access of processes or
users to resources defined by the OS
 Security – defense of the system against internal and external attacks

Huge range, including denial-of-service, worms, viruses, identity
theft, theft of service
 Systems generally first distinguish among users, to determine who
can do what




User identities (user IDs, security IDs) include name and
associated number, one per user
User ID then associated with all files, processes of that user to
determine access control
Group identifier (group ID) allows set of users to be defined and
controls managed, then also associated with each process, file
Privilege escalation allows user to change to effective ID with
more rights
Operating System Concepts – 8th Edition
1.26
Silberschatz, Galvin and Gagne ©2009
OS Design and Implementation Principles
 Important principle to separate
Policy: What will be done?
Mechanism: How to do it?
 Mechanisms determine how to do something,
policies decide what will be done
 The
separation of policy from mechanism
is a very important principle, it allows
maximum flexibility if policy decisions are
to be changed later
Operating System Concepts – 8th Edition
1.27
Silberschatz, Galvin and Gagne ©2009
Earlier Windows Systems
 MS-DOS – written to provide the most functionality in the least space

Simple structure

Not divided into modules. Interfaces and levels of functionality are not
well separated
 Window’95
Operating System Concepts – 8th Edition
1.28
Silberschatz, Galvin and Gagne ©2009
Traditional UNIX System Structure
Operating System Concepts – 8th Edition
1.29
Silberschatz, Galvin and Gagne ©2009
Layered Approach
 The operating system is divided into a number of layers (levels), each
built on top of lower layers. The bottom layer (layer 0), is the
hardware; the highest (layer N) is the user interface.
 With modularity, layers are selected such that each uses functions
(operations) and services of only lower-level layers
Operating System Concepts – 8th Edition
1.30
Silberschatz, Galvin and Gagne ©2009
Modules
 Most modern operating systems implement
kernel modules
 Uses
object-oriented approach
 Each
core component is separate
 Each
talks to the others over known interfaces
 Each
is loadable as needed within the kernel
 Overall, similar to layers but with more flexible
Operating System Concepts – 8th Edition
1.31
Silberschatz, Galvin and Gagne ©2009
Solaris Modular Approach
Operating System Concepts – 8th Edition
1.32
Silberschatz, Galvin and Gagne ©2009
Monolithic Kernel vs. Microkernel
33
Operating System Concepts – 8th Edition
1.33
Silberschatz, Galvin and Gagne ©2009
Mac OS X vs Berkeley Unix
Operating System Concepts – 8th Edition
1.34
Silberschatz, Galvin and Gagne ©2009
Microkernel System Structure
 Moves as much from the kernel into “user” space
 Communication takes place between user modules using
message passing
 Benefits:

Easier to extend a microkernel

Easier to port the operating system to new architectures

More reliable (less code is running in kernel mode)

More secure
 Detriments:

Performance overhead of user space to kernel space
communication
Operating System Concepts – 8th Edition
1.35
Silberschatz, Galvin and Gagne ©2009
Virtual Machines
(a) Nonvirtual machine (b) virtual machine
Operating System Concepts – 8th Edition
1.36
Silberschatz, Galvin and Gagne ©2009
Virtual Machines
 A virtual machine takes the layered approach to its logical
conclusion. It treats hardware and the operating system kernel as
though they were all hardware.
 A virtual machine provides an interface identical to the underlying bare
hardware.
 The operating system host creates the illusion that a process has its
own processor and (virtual memory).
 Each guest provided with a (virtual) copy of underlying computer.
Operating System Concepts – 8th Edition
1.37
Silberschatz, Galvin and Gagne ©2009
The Java Virtual Machine
Operating System Concepts – 8th Edition
1.38
Silberschatz, Galvin and Gagne ©2009
VMware Architecture
Operating System Concepts – 8th Edition
1.39
Silberschatz, Galvin and Gagne ©2009