+ All Categories
Home > Documents > CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State...

CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State...

Date post: 11-Jan-2016
Category:
Upload: kenneth-fleming
View: 216 times
Download: 0 times
Share this document with a friend
Popular Tags:
46
CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak www.cs.sjsu.edu/~mak
Transcript
Page 1: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

CS 149: Operating SystemsMay 7 Class Meeting

Department of Computer ScienceSan Jose State University

Spring 2015Instructor: Ron Mak

www.cs.sjsu.edu/~mak

Page 2: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

2Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Unofficial Field Trip

Computer History Museum in Mt. View http://www.computerhistory.org/

Saturday, May 9, 11:30 – closing time

Special free admission. Do a self-guided tour of the new Revolution exhibit. See a life-size working model of Charles Babbage’s

Difference Engine in operation, a hand-cranked mechanical computer designed in the early 1800s.

Experience a fully restored IBM 1401 mainframe computer from the early 1960s in operation. General info: http://en.wikipedia.org/wiki/IBM_1401 My summer seminar: http://www.cs.sjsu.edu/~mak/1401/ Restoration:

http://ed-thelen.org/1401Project/1401RestorationPage.html

Extra creditfun quiz!

Page 3: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

3Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Four Eras of Microsoft Operating Systems

1. MS-DOS Windows 1.0, 2.0

2. MS-DOS-based Windows Windows 3.0, 3.1, 98, ME

3. NT-based Windows Windows XP, Vista, 7

4. Modern Windows Windows 8, 8.1

Page 4: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

4Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Modern Windows

Microsoft transformed itself from a PC software company to a devices and services company.

Needed an OS that it could deploy across phones tablets game consoles laptops desktops servers cloud

Page 5: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

5Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

MinWin Approach

A small OS core that can be extended into different devices.

Extend the core to be the operating systems for specific devices. New user interfaces and features Common experience for users

Support new Intel architectures. Support the ARM architecture.

Page 6: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

6Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Modern Windows Programming Layers

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 7: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

7Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Programming Windows

Windows 8.1 removed POSIX compliance.

Modern Software Development Kit Includes the new WinRT set of APIs.

Shift programmers away from a threading model to a task model. Separate resource management (priorities, CPUs)

from the programming model (concurrent activities).

Modern applications run in an AppContainer sandbox for security.

Page 8: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

8Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Components to Build NT Subsystems

The NT kernel contains general-purpose facilities for writing OS-specific subsystems.

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 9: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

9Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Kernel-Mode Objects

The NTOS executive layer running in kernel mode implements system calls.

Native NT system calls operate on kernel-mode objects:

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 10: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

10Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Native NT API

Native NT API calls use handles to manipulate objects across process boundaries. Examples:

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 11: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

11Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Win32 API

Library procedures that either Do the work in user mode. Wrap native NT calls that do the work:

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 12: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

12Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Windows-on-Windows (WOW)

WOW32 Used on 32-bit x86 systems. Run 16-bit Windows 3.x applications. Map system calls and parameters between

the 16-bit and 32-bit worlds.

WOW64 Allows 32-bit applications to run on x64 systems.

Page 13: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

13Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Windows vs. Unix

Unix Simple OS functions Few parameters Few examples of multiple ways to do something. Kernel panic for a fatal error.

Windows Comprehensive APIs with many parameters. Several ways to do the same thing. Mixed low-level and high-level functions. Blue Screen of Death for a fatal error.

Page 14: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

14Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Windows Registry

Registry: A special file system to maintain system configuration information.

Hive: A volume of the registry.

HKLM = HKEY LOCAL MACHINE Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 15: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

15Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Kernel-Mode Organization

ISR = Interrupt Service RoutineDPC = Deferred Procedure CallAPC = Asynchronous Procedure CallLPC = Local Procedure Call Modern Operating Systems, 4th ed.

Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 16: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

16Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Dispatcher Objects

Control dispatching and synchronization: events mutexes semaphores threads timers

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 17: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

17Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Executive Layer

Object manager Manages most kernel-mode objects Processes, threads, files, semaphores, I/O devices

and drivers, timers, etc.

I/O manager Framework for implementing I/O device drivers. Executive services to configure, access, and perform

operations on devices. Plug-and-play

Page 18: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

18Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Executive Layer, cont’d

Process manager Create and terminate processes and threads

Memory manager Demand-paged virtual memory Physical page frames Disk pagefile backing store

Cache manager Optimizes I/O performance

