cs 149: operating systems may 7 class meeting department of computer science san jose state...
Post on 11-Jan-2016
216 Views
Preview:
TRANSCRIPT
CS 149: Operating SystemsMay 7 Class Meeting
Department of Computer ScienceSan Jose State University
Spring 2015Instructor: Ron Mak
www.cs.sjsu.edu/~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!
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
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
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.
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
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.
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
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
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
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
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.
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.
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
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.
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
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
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
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
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
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
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
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
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.
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
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
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.
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.
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.
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.
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
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
top related