1.1 silberschatz, galvin and gagne ©2009 operating system concepts – 8 th edition cs270 operating...

38
1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition 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.

Post on 22-Dec-2015

224 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.1 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

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.

Page 2: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.2 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

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.

Page 3: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.3 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

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)

Page 4: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.4 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

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

Page 5: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.5 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

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)

Page 6: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.6 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

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

Page 7: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.7 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

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

Page 8: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.8 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

Operating Systems

Page 9: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.9 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

Operating Systems: Market Shares

Page 10: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.10 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

Operating Systems: Market Shares

Unix 64.2%

Windows 35.9%

W3Techs.com, 27 February 2011

Web server OSMarket shares

Smartphone marketShares (World)Nov 2010

Symbian iOS Apple Blackberry Android

32% 21% 19% 11%

Smartphone marketShares (US) 2011

Page 11: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.11 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

OS Services and Structure

Page 12: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.12 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

How a Modern Computer Works

Page 13: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.13 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

OS is interrupt-driven

Page 14: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.14 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

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?

Page 15: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.15 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

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.

Page 16: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.16 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

Standard C Library Example

C program invoking printf() library call, which calls write() system call

Page 17: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.18 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

System Calls and Due-Mode

Dual-mode operation allows OS to protect itself and other system components: User mode and kernel mode

Page 18: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.19 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

Examples of Windows and Unix System Calls

Page 19: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.20 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

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

Page 20: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.21 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

Process Management Activities

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

The operating system is responsible for the following activities in connection with process management:

Page 21: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.22 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

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

Page 22: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.23 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

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

Page 23: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.24 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

Level of storage

Movement between levels of storage hierarchy can be explicit or implicit.

Page 24: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.25 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

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

Page 25: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.26 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

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

Page 26: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.27 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

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

Page 27: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.28 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

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

Page 28: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.29 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

Traditional UNIX System Structure

Page 29: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.30 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

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

Page 30: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.31 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

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

Page 31: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.32 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

Solaris Modular Approach

Page 32: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.33 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

33

Monolithic Kernel vs. Microkernel

Page 33: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.34 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

Mac OS X vs Berkeley Unix

Page 34: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.35 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

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

Page 35: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.36 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

Virtual Machines

(a) Nonvirtual machine (b) virtual machine

Page 36: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.37 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

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.

Page 37: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.38 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

The Java Virtual Machine

Page 38: 1.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition CS270 Operating Systems Understanding of operating systems and fundamental

1.39 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

VMware Architecture