Page 19: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

19Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Executive Layer, cont’d

Security reference monitor Enforces Windows security mechanisms Supports Common Criteria

U.S. Department of Defense Orange Book requirements

Configuration manager Implements the registry

Advanced local procedure call (ALPC) Highly efficient interprocess communication

Page 20: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

20Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Hardware Abstraction Layer (HAL)

Hide machine dependencies.

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 21: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

21Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Device Stacks

IRP = I/O request packet

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 22: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

22Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Object Management

Most important function of the executive.

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 23: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

23Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Object Handles

Handles refer to kernel-mode objects. A handle table translates handles to objects.

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 24: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

24Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Handle Table

A handle table can have up to 16 million handles.

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 25: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

25Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Object Procedures

Supplied when specifying a new object type.

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 26: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

26Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Object Namespace Directories

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 27: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

27Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Creating and Opening a File

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 28: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

28Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Creating and Opening a File, cont’d

1. Executive component passes Unicode pathname for namespace.

2. Object manager searches through directories and symbolic links.

3. Object manager calls the Parse procedure for object type.

4. I/O manager creates IRP, allocate file object, send request to stack of I/O devices.

5. IRP passed down the I/O stack until it reaches device object representing the file system instance.

Page 29: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

29Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Creating and Opening a File, cont’d

6. Device objects encountered as the IRP heads toward the file system represent file system filter drivers.

7. File system device object has a link to file system driver object.

8. NTFS fills in file object and returns it to I/O manager, which returns back up through all devices on the stack.

9. Object manager is finished with its namespace lookup.

10. Final step is to return back to the user-mode caller.

Page 30: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

30Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Common Executive Object Types

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 31: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

31Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Processes and Threads

Processes can optionally be grouped into jobs.

A thread can schedule multiple fibers. A fiber assumes the identity of the thread that runs it. Lower overhead of switching among threads.

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 32: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

32Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Processes and Threads, cont’d

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 33: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

33Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Processes and Threads, cont’d

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 34: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

34Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Thread Priorities

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 35: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

35Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Thread Priorities, cont’d

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 36: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

36Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Memory Management

Virtual address space layout

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 37: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

37Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Memory Management System Calls

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 38: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

38Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Page Fault Categories

The page referenced is not committed. committed = the page is mapped to a virtual page

Attempted access to a page that is in violation of the permissions.

A shared copy-on-write page was about to be modified.

The stack needs to grow.

The page referenced is committed but not currently mapped in.

These first two are dueto programming errors.

LRU page replacementalgorithm.

Page 39: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

39Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

I/O API Calls

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 40: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

40Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Device Driver Stacking

Stack device drivers to work with a specific instance of a device.

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620

Page 41: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

41Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

File System

A volume is the fundamental structure of the Windows 8.1 file system (NTFS).

Created by the Windows 8.1 disk administrator utility.

Based on a logical disk partition. May occupy a portions of a disk, an entire disk,

or span across several disks.

All metadata, such as information about the volume, is stored in a regular file.

Page 42: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

42Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

NTFS Clusters

A cluster is the underlying unit of disk allocation.

A cluster is a number of disk sectors that is a power of 2.

Because the cluster size is smaller than for the 16-bit FAT file system, the amount of internal fragmentation is reduced.

Page 43: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

43Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

File System Logging

All file system data structure updates are performed inside transactions that are logged.

Before a data structure is altered, the transaction writes a log record that contains redo and undo information.

After the data structure has been changed, a commit record is written to the log to signify that the transaction succeeded.

Page 44: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

44Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

File System Recovery

After a crash, the file system data structures can be restored to a consistent state by processing the log records.

This scheme does not guarantee that all the user file data can be recovered after a crash.

It only guarantees that the file system data structures (the metadata files) are undamaged and reflect someconsistent state prior to the crash.

Page 45: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

45Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Security

Secure login with anti-spoofing measures

Discretionary access controls

Privileged access controls

Address space protection per process

New pages must be zeroed before being mapped in

Security auditing

Page 46: CS 149: Operating Systems May 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak mak.

46Computer Science Dept.Spring 2015: May 7

CS 149: Operating Systems© R. Mak

Security, cont’d

Each user and group identified by an SID (security ID).

Each process has an access token containing: a SID a DACL (default access control list) other properties

DACL

Modern Operating Systems, 4th ed.Andrew Tanenbaum and Herbert BosPearson, 2014ISBN: 978-0133591620


Recommended