CYBR 3423 (Windland) - Chapter 2: Operating Systems Overview
Process Mgt
Memory blocks allocated to each process that contains the prog, data, and context info Each is recorded in a process list built and maintained by OS - list contains one entry per process and pointer to location of memory block Process index register has index to process list Program counter points to next instruction Base and limit registers define region in memory occupied by process - base = starting address - limit = size of region Program counter and all data references are interpreted relative to base register and must not exceed limit register value Process if a data structure - either executing or awaiting execution - state of process is contained in its context - allows development of powerful techniques for coordination - new features can be incorporated into OS
Kernel
"Nucleus" Part of OS is in main memory Contains most frequently used functions in OS and other portions currently in use.
OS Objectives
1. Convenience: Make computer more convenient to use 2. Efficiency: Allow computer resources to be used efficiently 3. Ability to evolve: Permit development, testing, introduction of new functions without interfering
OS Design
1. Distributed Operating System - illusion of single main memory space and - single secondary memory space and - unified access facilities 2. Object-Oriented Design - Used for adding modular extensions to a small kernel - Enables programmers to customize an operating system without disrupting system integrity - Eases the development of distributed tools and full-blown distributed operating systems
Process Components
1. Executable program 2. Association data needed by prog 3. Execution context of prog - process state - internal data by which OS can supervise and control process - separated from process - includes all info that OS needs to manage and that proc needs to execute process - includes contents of proc registers and infor of use to OS
OS Key Interfaces
1. Instruction Set Architecture (ISA) - defines repertoire of machine lang instructions that computer can follow - both application programs and utlilites may access - boundary between SW and HW - Access to additional instruction for managing system resources 2. Application Binary Interface (ABI) - defines standards for binary portability across progs - defines system call interface 3. Application programming interface (API) - gives program access to Hw resources and services available in system - uses HHL library calls - enables app SW to be ported easily to other system that support the same API
Advantages of Client/Server Architecture
1. Simplifies Exectuvie - no conflicts or duplications - easy to add new APIs 2. Improves reliability - servers are modularizes - no one server failure corrupts OS 3. Provides uniform means for application to communicate with servers via RPC without restricting flexibility - message-processing is hidden - stub packs reqs and sends as a message 4. Provides suitable base for distributed computing - remote procedure calls implemented using distributed client and server modules - Windows, server can pass message for processing for local server applications - dynamically based
Methods of redundancy
1. Spatial (physical) redundancy - multiple components that either perform the same function simultaneously or one component is available as a backup 2. Temporal redundancy - repeating a function or operation when an error is detected - effective with temporary faults but not useful for permanent faults 3. Information redundancy - provides fault tolerance by replicating or coding data - bit errors can be both detected and corrected
LINUX Kernel
Android OS not equivalent to Linux kernel Change; Android kernel lacks drivers not applicable in mobile envmt, making kernel smaller Android Enhances Linux kernel with mobile features Android relies on Linux for core system services and it acsts as abstraction layer between HWand rest
The Process
Central to the design of OS First used by Multics designers in 60s More general than job Several definitions - a program in execution - an instance of a running program - the entity that can be assigned to, and executed on, a processor - a unit of activity characterized by a single sequential thread of execution, a current state, and an associated set of system resources
Android System Libraries
Collection of useful system functions written in C or C++ and used by various components of the Android system Called from the application framework and applications through a Java interface Exposed to developers through the Android application framework Some of the key system libraries include:: - Surface Manager >>Drawing commands go off into off-screen bitmaps that are combined with others to form user display - OpenGL >> Cross-lang, multiplatform API for 2D and 3D graphics - Media Framework >> video recording and playing - SQL Database >> lightweight SQLite database engine, storing persisent data - Browser Engine >>WebKit library - Bionic LibC >> stripped-down version of C system library >> Java Native Interface (JNI)
OS Service: Accounting
Collects usage stats and monitors performance parameters
Client-Server Model
Common model for distributed computing Used by Windows OS services, environmental subsystems, and applications NT API: set of kernel-based services - provides core abstractions Windows uses far richer set of services - envmt subs and user-mode services are implemented as processes that communicate with clients via RPC - each server process waits for client request (sending a message) - server performs operation and returns status via message to client
Monitor POV
Controls sequence of events Resident monitor: part of monitor (most) in main memory Monitor reads in job and gives control to job Job returns control, results are sent to ouput
Multicore OS Considerations
Design challenge for: efficiently harness the multicore processing power and intelligently manage the substantial on-chip resources efficiently Central concern - how to match inherent parallelism of multicore system with performance reqs Potential for parallelism has 3 levels: 1. HW parallelism in each core proc = "instruction level parallelism" - may/not be exploited by app programmers and compilers 2. potential for multiprogramming and multithreaded execution within each processor 3. potential for a single application to execute in concurrent processes or threads across multiple cores Problem of how to best extract parallelism from computing workloads Two general strategies 1. Parallelism within applications
Memory Mgt
Five principal storage mgt responsibilities 1. Process isolation - Prevent independent processes from interfering with each other's memory, both data and instruction 2. Automatic allocation and mgt - dynamically allocate programs across memory hierarchy - allocation = transparent to user 3. Support of modular programming - programmers can define prog modules and create, destroy, or alter module sizes dynamically 4. Protection and access control - Allow portions of memory to be accessible in various ways by various users 5. Long-term storage - progs require means of storing info for extended periods of time, after power-off - done using objects called files OSs meet these
OS Service: System Access
For shared and public systems, OS controls access to system as a whole and to specific system resources. Must provide protection.
User-Mode Processes
Four types: 1. Special system processes - user-mode services needed to manage system - session mgr, authentication subsystem, etc. 2. Service processes - printer spooler, event logger, user-mode parts that cooperate with device drivers, network services, etc. - used by Microsoft and other developers to extend system functionality - only way to run background user-mode activity on a Windows system 3. Environment subsystems - different Os personalities (envmts) - supported: Win32, POSIX - each includes subsystem process shared among all application using subsystem and dynamic link libraries 4. User applications - Executables and DLLs that provide functionality users run - targeted at a specific enmt subsystem Windows supports applications written for multiple OS personalities. - uses common set of kernel mode components that underlie subs - implementation of each sub = new process Envmt sub provides GUI that defines look and feel of OS for a user - also includes API - apps only need recompilation to run on Windows - source code doesn't need modification
Developments toward modern OSs
Gradual evoluation of OS structure and capability Rate of change in demands on OS reqs modifications, enhancements, and new organization Different approaches and design elements •microkernel architecture •multithreading •symmetric multiprocessing •distributed operating systems •object-oriented design
UNIX Description
HW surrounded by OS SW OS = "system kernel" = "kernel" - emphasize user/app isolation Shell = user services + interfaces Kernel - Users invoke OS services directly.through programs - system call interface = boundary w/ user - primitive routines that interact directly with HW Two main parts in kernel 1. Process control - memory mgt scheduling, dispatching, syncing/interprocess communication of processes 2. File Mgt and IO - exchanges data between memory and external devices either as stream or blocks - several device drivrs used >> block-oriented, disk cache
Time-Sharing Systems
Handles multiple interactive jobs Proc time is shared among multiple users - simultaneously access system through terminals with the OS interleaving the execution of each user program in a short burst or quantum of computation Given n users, eachuser gets 1/n capacity
Android Application Framework
High-level building blocks accessible through standardized API's that programmers use to create new apps designed to simplify the reuse of components > Activity Manager: - Manages lifecycle of applications - Responsible for starting, stopping, and resuming the various applications > Window Manager - Java abstraction of the underlying Surface Manager - Allows applications to declare their client area and use features like the status bar > Package Manager - Installs and removes applications > Telephony Manager - Allows interaction with phone, SMS, and MMS services > Content Providers - nctions encapsulate application data that need to be shared between applications such as contacts > Resource Manager - manages application resources, such as localized strings and bitmaps > View System - provides the user interface (UI) primitives as well as UI Events > Location Manager - allows developers to tap into location-based services, whether by GPS, cell tower IDs, or local Wi-Fi databases > Notification Manager - manages events, such as arriving messages and appointments > XMPP - messaging functions between applications
MW Operating System Organization
Highly modular Each system function is managed by one OS component
Kernel Components
Interacting collection of components. all componentens execute on proc > Signals - use signals to call into a proc > System calls - means by which process requests a specific kernel service - several hundred calls - types: file system, scheduling, interprocess communication, socket, misc. > Processes and scheduler: tests, manages, schedules processes > Virtual memory: allocate and manage virtual memory for processes > File systems: provide global, hierarchical namespace for files, directories, and other file-related objs and provide file system functs > Network Protocols: Support Sockets interface for TCP/IP porotocl suite > Character device drivers: Manage devices requiring kernel to send/receive data one byte at a time > Block device drivers: Manage devices that read and write data in blocks > Network devce drivers: NICs and communications ports that connect to network devices > Traps and faults: Handle those generated by proc > Physical memory: Mg pool of page frames in real memory and allocate pages for virtual memory > Interrupts: Interrupts from peripheral devices
Principal tool for system programmers in developing early multiprogramming and multiuser interactive systems
Interrupt Proc could save context, suspend, branch to interrupt-handling routine, process interrupt, and return
Kernel-Mode Components of Windows
Kernel-mode components: > Executive: contains core Os services > Kernel: Controls execution of processors - manages thread scheduling, process switching, exception/interrupt handling, and multiprocessing syncing - doesn't run on threads > HW Abstraction Layer (HAL) - maps between generic hardware commands and responses and those unique to a specific platform - isolates OS from platform-specific HW differences - delivers support for SMP > Device drivers - dynamic libraries that extend the functionality of the Executive > Windowing and graphics system - implements the GUI functions
Scheduling and Resource Mgt
Key responsibility: manage various resources and schedule their use Three factors: 1. Fairness - approx equal and fair access 2. Differential responsiveness - discriminate among different classes of jobs - allocate and schedule to meet total reqs - dynamically 3. Efficiency - maximize throughput - minimize response time - accommodate as many users as possible - these goals conflict Operations-research problems and math results can be applied Measurement of system activity is important
Android Overview
Linux-based system designed for touchscreenmobile devices such as smartphones and tablet computers most popular mobile OS becoming standard OS for IoT Development was done by Android Inc., which was bought by Google in 2005 1stcommercial version (Android 1.0) was released in 2008 Most recent version is Android 4.3 (Jelly Bean) The Open Handset Alliance (OHA) was responsible for the Android OS releases as an open platform The open-source nature of Android has been the key to its success
Monolithic kernel
Most OS preciously Most OS functionality stored in kernel - scheduling - file system - networking - device drivers - memory mgt Implemented as single process
Modular Structure
Most UNIX kernels are monolithic: includes all OS functionality in one large block of cose on a single process with one address space All the functional components of the kernel have access to all of its internal data structures and routines - any changes = relinked and reinstalled - any modification is hard Linux is structured as a collection of modules - loadable modules: obj file whose code can be linked and unlinked from kernel - doesn't execute own process/thread - executed on behalf of current process - Relatively independent blocks Have two important characteristics: 1. Dynamic linking - can be loaded and linked to kernel while kernel is already in memory and executing - facilitates configuration and saves kernal emmory 2. Stackable modules - hierarchy - libraries for client mods to reference or clients themselves to underdogs - dependencies can be defined -- code common to set of similar modules can be moved into a single module -- kernel can mke sure needed module are present, not unloading module on which other running mods are dpeendent, and loading any required additional mods when a new mod is loaded Kernel monitors need for functions and can load/unload as needed
Multiprogrammed Batch Systems
Multiprogrammin = multitasking = switching to another job while waiting on another multiple jobs can run simultaneously in minimum time Must rely on HW - IO-interrupitng and DMA HW: proc can issue an IO command for one job and proceed to execute another Fairly sophisticated compared to single-program, UNIPROGRAMMING, systems Having several pans on the stove requires memory management
Information Protection and Security
Nature of the threat will vary greatly depending on circumstances Problem of controlling access to computer systems and the information stored in them Four categories of security work: 1. Availability - protecting against interruption 2. Confidentiality - protecting data from unauthorized access 3. Data integrity - protecting data from unauthorized modification 4. Authenticity - proper verification of user identity and message/data validity
OS Service: Program Execution
Number of steps must be performed to execute a program Instructions and data are loaded OS handles scheduling
Ease of Evolution of an OS
OS evolves because > Hardware upgrades + new HW types > New services - OS expands to meet user demands or system manager needs > Fixes - Faults are located and fixed Need to change places res on its design System should be modular, clearly defined interfaces, and well documented.
OS as a Resource Manager
OS is responsible for managing computer's resources for moving, storing, process data and their function controls OS controls computer's basic functions - functions like ordinary SW; it's a program or suite of programs - frequently relinquishes control and depends on proc to regain control Provides instructions for proc that direct it in using other sstem resources and timing Os decides when IO device can be used by a program and controls access to and use of files
OS Service: Error Detection and Response
OS provides response to errors with little impact
OS Service: Controlled File Access
OS reflects understanding of IO device and data contained. May provide protection mechanisms to control access
Compatible Time-Sharing Systems
One of the first time-sharing operating systems MIT, Project MAC Developed for IBM 709 in 1961 Primitive Ran on a computer with 32,000 36-bit words of main memory, with the resident monitor consuming 5000 of that To simplify both the monitor and memory management a program was always loaded to start at the location of the 5000th word Time slicing: System clock generates interrupts at a rate of approximately one every 0.2 seconds - OS regained control and could assign processor to another user - user would be preempted and another user loaded in - Old user programs and data were written out to disk - Old user program code and data were restored in main memory when that program was next given a turn Since job was always loaded into same locations in memory, no need for relocations techniques at load time Max: 32 users
OS Service: IO Device Access
Os provides uniform interface to allow file access under hidden details to allow for simple reads and writes
Parallelism within applications
Problem: How to split up application work into independently executable tasks? Solutions: Grand Central Dispatch (GCD) - implemented in latest UNIX-based Mac OS X release and iPhone OS - helps a developer once something has been identified that can be split off into a separate task - thread pool mechanism: OS maps tasks onto threads; heavily used in server application - allows anonymous functions as a way of specifying tasks
Processor POV
Processor executes instructions from portion of resident memory, causing next job to be read into another portion of main memory. Executes until it encounters ending or error condition Proc fetches next instruction from monitor program and control returns to monitor
Operating System
Program that controls the execution of application programs and acts as an interface between applications and the computer hardware
Major elements of Scheduling and Allocation
Queues: list of processes waiting for some resource 1. Short-term queue - processes that are in memory and ready to run as soon as the proc is available - up to short-term scheduler or dispatcher to pick a prog -- round robin: give each process some time -- or assign priority levels 2. Long-term queue - new jobs waiting to use proc - OS adds jobs by transferring from longterm to short-term 3. IO queue - one per IO device - all processes wiaitng to use each device lines up in that device's queue Once interrupter/service call is handled, short-term scheduler must pick a process for execution
symmetric multiprocessing
SMP computer hardware architecture OS behavior that exploits that architecture OS schedules processes or threads across all processors Advantages > Performance - system with multiple procs will yield greater performance than a system with one - more than one process can be running simultaneously, each on a different processor > Availability - failure of a single process does not halt the system > Incremental growth - performance of a system can be enhanced by adding an additional processor > Scaling - vendors can offer a range of products based on the number of processors configured in the system POTENTIAL not guaranteed benefits Useful for nonthreaded processes too SMP and Multithreading can complement each other Multiple processors are transparent to the user - OS takes care of it - these processors share same main memory and I/O facilities - all processors can perform the same functions
Android SW Architecture
SW stack including OS kernel, middleware, key applicatios - complete SW stack - embedded Linux
Microsoft Windows Architecture
Separates app-oriented SW from core OS SW Executive, Kernel, device drivers, and HW abstraction layer run in kernel mode - access to system data and HW - rest SW has limited access
Job Control Language (JCL)
Special type of programming language used to provide instructions to the monitor FORTRAN
LINUX Overview
Started out as a UNIX variant for the IBM PC Linus Torvalds, a Finnish student of computer science, wrote the initial version posted on the Internet in 1991 Collaboration of people to improve it full-featured UNIX system that runs on several platforms free and the source code is available Key to success has been the availability of free software packages Highly modular and easily configured Significant penetration into corp world
Solaris 10
Sun's SVR4-based UNIX release Provides all of the features of SVR4 plus a number of more advanced features such as - a fully preemptable, multithreaded kernel - full support for SMP - an object-oriented interface to file systems Most widely used and most successful commercial UNIX implementation
Traditional UNIX Systems
System V Release3 and earlier Runs on single proc Lacks data structure protection Not versatile, supports single type of file system, process scheduling, and executable file format Not designed to be extensible, few facilitieis for code reuse
Development of the Process
Three major lines of computer system development created problems in timing and synchronization that contributed to the development: 1. Multiprogramming batch operations - designed o keep proc and IO devices busy for max efficiency - in response to completion interrupts, proc is switched among various progs in main memory 2. Time sharing - be responsive to needs of individual user AND support multiple users simultaneously - works because of slow reaction time of the user - OS overhead 3. Real-time transaction - several users are entering queries or updates - time is paramountDevelopment of the Process
Simple Batch Systems
To maximize proc utilization First developed by General Motors in 50s and later implemented by IBM 704 Central idea: use monitor software - user submits job on cards/tape to operator - operator batches jobs together sequentially and places batch on inpu device - each program branches back to monitor when done Desirable HW Features - Memory protection: detect error, transfer control to monitor; monitor aborts job, prints out error message - Timer; prevent system monopolization by one job; set at beginning of job; after expirations, program stops - Privileged instructions: only executed by monitor - Interrupts: flexibility in relinquishing control to and regaining control from user programs User program executes in user mode (certain areas of memory are proteccted) and monitor executes in kernel mode (privileged instructions can be executed and protected memory areas are accessible) Proc time alternates between user prog execution and monitor executions. Sacrifices: - Soem main memory is given over to monitor - some proc time is consumed by monitory - overhead, but batch system improves utilization
Background of Microsoft Windows
Use name Windows in 1985 Operating environment extension to primitive MS-DOS OS (a successful OS on early PCs) Replaces by a new version of Windows - Windows NT in 1993 - new internal design - 32-bit machines Now, windows 8 - most significant change - works across wide range of devices - major OS and interface changes Many advances - separation of client and server versions - Kernel and Executive are same - Windows 8 = fundamental OS changes, especially in process mgt and virtual memory mgt
OS as a User-Computer Interface
User's not concerned with HW details and views it as a set of applications. Facilities ease programmer's job Most important collection of system programs comprises the OS OS masks details of HW from programmer
Fault tolerance
ability of a system or component to continue normal operation despite the presence of hardware or software faults involves redundancy Intended to increase the reliability of a system - comes with a cost in financial terms or performance extent adoption of fault tolerance measures must be determined by how critical the resource is
Android Activities
activity is a single visual user interface component, including things such as menu selections, icons, and checkboxes Every screen in an application is an extension of the Activity class Use Views to form graphical user interfaces that display information and respond to user actions
Fundamental Concepts of Fault Tolerance
basic measures: 1. Reliability - R(t) - probability of its correct operation up to time t given that the system was operating correctly at time t=0 - correct operation means correct execution of a set of programs and protection of data from unintended modification 2. Mean time to failure (MTTF) - sigma R(t) - mean uptime - better indicator than availability 3. Mean time to repair (MTTR) - average time it takes to repair or replace a faulty element 4. Availability - defined as the fraction of time the system is available to service users' requests - probability that an entity is operating correctly under given conditions at a given instant - A = MTTF / (MTTF + MTTR) Downtime = not available Uptime = available
Symmetric Multiprocessor OS Considerations
multiprocessor OS must provide all the functionality of a multiprogramming system plus additional features to accommodate multiple processors Key Design Issue: > Simultaneous concurrent processes or threads - kernel routines need to be reentrant to allow several processors to execute the same kernel code simultaneously - avoid data corruption or invalid operations > Scheduling - any processor may perform scheduling, which complicates the task of enforcing a scheduling policy > Synchronization - with multiple active processes having potential access to shared address spaces or shared I/O resources, care must be taken to provide effective synchronization - enforces mutual exclusion and event ordering > Memory management - reuse of physical pages is the biggest problem of concern - must be guaranteed that a physical page can no longer be accessed with its old contents before page is put to new use > Reliability and fault tolerance - graceful degradation in the face of processor failure - recognize loss of a proc and restructure mgt tables accordingly
OS Mechanisms
number of techniques can be incorporated into OS software to support fault tolerance > process isolation - Processes are isolated from each other (memory, file access, etc.) > Concurrency controls - communication and cooperation - correct operation and recovery from fault conditions > Virtual machines - greater degree of application isolation and fault isolation - redundnacy > checkpoints and rollbacks - checkpoint: copy of app's state saved in some storage that's immune to failures - rollback resets execution from previously saved checkpoint - if failure, state is rolled back to previous checkpoint and restarted there - used to recover from failures
Android system architecture
simplified abstraction Following Layers: > Applications and FW: devs concerned with this layer and APOs that allow services > Binder IPC: mech allows application FW to cross process boundaries and call Android systems service code; allows high-level FW > Android System Services: Access underlying HW and kernel functions -- Media: playing and recording media - System services: sys functions visible to the app > HW Abstraction Layer (HAL): Standard interface to kernel-layer device drivers - virtually unchanged from Linux > Linux Kernel: tailored to meet demands of a mobile envmt
Windows Executive modules
> IO manager - provides framework through which IO devices are accessible to appls - dispatches appropriate device drivers - implements all Windows IO APIs - enforces strong security and naming for devices > Cache manager - creates, manages, deletes Exec objects used to represent resources - enforces uniform rules for retaining naming and setting security - creates entries in each processes' handl table > Plug-an-play manager - determines which drivers are required to support a particular device and loads those drivers > Power manager - coordinates power mgt among devices - can be configures to reduce power consumption > Security reference monitor 0 enforces access-validation and audit-generation rules - allows for consistent and uniform view of security > Virtual memory manager - manages virtual addresses, physical memory, and paging files - control memory mgt HW and data structures > Process/thread mgr - creates, manages, deletes process and thread objects > Configuration mgr - implements and mgs system registry (repository for system-wide and per-user settings of various params > Advances localc procedure call (ALPC) facility - implements an efficient cross-process procedure call mechanism for communication beterrn local processes implementing services and subsystems - similar to remote procedure call used for distributing process
Threads and SMP
> OS routines can run on any available processor, and different routines can execute simultaneously on different processors > Windows supports the use of multiple threads of execution within a single process. Multiple threads within the same process may execute on different processors simultaneously > server processes may use multiple threads to process requests from more than one client simultaneously > Windows provides mechanisms for sharing data and resources between processes and flexible interprocess communication capabilities
Virtual Memory
A facility that allows programs to address memory from a logical point of view, without regard to the amount of main memory physically available Conceived to meet the req of having multiple user jobs reside in main memory concurrently
multithreading
A process execuritn an application is divided into threads that run concurrently > Thread - dispatchable unit of work - includes processor context and data area - executes sequentially - interruptable > Processor - collection of one or more threads and associated system resources - programmer has greater control over modularity of application and timing of application related events Useful for applications that perform a number of essentially indpendent tasks that don't need to be serialized.
Thread
A single process can be broken up into multiple, concurrent threads that execute cooperatively to perform work of the process New level of parallel activity
System V Release 4 (SVR4)
AT&T + Sun Microsyste,s Combines features from SVR3, 4.3BSD, Microsoft XenixSystem V, and SunOS Total rewrite of System V kernel Clean, complex, implementation -real-time processing support - process scheduling classes - dynamically allocated data structures - virtual memory management - virtual file system - preemptive kernel Draws on efforts of commercial and academic designers Developed to provide uniform latform for commerical UNIX deployment Most important UNIX variant Runs on procs ranging from 32-bit microprocessors to supercomps
Four Major Achievements
Advances in OS development Processes Memory Mgt Info protection and security Scheduling and resource mgt Together, they span many of the key design and implementation issues of modern OSs
Android Power Management
Alarms: - Implemented in the Linux kernel and is visible to the app developer through the AlarmManagerin the RunTimecore libraries - Is implemented in the kernel so that an alarm can trigger even if the system is in sleep mode - allows the system to go into sleep mode, saving power, even though there is a process that requires a wake up Wakelocks: - Prevents an Android system from entering into sleep mode - These locks are requested through the API whenever an application requires one of the managed peripherals to remain powered on - An application can hold one of the following wakelocks: Full_Wake_Lock, Partial_Wake_Lock, Screen_Dim_Wake_Lock. Screen_Bright_Wake_Lock
Android Applications
All user-interaction applications are part of application layer Implemented in Java Key goal: make it easy for developers to implement new apps for specific devices and specific end usre reqs
Paging
Allow processes to be comprised of a number of fixed-size blocks called pages Prog references a word by using a virtual address consisting of a page number and an offset in page. Provides for dynamic mapping between virtual address used in program and real address, or physical address, in main memory Next step: eliminate req that all pages of process reside in main memory simultaneously - if not in main memory, Hw detects and arranges for missing page to be loaded = VIRTUAL MEMORY Proc HW + OS = virtual proc with access to virtual memory - memory may be linear address space or collection of segments - instructions can reference program and data location in virt. memory area - process isolation - memory sharing - file maintenance and copying Concerns - storage = directly addressable main memory + lower-speed auxiliary memory - address translation HW is interposed between proc and memory - progs reference location using virt addresses - if reference is made to a virt address not in real memory, a portion of real memory contents are swapped in - process generating address reference must be suspended - need a address translation mechanism with little overhead and storage application policy that minimizes traffic.
microkernel architecture
Assigns only a few essential functions to the kernel - Address spaces - interprocess communication - basic scheduling - other services run in servers and run in user mode Result - simplifies implementation - provides flexibility - well suited to a distributed environment Interacts with local and remote server process in the same way, facilitating construction of distributed systems
Virtual Machine Approach
Attempting to multiprogram individual cores may be a misplaced use of resources Allows one or more cores to be dedicated to a particular process and then leave the processor alone to devote its efforts to that process Avoid overhead of task switching and scheduling Multicore OS could then act as a hypervisor that makes a high-level decision to allocate cores to applications but does little in the way of resource allocation beyond that With multiprogramming - each application thinks it's running on a dedicated proc - based on concept of a process With multicore - drop distinction o kernel and user mode - OS = hypervisor and programs are reponsible to duties of resource mgt - Os assignes application proc and memory and prog itself will best know how to use the resources
History of Unix
Bell Labs Operation on a PDP-7 in 1970 - many ideas from Multics Same people worked on MIT's MAC, which led to CTSS and Multics First notable milestone: porting UNIX from PDP-7 to PDP-11 Next: Reqriting UNIX in programming lang. Why? > Memory = small, expensive, so need effective use > Small and efficient code essential > Proc and bus speeds slow, need to save clock cycles Written in C - demonstrated the advantages of using a high-level language 1974 - UNIX system describes, great interest First widely available version outside Bell Labs was Version 6 in 1976 Licenses to schools and commercial Most important non-AT&T: Berkeley's UNIX BSD ran on VAX and PDP 1982 - Bell Labs combines several variants - sells as UNIX System III
BSD
Berkeley SW Distribution Key role in development of OS design theory 4.xBSD is widely used in academic installations and has served as the basis of a number of commercial UNIX products - resp for UNIX popularity - most enhancements first appearedin BSD 4.4BSD was the final version of BSD to be released by Berkeley - major upgrade to 4.3BSD - a new virtual memory system - changes in the kernel structure - several other feature enhancements FreeBSD - one of the most widely used and best documented versions - popular for Internet-based servers and firewalls - used in a number of embedded systems - Mac OS X is based on FreeBSD 5.0 and the Mach 3.0 microkernel
Windows Objects
Design draws heavily on object-oriented design Key concepts: 1. Encapsulation - object consists of 1+ data - only way to access is invoking object services - easily protected from unauthorized use and incorrect use 2. Object class and instance - base class: specifies virtual methods that support creating, naming objects - Dispatcher objects: Exec objs that inherit properties of event obj 4. Polymorphism - manipulate objects - Windows aint completely poly Not all entities in Windows are objs - used where data is for user mode access or data access is shared or restricted - files, processes threads, semaphores, etc. Windows creates and manages all types uniformly via obj manager - resp for creating and destroying objs - granting access to obj's service and data Each object in Exec = memory block allocated by kernal and accessed by kernel - applications manipulate objs indirectly through functions - apps receive handles for objs they requested Objs may have sec info = Security Descriptor (SD) - used to restrict access - based on contents of token obj which describes particular user Objs are named/unnamed - when unnamed, obj mgr returns handler to that obj - only way to reference - Named objs are named again for unrelated processes to obtain handle Two types of objs 1. Dispatcher objs - subset of Exec objs - threads can wait on to control dispatching and syncing of thread-based system operations 2. Control objs - used by kernel component - manage operation of proc in areas not managed by normal thread scheduling Windows NOT OO OS - not implemented in OO lang - illustrates pow of OO tech
Serial Processing
Early computers - late 40s to mid 50s - programmer interacted with HW, no OS - ran from display lights, toggle switches, some form of input device, and a printer - programs loaded via input device - errors were indicated by lights, or normal = appearedon printer Two main problems 1. Scheduling - hardcopy sign-up sheets - wasted computer time 2. Setup time - A single program could involve tapes/card decks - any errors, start from beginning - lots of time Users had to access computer in SERIES
Four main causes of programming errors
Errors - Difficult to diagnose - Difficult to determine cause 1. Improper synchronization - routine must be suspended awaiting an even elsewhere in the system - program must wait until the data are available in a buffer - improper design of the signaling mechanism can result in loss or duplication 2. Failed mutual exclusion - more than one user will use a shared resource simultaneously - if accesses not controlled, error may occur, so must be mutual exclusion - implementation is difficult to verify as being correct under all possible sequences of events 3. Nondeterminate program operation - results of prog should depend on input, not other progs - when progs share memory , they may interfere with each other areas by overwriting common memory areas - order in hwich progs are schedules may affect outcome of a prog 4. Deadlocks - two+ progs are hung up waiting for each other - may depend on chance timing of resource allocation and release
Android Runtime
Every Android application runs in its own process with its own instance of the Dalvikvirtual machine (DVM) DVM executes files in the Dalvik Executable (.dex) format Component includes a set of core libraries that provides most of the functionality available in the core libraries of the Java programming language To execute an operation the DVM calls on the corresponding C/C++ library using the Java Native Interface (JNI)
OS Service: Program Development
Facilities and services to assist he programmer in creating programs In the form of utility programs that are supplied with the OS and care called Application Program Development tools
Fault Categories
Fault: Erroneous HW or SW state resulting from component failure, operator error, physical interference from environment, design error, prog error, data structure error Mainfests itself as (1) defect in HW or (2) incorrect step Groups 1. Permanent - always present - persists until faulty component is replaced or repaired 2. Temporary - not present all the time for all operating conditions - Transient --occurs only once - Intermittent -- occurs at multiple, unpredictable times