Introduction
CS 6233 Session 1
What is an OS?
Program that controls execution of application programs and acts as interface between applications and computer hardware.
Objectives:
Convenience for user Efficient use of computer resources Ability to evolve.
Layers of Interaction
End Users interact with Applications Programmers design applications and interact with Utilities and the OS OS Designers interact directly with system hardware
An Operating system should provide services
Program Development Program Execution Access to Hardware, I/O Devices Access to Files Error Detection Accounting
OS As Resource Manager
Computer: set of resources for movement, storage and processing of data. OS manages these resources.
Curious: OS is just another program and often relinquishes control. E.g. main memory: Portion of OS in main memory. (kernel) Rest of memory managed by OS and memory-management hardware. E.g. Processor
Ease of Evolution:
Hardware Changes New Services Bugfixes and upgrades.
Brief History of Operating systems
The first dinosaurs
Problems:
Scheduling Setup time
Batch Systems
Avoid wasted time due to scheduling and setup time Monitor: runs batches of jobs. Instructions as to how to run jobs in primitive JCL. Cedes control to processor to run job.
History Continued
Desirable Features (avoid chaos)
Memory Protection program cant mess up monitor memory area. Timer: prevent single job from monopolizing. Privileged instructions: only can be done by monitor. Interrupts More flexibility in relinquishing control to and regaining control from user programs.
History Continued
Problem:
Since I/O slow, processor often idle.
Solution: If memory big enough to hold several programs, multiprogramming or multitasking becomes possible.
Need hardware that supports I/O interrupts, DMA (direct memory access) Need memory management, scheduling.
More History
Problem: Interaction better than batching.
Batch Multiprogramming vs. Time sharing
Goal: maximize processor use Program has full control of processor No Preemption Requires JCL to tell the system what resources are needed
Goal: minimize response time. Preemptive processing
User decides when a program runs
Major Achievements of Modern OS:
Processes Memory Management Information protection and Security Scheduling and Resource Management System Structure
Processes
Multiprogramming, time-sharing, realtime all created serious problems in timing and synchronization.
Improper synch: waits signal from other entity. Failed mutual exclusion Nondeterminate program execution Deadlocks.
2-n programs hanging waiting for each other.
Processes (cont.)
Systematic way to monitor and control various programs on the processor. The process!
Processes
A single program in a system state
Can be executing or waiting to be executed
Contains Code, Data, and Context
Execution context critical: includes all the information that the OS needs to to manage process and that the processor needs to execute it.
Was the smallest unit of execution
Memory Management
Processes should be isolated from one another Automatic allocation and management of programs, shielding user. Support of modular programming Protection and access control Long-term storage
Achievements
Information Protection and Security Scheduling and Resource Management
Fairness Differential Responsiveness Efficiency Preemption WIN2k IS 35 million lines of code! Modularity Hierarchy Information abstraction
System Structure
OS Levels
Level Name
13 Shell 12 User Processes 11 Directories 10 Devices 9 File Systems 8 Communications 7 Virtual Memory 6 Secondary storage 5 Primative processes 4 Interrupts 3 Procedures 2 Processor instruction set 1 Electronic Circuits
OS Levels 1-4
Not part of the OS: Rather the hardware.
Interrupt handling routines are an OSrelated concept.
Levels 5-6-7: Single processor resources
Level 5: Process as a program in execution
Simple abilities to suspend and resume processes
(saving hardware registers)
Simple synchronization
Level 6: Secondary storage devices Level 7: Create logical address space for processes.
Virtual address space organized into blocks
Levels 8-13: External Objects
Level 8: Communication of information and messages between processes. Richer communication than level 5 (pipes). Level 9 File System: Long-term storage of named files.
Other Characteristics of Modern OS
Microkernel Architecture
Many OS had large monolithic kernel.
Scheduling, file system, networking, device drivers, memory management Implemented as single process, with all elements sharing the same address space.
Microkernel architecture:
Kernel is small, only a few essential functions.
Address spaces, IPC, basic scheduling.
Microkernel, cont.
Other OS services provided by processes (servers) that run in user mode.
Servers can be customized. Simplifies implementation, well-suited to a distributed environment.
Interacts with local and remote servers the same way.
More Characteristics of Modern OS:
Multithreading:
Thread: dispatchable unit of work. Includes processor context, own data area, Executes sequentially and is interruptible. Process: Collection of one or more threads.
Enhanced efficiency vs. enhanced danger.
Modern OS: SMP
Symmetric Multiprocessing
Multiple processors Share same main memory and I/O facilities All processors can perform same functions. Performance Availability Incremental Growth Scalability
Advantages:
OS must provide tools and functions to exploit parallelism in an SMP. Multithreading and SMP are orthogonal but work well together
Overview of Win and LINUX
Windows:
Modified microkernel architecture Highly modular Each system function managed by just one component of the OS. Rest of OS, and applications, access through standard interfaces. Many of system functions outside of microkernel run in user mode -performance
Windows Architecture
Concepts
HAL Microkernel Windows Executive Client/Server Model Threads and SMP Windows Objects
Windows
Hardware Abstraction Layer:
Makes each machines system bus, DMA controller, interrupt controller, system timers and memory module look the same to the kernel. Also delivers SMP support
Windows
Microkernel
Manages thread scheduling Process switching Interrupt handling Multiprocessor synchronization
Unlike rest of Executive, microkernels own code does not run in threads. Not preempible or pageable
Device Drivers
User I/O function calls specific hardware device I/O requests.
Windows Executive
Includes modules for specific system functions and provides API for user-mode software. I/O Manager Object manager Security reference monitor Process/thread manager LPC Facility Virtual memory manager Cache manager
Client/Server Model
Each environment subsystem and executive service subsystem is implemented as one or more processes. Process waits for request from client for a service Client requests service by sending a message Message routed through the Executive Answer routed back.
Client/Server
Simplifies executive Improves reliability Good basis for distributed computing
Windows Objects
Not fully OO OS. Not all entities are objects
Used when data opened for user mode access or when access shared, restricted. Represented as objects: files, processes, threads, semaphores, timers, windows, In microkernel:
Control objects Dispatcher objects.
UNIX Concepts
Originally designed as multi-user/multitasking OS Well refined kernel and libraries Different flavors designed by different companies/people
UNIX II
Traditional UNIX kernel monolithic, not designed to be extensible, few facilities for code reuse. LINUX: Not a feasible model.
Loose group of independent programmers
LINUX organized as relatively independent blocks: loadable modules.
LINUX Loadable Modules
Dynamic Linking: kernel module can be loaded and linked into the kernel while kernel already in memory and executing. Can be unlinked at any time.
Eases configuration and saves kernel memory.
Stackable Modules: Modules are hierarchical.
Kernel itself monitors need for particular functions and can load and unload modules as needed. Common code can be moved to a single module. Kernel can make sure needed modules present.