Title: Chapter 3: OS Organization
1Chapter 3 OS Organization
Prof. Steven A. Demurjian, Sr. Computer Science
Engineering Department The University of
Connecticut 191 Auditorium Road, Box
U-155 Storrs, CT 06269-3155
steve_at_engr.uconn.edu http//www.engr.uconn.edu/st
eve (860) 486 - 4818
These slides have been modified from a set
of originals by Dr. Gary Nutt.
2Purpose of this Chapter
- Concentrate on Designers Perspective of an OS
- Examine OS Design by Focusing on
- What Factors are Critical to Design an OS?
- Recall SW Qualities and Principles
- How do they relate to Designing an OS?
- What are Major OS Functions?
- Nuts and Bolts - What is under the hood?
- How are OSs Implemented?
- Organizational Strategies for Resources and their
Interactions - Strong Parallels with Software Design
Engineering Practices
3Recall OS Requirements
- Provide Resource Abstractions
- Concrete Resource Definitions
- Design and Runtime Support/Management
- Provide Process Abstraction
- Conceptualization of Unit of Computation
- Model for Definition and Interaction
- Manage Sharing
- Permit/Prohibit when Dictated by Design
- Authorization and Security Play Significant Role
- Ensure Isolation Between Processes
- Insure Independent Executions
- Allow Controlled Interaction
4What Impacts the Design and Subsequent Evolution
of an OS?
- Performance Fast, Response Time
- Protection/Security
- Autonomous and Non-Interfering
- Preventing Malicious Access
- Correctness Work as Expected at All Times?
- Maintainability Easy to Correct, Change, and
Evolve? - Commercial Factors
- HW Platforms, Market Trends, Free?
- Lessons of Unix and C
- Standards/Open Systems Compatibility, Easy to
Use and Extend, Conformity, etc.
5Performance
- What is Cost of Abstractions Provided by OS?
- Is it Easier to Design and Write Code?
- Is Ease of Use at Expense of Speed?
- Tradeoff Between Utility of Abstraction vs.
Impact on Computers Performance - What is the Role of Continued Advances in
- Hardware Speedup (400-500MhZ PCs)?
- Main Memory Capacity/Price/Speed?
- Disk and Other I/O Devices?
- Moving Graphics Capabilities to Separate
Processing Computer? - OS Must Not Overwhelm Machine with Overhead!
6Performance
- In 1997, Early Releases of Java/JDK Suffered
Greatly w.r.t. Performance - JIT Compilers Faster PCs Lessen Impact of Issue
- What about JavaOS and JINI?
- What is Performance Issue in Both Situations?
MULTIPLE LAYERS CAN DEGRADE PERFORMANCE!!
7Protection and Security
- What are Relevant Issues in an OS?
- Processes Share Resources (Files, Data, etc.)
- Processes Cannot Interfere with One Another
- Processes Know How to Obtain Exclusive Access to
Resources - Processes Prohibited from Malicious Access
- Security Policy Protection Mechanisms
- Policy Sharing Strategy of ComputerUser
Passwords/Privileges/File Sharing - Protection Implement Security PolicyDefined
Policy for Resource Access - Emergence of Security at Programming Level with
Java Security within JDK/JRE
8Correctness
- Recall Functional Correctness - Software Behaves
According to Requirements Specification - When is Correctness Important in an OS?
- For Select Trusted Resources
- For Resources or Functions Defined with Precise
Requirements Specifications - What are Some Examples of Trusted Resources?
- Process Scheduler that Dictates Time-Sharing of
CPU Based on Process Priority/Resources - Concurrency Control/Deadlock Prevention Strategy
for File Access - OSs Must Embrace Formal Correctness over Ad-hoc
Correctness
9Maintainability
- Recall Maintenance - Corrective, Perfective,
and Adaptive, Modifications After Product Release - Key Question from Textbook
- How could one change the OS software and have
any assurance the result could be trusted, was
correct, and did not introduce new bugs? - Has this Been True in Commercial OSs?
- Must OS Designers Choose Between
- Design for Maintainability at Expense of
- Design for Performance?
- Correctness/Maintenance Key for Life Critical
Applications - Guiding Spaceship/Managing Nuclear Reactor
10Commercial Factors
- Mid 1970s into 1980s, Multi-programmed
Time-Shared OSs Dominant (Unix, VMS, etc.) - Advent of Networking has Evolved These OSs to
their Network-Based Successors - 1970s/1980s OS Wars Fought on Free vs. Stable
- BSD vs. ATT Unix
- BSD Unix vs. Digital VMS
- From Late 1980s on, Digitals Unix Support
Personnel Outnumbered VMS Personnel - 1990s/2000s New OS Wars
- Win95, 98, NT, 2000 (MS at War with Itself?)
- WinXX vs. Linux/BSD Unix vs. JavaOS?
- Who will Win (pun intended) the OS Wars?
11Standards and Open Systems
- 1990s Seen a Resurgence of Free Software and Open
Systems - Unix Community
- CORBA Community
- UML Community for OO Design
- Computing Model in Most Companies Embraces
Heterogeneous Network of Interacting Nodes - Legacy, COTS, Databases, etc.
- New Clients, Java Servers, Web Servers, etc.
- Key Issues Application Integration, Portability,
and Interoperability - Role of OS? Distributed OS? Java? JINI? CORBA?
12Single Process OS Organization
Program
Program
Libraries
Program
OS Services
ROM Routines
Processor(s)
Main Memory
Devices
13Basic OS FunctionsFour Broad Categories
- Device Management
- Disks, Terminals, Printers, etc.
- Emergence of New Media
- Process and Resource Management
- Execution Environment of Programs
- Sharing, Interaction, etc.
- Memory Management
- Local Memory for Program Execution
- Virtual Memory Management
- File Management
- Perspectives of End-User vs. Software Engineer
- Executing User/System Process vs. OS Routine
14Basic OS Functional Decomposition
File Manager
Process Resource Manager
Device Manager
Memory Manager
Processor(s)
Main Memory
Devices
15Device Management
- Disks (Hard, 3.5in, CD, DVD, etc.), Tapes,
Terminals, etc. All Managed in Similar Fashion - Management of Allocation, Isolation, Sharing
- Management Based on Pre-Defined Policies
- OS Must React to Change
- Ability to Include New Devices
- Load and Dynamically/Install Drives
- No Re-Compilation of OS
- Re-Configurable Device Drivers
- In Modern PC-Based OS, Wide Variety of Devices
Supported is Staggering! - WinNT has 60 Printer Manufactures
- If Each Average 20 Printer Types - 1200 Total!
16Process and Resource Management
- Process Management Track All Existing Processes
and Their States - Resource Management
- Track Resources Being Used by Processes
- Determine Conditions Under Which Process can
Receive Resource - In Practice, Combined into P R Management
- Major Responsibilities Include
- Enforce Isolation of Resource Among Multiple
Processes According to Policy - Determine Conditions When Circumvention by
Process can Occur to Support Sharing
17Memory Management
- Responsible for
- Allocation/Use of Primary Memory by Process
- Allow Sharing of Memory by Processes
- Promote Isolation of Memory by Processes
- Modern OS Includes Virtual Memory
- Combination of Primary Memory and Secondary
Storage (Disk, Tape, etc.) - Staging of File, Program, etc. Off Secondary
Storage When Memory Exceeded - Requires Management of Virtual Memory Space in
Conjunction with Physical Memory Space - VM Needs Policies and Mechanisms Integrated with
File Management
18Memory Management
- Virtual Memory in PDP-11/44 circa 1983
- 64K Virtual Memory/128K Primary Memory
- Utilization of Memory Overlays Tells OS
Where/When Different Modules Execute - Virtual Memory Management Brings in a Program,
File, etc., Block-by-Block on Demand - VMM Integrated with Caching/LRU Stategies
- In Todays Networked File Systems
- Process Can Utilize Non-Local Resources
- Yields Distributed Shared Memory Abstraction
- What Technology Allows Interaction Over Network
Between Processes and/or Data Sources?
JAVA RMI!!!
19File Management
- Managing Abstract Resources for Storage Devices
- Files Remain in Primary Memory Until Released
by Process - Files Copied to Magnetic Disk, Tape, Writable CD
- Abstractions Range from ASCII Byte Steam to
Indexed Records to Relational Databases - In Todays OS, Commonly Distributed
- Distribution Transparent to User/Process
- Machine/User Utilizes Local and Remote Files
- E.g., Logical Mounting of Unix File System on NTs
in Learning Center
20OS Organization RevisitedFunctional Interactions
File Manager
Process Resource Manager
Device Manager
Memory Manager
Processor(s)
Main Memory
Devices
21Implementation Considerations
- What are Core Tools Utilized to Design and
Construct a Modern OS? - Processor Modes
- Mode Bit of Processor
- Distinguish Between User/Supervisor Execution
- Kernels
- Critical, Core Portion of OS
- Represents Trusted Software
- Minimize to Alleviate Potential Performance
Impact - Method of Requesting System Service
- Procedure Call vs. Message Passing
- What is Role/Impact of Each in Implementing OS?
22Processor Modes
- Mode Bit
- Define Execution Capabilities of Program on a
Processor - Included in Modern Micro-Processors
- Supervisor Mode
- Can Execute All Machine Instructions
- Can Reference All Memory Locations
- User Mode
- Can Only Execute a Subset of Instructions
- Can Only Reference a Subset of Memory Locations
- Both Tied to Security Instructions that are
Supervisor, Privileged, or Protected
23Kernels
- The Part of the OS Critical to Correct Operation
(Trusted Software) - Recall Trusted Software Bound to Verifiable
Requirements! - Kernel Guaranteed to Protect Covert or Malicious
Changes by Untrusted Software - Kernel Executes in Supervisor Mode
- Placing Function in Kernel
- May Impact Performance
- Allows Function to Interact with Other Kernel
Capabilities - The Trap Instruction is Used to Switch From User
to Supervisor Mode, Entering the OS
24Demonstrating Modes and KernelsThe trap
Instruction
- Traps Allow User Process to Interact with Kernel
and Executed Trusted Code - Instruction Sets Mode Bit Branches to Code
- Similar in Concept to Hardware Interrupt
Mode
U
Trusted Code
User
Supervisor
25System Call Approach
- User Process Traps to OS Routine for Function to
be Invoked - Trap Does Context Switch to Supervisor Mode
- Function Called as Procedure
- Upon Completion, Switch Back to User Mode and
Return Control to User Process
call()
trap
return
26Message Passing Approach
- User Process Constructs a Message and Sends
- A send Function Interacts with Trusted OS Process
- If OK, Switch to Supervisor Mode Deliver to
Process that Implements Functionality - User Process Waits for receive Message
send(, A, ) receive(, B, )
send/receive
receive(A, ) send(, B, )
27The UNIX Organization
Process
Process
Libraries
Process
User
Super- visor
Device Drivers
Kernel
Main Memory
Processor(s)
Devices
28Microkernel Organization
- Microkernel Contains Mechanism Dependent,
Hardware Dependent Portion of OS - Non-Portable
29NT Organization
Process
Process
T
T
Process
T
T
T
T
Libraries
T
T
T
Subsystem
Subsystem
Subsystem
User
Super- visor
I/O Subsystem
NT Executive
NT Kernel
Hardware Abstraction Layer
Main Memory
Processor(s)
Devices
30Concluding Remarks/Looking Ahead
- Review of Designer Perspective of OS
- Critical Issues and Concepts that Impact Design
- Tradeoffs of Performance, Maintainability, etc.
- Interesting Exercise 1 in Section 3.5
- Design/Develop PC OS with 5 year Lifetime
- Relevance of Requirements (slide 4)
- What about Mainframe OS with 20 year LT?
- Looking Ahead to
- Review of Computer Organization
- Relevance of CO to OS Design/Usage
- Device Management
- Process Management
- Project Status