CS 471: Operating Systems Spring 2006 - PowerPoint PPT Presentation

1 / 105
About This Presentation
Title:

CS 471: Operating Systems Spring 2006

Description:

techniques that 10 years ago only used in OSs now in ... Now firewalled, networked. Scientific environment. High performance. 36. OS Applications Domains ... – PowerPoint PPT presentation

Number of Views:79
Avg rating:3.0/5.0
Slides: 106
Provided by: cso7
Category:

less

Transcript and Presenter's Notes

Title: CS 471: Operating Systems Spring 2006


1
CS 471 Operating SystemsSpring 2006
  • M. Overstreet
  • Old Dominion University
  • Slide Set 1

2
Intro
  • Slides other class material available
  • www.cs.odu.edu/cmo
  • These slides provide an outline only--you still
    need to take notes
  • Class overview
  • project oriented, teams, UNIX based
  • tightly scheduled project components
  • C based
  • See syllabus for schedule, exam weights, etc.

3
Why Study OSs?
  • Understand what youre using
  • Nice design of complex task
  • General knowledge for computer scientists
    engineers
  • Prog. techniques that 10 years ago only used in
    OSs now in application code
  • you should know the std solutions before your
    try to invent new ones

4
What is anOperating System?
  • A program that acts as an intermediary between a
    user of a computer and the computer hardware and
    software.
  • Operating system goals
  • Execute user programs and make solving user
    problems easier.
  • Make the computer system convenient to use.
  • Use the computer hardware in an efficient manner.

5
Operating System Definition
  • OS is a resource allocator
  • Manages all resources
  • Decides between conflicting requests for
    efficient and fair resource use
  • Checks access authority
  • OS is a control program
  • Controls execution of programs to prevent errors
    and improper use of the computer

6
Operating System Definition (Cont.)
  • No universally accepted definition
  • Everything a vendor ships when you order an
    operating system is good approximation
  • But varies wildly
  • The one program running at all times on the
    computer is the kernel. Everything else is
    either a system program (ships with the operating
    system) or an application program

7
Computer Startup
  • bootstrap program is loaded at power-up or reboot
  • Typically stored in ROM or EEPROM, generally
    known as firmware
  • Initializates all aspects of system
  • Loads operating system kernel and starts
    execution
  • Assignment for next class why is this called
    bootstrap?

8
Traditional Functions of OS
  • Resource mgr
  • share with many people/processes
  • efficient use of resources
  • Concerns
  • ease of use
  • utilization/efficiency/speed
  • accounting
  • security
  • Make life easier for users
  • software developers
  • general users

9
Productivity Enhancement
  • Costs reduced since people are more productive
  • programmers quicker product development
  • end users quicker completion of tasks
  • simulators for safety, training, design
  • New devices/approaches/capabilities
  • cars, highways, planes
  • electric razors, DVD players, integrated home
    entertainment systems
  • phones, pdas
  • e-commerce, distributed people, distributed
    software

10
Computer System Organization
  • Computer-system operation
  • One or more CPUs, device controllers connect
    through common bus providing access to shared
    memory
  • Concurrent execution of CPUs and devices
    competing for memory cycles

11
Computer-System Operation
  • I/O devices and the CPU can execute concurrently
    so things happen in parallel.
  • Each device controller in charge of a particular
    device type.
  • Each device controller has a local buffer.
  • CPU moves data from/to main memory to/from local
    buffers
  • I/O is from the device to local buffer of
    controller.
  • Device controller informs CPU that it has
    finished its operation by causing an interrupt.

12
Common Functions of Interrupts
  • Interrupt transfers control to the interrupt
    service routine generally through the interrupt
    vector that contains the addresses of all the
    service routines.
  • Interrupt architecture must save the address of
    the interrupted instruction.
  • Incoming interrupts are usually disabled while
    another interrupt is being processed to prevent a
    lost interrupt.
  • A trap is a software-generated interrupt caused
    either by an error or a user request.
  • An operating system is interrupt driven.

13
Interrupt Handling
  • The operating system preserves the state of the
    CPU by storing registers and the program counter.
  • Determines which type of interrupt has occurred
  • polling
  • vectored interrupt system
  • Separate segments of code determine what action
    should be taken for each type of interrupt
  • Some languages let your write your own interrupt
    handlers
  • though risky. why?

14
Interrupt Timeline
15
Two I/O Structures
  • After I/O starts, control returns to user program
    only upon I/O completion.
  • Wait instruction idles the CPU until the next
    interrupt
  • Wait loop (contention for memory access).
  • At most one I/O request is outstanding at a time,
    no simultaneous I/O processing.
  • After I/O starts, control returns to user program
    without waiting for I/O completion.
  • System call request to the operating system to
    allow user to wait for I/O completion.
  • Device-status table contains entry for each I/O
    device indicating its type, address, and state.
  • Operating system indexes into I/O device table to
    determine device status and to modify table entry
    to include interrupt.

16
Two I/O Methods
Synchronous
Asynchronous
17
Which Approach?
  • Is easier for programmers to code?
  • Is faster?
  • Is better?
  • The point
  • Each has advantages in some but not all
    situations, so both are better sometimes

18
Direct Memory Access Structure
  • Used for high-speed I/O devices able to transmit
    information at close to memory speeds.
  • Device controller transfers blocks of data from
    buffer storage directly to main memory without
    CPU intervention.
  • Only on interrupt is generated per block, rather
    than the one interrupt per byte.

19
Storage Structure
  • Main memory only large storage media that the
    CPU can access directly.
  • Secondary storage extension of main memory that
    provides large nonvolatile storage capacity.
  • Magnetic disks rigid metal or glass platters
    covered with magnetic recording material
  • Disk surface is logically divided into tracks,
    which are subdivided into sectors.
  • The disk controller determines the logical
    interaction between the device and the computer.

20
What are bootstraps
  • ?

21
Storage Hierarchy
  • Storage systems organized in hierarchy
  • Speed
  • Cost
  • Volatility
  • Caching copying information into faster storage
    system main memory can be viewed as a last cache
    for secondary storage.

22
Storage-Device Hierarchy
23
Caching
  • Important principle, performed at many levels in
    a computer (in hardware, operating system,
    software)
  • Information in use copied from slower to faster
    storage temporarily
  • Faster storage (cache) checked first to determine
    if information is there
  • If it is, information used directly from the
    cache (fast)
  • If not, data copied to cache and used there
  • Cache smaller than storage being cached. Why?
  • Cache management important design problem
  • Cache size and replacement policy

24
Performance of Various Levels of Storage
  • Movement between levels of storage hierarchy can
    be explicit or implicit

25
Operating System Structure
  • Multiprogramming needed for efficiency
  • Single user cannot keep CPU and I/O devices busy
    at all times
  • Multiprogramming organizes jobs (code and data)
    so CPU always has one to execute
  • A subset of total jobs in system is kept in
    memory
  • One job selected and run via job scheduling
  • When it has to wait (for I/O for example), OS
    switches to another job
  • Timesharing (multitasking) is logical extension
    in which CPU switches jobs so frequently that
    users can interact with each job while it is
    running, creating interactive computing
  • Response time should be lt 1 second
  • Each user has at least one program executing in
    memory ?process
  • If several jobs ready to run at the same time ?
    CPU scheduling
  • If processes dont fit in memory, swapping moves
    them in and out to run
  • Virtual memory allows execution of processes not
    completely in memory

26
Operating-System Operations
  • Interrupt driven by hardware
  • Software error or request creates exception or
    trap
  • Division by zero, request for operating system
    service
  • Other process problems include infinite loop,
    processes modifying each other or the operating
    system
  • Dual-mode operation allows OS to protect itself
    and other system components
  • User mode and kernel mode
  • Mode bit provided by hardware
  • Provides ability to distinguish when system is
    running user code or kernel code
  • Some instructions designated as privileged, only
    executable in kernel mode
  • System call changes mode to kernel, return from
    call resets it to user

27
Transition from User to Kernel Mode
  • Timer to prevent infinite loop / process hogging
    resources
  • Set interrupt after specific period
  • Operating system decrements counter
  • When counter zero generate an interrupt
  • Set up before scheduling process to regain
    control or terminate program that exceeds
    allotted time

28
Process Management
  • A process is a program in execution. It is a unit
    of work within the system. Program is a passive
    entity, process is an active entity.
  • Process needs resources to accomplish its task
  • CPU, memory, I/O, files
  • Initialization data
  • Process termination requires reclaim of any
    reusable resources
  • Single-threaded process has one program counter
    specifying location of next instruction to
    execute
  • Process executes instructions sequentially, one
    at a time, until completion
  • Multi-threaded process has one program counter
    per thread
  • Typically system has many processes, some user,
    some operating system running concurrently on one
    or more CPUs
  • Concurrency by multiplexing the CPUs among the
    processes / threads

29
Process Management Activities
  • The operating system is responsible for the
    following activities in connection with process
    management
  • Creating and deleting both user and system
    processes
  • Suspending and resuming processes
  • Providing mechanisms for process synchronization
  • Providing mechanisms for process communication
  • Providing mechanisms for deadlock handling

30
Memory Management
  • All data in memory before and after processing
  • All instructions in memory in order to execute
  • Memory management determines what is in memory
    when
  • Optimizing CPU utilization and computer response
    to users
  • Memory management activities
  • Keeping track of which parts of memory are
    currently being used and by whom
  • Deciding which processes (or parts thereof) and
    data to move into and out of memory
  • Allocating and deallocating memory space as
    needed

31
Storage Management
  • OS provides uniform, logical view of information
    storage
  • Abstracts physical properties to logical storage
    unit - file
  • Each medium is controlled by device (i.e., disk
    drive, tape drive)
  • Varying properties include access speed,
    capacity, data-transfer rate, access method
    (sequential or random)
  • File-System management
  • Files usually organized into directories
  • Access control on most systems to determine who
    can access what
  • OS activities include
  • Creating and deleting files and directories
  • Primitives to manipulate files and dirs
  • Mapping files onto secondary storage
  • Backup files onto stable (non-volatile) storage
    media

32
Mass-Storage Management
  • Usually disks used to store data that does not
    fit in main memory or data that must be kept for
    a long period of time.
  • Proper management is of central importance
  • Entire speed of computer operation hinges on disk
    subsystem and its algorithms
  • OS activities
  • Free-space management
  • Storage allocation
  • Disk scheduling
  • Some storage need not be fast
  • Tertiary storage includes optical storage,
    magnetic tape
  • Still must be managed
  • Varies between WORM (write-once, read-many-times)
    and RW (read-write)

33
I/O Subsystem
  • One purpose of OS is to hide peculiarities of
    hardware devices from the user
  • I/O subsystem responsible for
  • Memory management of I/O including buffering
    (storing data temporarily while it is being
    transferred), caching (storing parts of data in
    faster storage for performance), spooling (the
    overlapping of output of one job with input of
    other jobs)
  • General device-driver interface
  • Drivers for specific hardware devices

34
Protection and Security
  • Protection any mechanism for controlling access
    of processes or users to resources defined by the
    OS
  • Security defense of the system against internal
    and external attacks
  • Huge range, including denial-of-service, worms,
    viruses, identity theft, theft of service
  • Systems generally first distinguish among users,
    to determine who can do what
  • User identities (user IDs, security IDs) include
    name and associated number, one per user
  • User ID then associated with all files, processes
    of that user to determine access control
  • Group identifier (group ID) allows set of users
    to be defined and controls managed, then also
    associated with each process, file
  • Privilege escalation allows user to change to
    effective ID with more rights

35
Computing Environments
  • Traditional computer
  • Blurring over time
  • Office environment
  • PCs connected to a network, terminals attached to
    mainframe or minicomputers providing batch and
    timesharing
  • Now portals allowing networked and remote systems
    access to same resources
  • Home networks
  • Used to be single system, then modems
  • Now firewalled, networked
  • Scientific environment
  • High performance

36
OS Applications Domains
  • Distributed systems
  • centralized control
  • security
  • maintenance, software/hardware updates
  • performance
  • efficiency
  • sharing
  • reliability
  • PCs
  • ease of use
  • Embedded systems
  • reliability
  • performance, new capabilities

37
OS Basic Services/Tasks
  • Security - protect resources from accidental and
    malicious corruption authorized use only
  • Mutual Exclusion in mgmt of shared resources
  • User interfaces
  • simplify frequently performed tasks
  • hide complexities/changes
  • File system organization
  • Efficient access and storage
  • Communication

38
Std OS Domains
  • Embedded (fly airplane, control power plant,
    manage phone, play audio)
  • often real-time
  • Transaction driven systems (banks, airline res.)
  • distributes access controlled reliable
    modification of data base
  • Distributed systems
  • maintain consistent system, move system to people
    rather than people to system
  • Web-enabled services e-bay, digital libraries,
    google
  • e-commerce, etc.

39
Quiz 1
  • Connect speed from home?
  • A Modem? Speed?
  • B DSL
  • C Cable? Who provides?
  • E Other
  • F None
  • Why is Windows better than UNIX?
  • Why is UNIX better than Windows?

40
2. Work?
  • A. full-time
  • B. part-time
  • C. not employed

41
Last Step
  • Mail me your answers and the grade you got on the
    quiz so I can record it. (cmo_at_cs.odu.edu)

42
Class Project Option A
  • Build key parts of OS
  • Parts are exactly the same code that could be
    part of a real operating system
  • Use simulation to drive OS
  • Mostly, give it work to do so you can measure key
    performance aspects
  • Then use your system to study effect of
    alternative approaches, designs
  • 2 to 3 person groups

43
Class Project Option B
  • Modify existing OS Minix 3
  • Will modify and then boot from your OS
  • Warning
  • Weve done similar things in the past
  • Lots of students had lots of trouble
  • You will need a PC
  • Make it boot your OS
  • Run your OS on a virtual machine using existing
    virtual machine software

44
Assignments
  • Rd text, Ch 1 2, do problems from syllabus.
  • Maybe a quiz on ch 1 2 next wk?
  • If you have a group member preference, please
    send to me e-mail by next Tuesday, Jan. 24.
  • If you might be interested in minix, note that in
    the e-mail. You do not need to commit yet,
    particularly since you havent seen the term
    project description.

45
Computer System Components
  • 1. Hardware provides basic computing resources
    (CPU, memory, mass storage, I/O devices).
  • 2. Operating system controls, protects, and
    coordinates the use of the hardware/software
    among the various application programs for the
    various users.
  • 3. Applications programs define the ways in
    which the system resources are used to solve the
    computing problems of the users (compilers,
    database systems, video games, business apps).
  • 4. Users (people, software, other computers).

46
Abstract View of System Components
47
Operating System Definitions
  • Resource allocator manages and allocates
    resources.
  • Control program controls the execution of user
    programs and operations of I/O devices .
  • Kernel the one program running at all times
    (all else being application programs)
  • Distinction between application code and OS
    somewhat arbitrary
  • Microsoft tends to claim much application code is
    really part of OS

48
History Mainframe Systems
  • Original conceptual model machine shop
  • Reduce setup time by batching similar jobs
  • Automatic job sequencing automatically
    transfers control from one job to another. First
    rudimentary operating system.
  • Resident monitor
  • initial control in monitor
  • control transfers to job
  • when job completes control transfers pack to
    monitor

49
Historical Main Goal Efficiency
  • Very few computers
  • ODU had two when I came
  • Administrative IBM OS/360
  • Academic DEC 10
  • All users (administrators, faculty, students) had
    accounts with money and all services were
    charged against that account.
  • When you spent all of your money, you could no
    longer use the computer.
  • Accounts encouraged users to be more efficient
  • A primary OS design concern was how to get more
    done with less

50
Memory Layout for aSimple Batch System
51
Multiprogrammed Batch Systems
Several jobs are kept in main memory at the same
time, and the CPU is multiplexed among them.
52
OS Features Needed for Multiprogramming
  • I/O routine supplied by the system.
  • Memory management the system must allocate the
    memory to several jobs.
  • CPU scheduling the system must choose among
    several jobs ready to run.
  • Allocation of devices.

53
Time-Sharing SystemsInteractive Computing
  • The CPU is multiplexed among several jobs that
    are kept in memory and on disk (the CPU is
    allocated to a job only if the job is in memory).
  • A job can be swapped in and out of memory to the
    disk.
  • On-line communication between the user and the
    system is provided when the operating system
    finishes the execution of one command, it seeks
    the next control statement from the users
    keyboard.
  • On-line system must be available for users to
    access data and code.

54
Desktop Systems
  • Personal computers computer system dedicated to
    a single user.
  • I/O devices keyboards, mice, display screens,
    small printers.
  • User convenience and responsiveness.
  • Can adopt technology developed for larger
    operating system.
  • Often individuals have sole use of computer and
    do not need advanced CPU utilization or
    protection features.
  • May run several different types of operating
    systems (Windows, MacOS, UNIX, Linux)

55
Parallel Systems
  • Multiprocessor systems with more than on CPU in
    close communication.
  • Tightly coupled system processors share memory
    and a clock communication usually takes place
    through the shared memory.
  • Advantages of parallel system
  • Increased throughput
  • Economical
  • Increased reliability
  • graceful degradation
  • fail-soft systems

56
Parallel Systems (Cont.)
  • Symmetric multiprocessing (SMP)
  • Each processor runs and identical copy of the
    operating system.
  • Many processes can run at once without
    performance deterioration.
  • Most modern operating systems support SMP
  • Asymmetric multiprocessing
  • Each processor is assigned a specific task
    master processor schedules and allocated work to
    slave processors.
  • More common in extremely large systems

57
Symmetric Multiprocessing Architecture
58
Distributed Systems
  • Distribute the computation among several physical
    processors.
  • Loosely coupled system each processor has its
    own local memory processors communicate with one
    another through various communications lines,
    such as high-speed buses or telephone lines.
  • Advantages of distributed systems.
  • Resources sharing
  • Computation speed up load sharing
  • Reliability
  • Communications

59
Distributed Systems (cont)
  • Requires networking infrastructure.
  • Local area networks (LAN) or Wide area networks
    (WAN)
  • May be either client-server or peer-to-peer
    systems.

60
General Structure ofClient-Server
61
Clustered Systems
  • Clustering allows two or more systems to share
    storage.
  • Provides high reliability.
  • Asymmetric clustering one server runs the
    application while other servers standby.
  • Symmetric clustering all N hosts are running the
    application.

62
Real-Time Systems
  • Often used as a control device in a dedicated
    application such as flying an airplane,
    controlling fuel mixture in a car, controlling
    scientific experiments, medical imaging systems,
    industrial control systems, and some display
    systems.
  • Well-defined fixed-time constraints.
  • Real-Time systems may be either hard or soft
    real-time.

63
Real-Time Systems (Cont.)
  • Hard real-time
  • Secondary storage limited or absent, data stored
    in short term memory, or read-only memory (ROM)
  • Conflicts with time-sharing systems, not
    supported by general-purpose operating systems.
  • Soft real-time
  • Limited utility in industrial control of robotics
  • Useful in applications (multimedia, virtual
    reality) requiring advanced operating-system
    features.

64
Handheld Systems
  • Personal Digital Assistants (PDAs)
  • Cellular telephones
  • Issues
  • Limited memory
  • Slow processors
  • Small display screens.

65
Migration of Operating-System Concepts and
Features
66
Computing Environments
  • Traditional computing
  • Web-based computing
  • Embedded computing

67
OS Interfaces
  • Three main ones
  • hide messy details of system from users
  • hide messy details of OS from programmers OS
    provides std set of services.
  • hide details of hardware from application code
  • simplify concepts
  • handle really tricky stuff
  • as HW changes, application code need not
  • failure in DOS to speed things up, pgms
    bypassed op sys and went directly to BIOS (or
    hw). Effect?

68
Two Common OS Interfaces
  • User command language
  • gui or command line
  • click on the icon, select item from menu
  • UNIX examples
  • lpq, mesg, touch, nohup, ...
  • Programmer
  • std set of OS calls. look like C ftn calls
  • malloc(size), fork(), execve(name,argv,envp),
    fdate(string), sleep(seconds), setuid(uid),
    socketpair(d,type,protocol,sv), read(d,buf,nbytes)

69
User Operating System Interface - CLI
  • CLI allows direct command entry
  • Sometimes implemented in kernel, sometimes by
    systems program
  • Sometimes multiple flavors implemented shells
  • Primarily fetches a command from user and
    executes it
  • Sometimes commands built-in, sometimes just names
    of programs
  • If the latter, adding new features doesnt
    require shell modification

70
User Operating System Interface - GUI
  • Desktop metaphor interface
  • Usually mouse, keyboard, and monitor
  • Icons represent files, programs, actions, etc
  • Various mouse buttons over objects in the
    interface cause various actions (provide
    information, options, execute function, open
    directory (also known as a folder)
  • Invented at Xerox PARC
  • then used by Apple then used by Microsoft
  • Many systems now include both CLI and GUI
    interfaces
  • Microsoft Windows is GUI with CLI command shell
  • Apple Mac OS X as GUI interface with UNIX kernel
    underneath and shells available (or KDE or ...)
  • Solaris is CLI with optional GUI interfaces (Java
    Desktop, KDE)

71
System Calls
  • Programming interface to the services provided by
    the OS
  • Typically written in a high-level language (C or
    C)
  • Mostly accessed by programs via a high-level
    Application Program Interface (API) rather than
    direct system call use
  • Three most common APIs are Win32 API for Windows,
    POSIX API for POSIX-based systems (including
    virtually all versions of UNIX, Linux, and Mac OS
    X), and Java API for the Java virtual machine
    (JVM)
  • Why use APIs rather than system calls?
  • (Note that the system-call names used throughout
    the text are generic)

72
Example of System Calls
  • System call sequence to copy the contents of one
    file to another file

73
Example of Standard API
  • Consider the ReadFile() function in the
  • Win32 APIa function for reading from a file
  • A description of the parameters passed to
    ReadFile()
  • HANDLE filethe file to be read
  • LPVOID buffera buffer where the data will be
    read into and written from
  • DWORD bytesToReadthe number of bytes to be read
    into the buffer
  • LPDWORD bytesReadthe number of bytes read during
    the last read
  • LPOVERLAPPED ovlindicates if overlapped I/O is
    being used

74
System Call Implementation
  • Typically, a number associated with each system
    call
  • System-call interface maintains a table indexed
    according to these numbers
  • The system call interface invokes intended system
    call in OS kernel and returns status of the
    system call and any return values
  • The caller need know nothing about how the system
    call is implemented
  • Just needs to obey API and understand what OS
    will do as a result call
  • Most details of OS interface hidden from
    programmer by API
  • Managed by run-time support library (set of
    functions built into libraries included with
    compiler)

75
API System Call OS Relationship
76
Standard C Library Example
  • C program invoking printf() library call, which
    calls write() system call

77
System Call Parameter Passing
  • Often, more information is required than simply
    identity of desired system call
  • Exact type and amount of information vary
    according to OS and call
  • Three general methods used to pass parameters to
    the OS
  • Simplest pass the parameters in registers
  • In some cases, may be more parameters than
    registers
  • Parameters stored in a block, or table, in
    memory, and address of block passed as a
    parameter in a register
  • This approach taken by Linux and Solaris
  • Parameters placed, or pushed, onto the stack by
    the program and popped off the stack by the
    operating system
  • Block and stack methods do not limit the number
    or length of parameters being passed

78
Parameter Passing via Table
79
Types of System Calls
  • Process control
  • File management
  • Device management
  • Information maintenance
  • Communications

80
MS-DOS execution
(a) At system startup (b) running a program
81
FreeBSD Running Multiple Programs
82
System Programs
  • System programs provide a convenient environment
    for program development and execution. The can
    be divided into
  • File manipulation
  • Status information
  • File modification
  • Programming language support
  • Program loading and execution
  • Communications
  • Application programs
  • Most users view of the operation system is
    defined by system programs, not the actual system
    calls

83
Solaris 10 dtrace Following System Call
84
System Programs
  • Provide a convenient environment for program
    development and execution
  • Some of them are simply user interfaces to system
    calls others are considerably more complex
  • File management - Create, delete, copy, rename,
    print, dump, list, and generally manipulate files
    and directories
  • Status information
  • Some ask the system for info - date, time, amount
    of available memory, disk space, number of users
  • Others provide detailed performance, logging, and
    debugging information
  • Typically, these programs format and print the
    output to the terminal or other output devices
  • Some systems implement a registry - used to
    store and retrieve configuration information

85
System Programs (contd)
  • File modification
  • Text editors to create and modify files
  • Special commands to search contents of files or
    perform transformations of the text
  • Programming-language support - Compilers,
    assemblers, debuggers and interpreters sometimes
    provided
  • Program loading and execution- Absolute loaders,
    relocatable loaders, linkage editors, and
    overlay-loaders, debugging systems for
    higher-level and machine language
  • Communications - Provide the mechanism for
    creating virtual connections among processes,
    users, and computer systems
  • Allow users to send messages to one anothers
    screens, browse web pages, send electronic-mail
    messages, log in remotely, transfer files from
    one machine to another

86
Operating System Design and Implementation
  • Design and Implementation of OS not solvable,
    but some approaches have proven successful
  • Internal structure of different Operating Systems
    can vary widely
  • Start by defining goals and specifications
  • Affected by choice of hardware, type of system
  • User goals and System goals
  • User goals operating system should be
    convenient to use, easy to learn, reliable, safe,
    and fast
  • System goals operating system should be easy to
    design, implement, and maintain, as well as
    flexible, reliable, error-free, and efficient

87
Operating System Design and Implementation (Cont.)
  • Important principle to separate
  • Policy What will be done? Mechanism How to
    do it?
  • Mechanisms determine how to do something,
    policies decide what will be done
  • The separation of policy from mechanism is a very
    important principle, it allows maximum
    flexibility if policy decisions are to be changed
    later

88
Simple Structure
  • MS-DOS written to provide the most
    functionality in the least space
  • Not divided into modules
  • Although MS-DOS has some structure, its
    interfaces and levels of functionality are not
    well separated

89
MS-DOS Layer Structure
90
Layered Approach
  • The operating system is divided into a number of
    layers (levels), each built on top of lower
    layers. The bottom layer (layer 0), is the
    hardware the highest (layer N) is the user
    interface.
  • With modularity, layers are selected such that
    each uses functions (operations) and services of
    only lower-level layers

91
Layered Operating System
92
UNIX
  • UNIX limited by hardware functionality, the
    original UNIX operating system had limited
    structuring. The UNIX OS consists of two
    separable parts
  • Systems programs
  • The kernel
  • Consists of everything below the system-call
    interface and above the physical hardware
  • Provides the file system, CPU scheduling, memory
    management, and other operating-system functions
    a large number of functions for one level

93
UNIX System Structure
94
Microkernel System Structure
  • Moves as much from the kernel into user space
  • Communication takes place between user modules
    using message passing
  • Benefits
  • Easier to extend a microkernel
  • Easier to port the operating system to new
    architectures
  • More reliable (less code is running in kernel
    mode)
  • More secure
  • Detriments
  • Performance overhead of user space to kernel
    space communication

95
Mac OS X Structure
96
Modules
  • Most modern operating systems implement kernel
    modules
  • Uses object-oriented approach
  • Each core component is separate
  • Each talks to the others over known interfaces
  • Each is loadable as needed within the kernel
  • Overall, similar to layers but with more flexible

97
Solaris Modular Approach
98
Virtual Machines
  • A virtual machine takes the layered approach to
    its logical conclusion. It treats hardware and
    the operating system kernel as though they were
    all hardware
  • A virtual machine provides an interface identical
    to the underlying bare hardware
  • The operating system creates the illusion of
    multiple processes, each executing on its own
    processor with its own (virtual) memory

99
Virtual Machines (Cont.)
  • The resources of the physical computer are shared
    to create the virtual machines
  • CPU scheduling can create the appearance that
    users have their own processor
  • Spooling and a file system can provide virtual
    card readers and virtual line printers
  • A normal user time-sharing terminal serves as the
    virtual machine operators console

100
Virtual Machines (Cont.)
  • (a) Nonvirtual machine (b)
    virtual machine

Non-virtual Machine
Virtual Machine
101
Virtual Machines (Cont.)
  • The virtual-machine concept provides complete
    protection of system resources since each virtual
    machine is isolated from all other virtual
    machines. This isolation, however, permits no
    direct sharing of resources.
  • A virtual-machine system is a perfect vehicle for
    operating-systems research and development.
    System development is done on the virtual
    machine, instead of on a physical machine and so
    does not disrupt normal system operation.
  • The virtual machine concept is difficult to
    implement due to the effort required to provide
    an exact duplicate to the underlying machine

102
VMware Architecture
103
The Java Virtual Machine
104
Operating System Generation
  • Operating systems are designed to run on any of a
    class of machines the system must be configured
    for each specific computer site
  • SYSGEN program obtains information concerning the
    specific configuration of the hardware system
  • Booting starting a computer by loading the
    kernel
  • Bootstrap program code stored in ROM that is
    able to locate the kernel, load it into memory,
    and start its execution

105
Standards
  • Much struggling to come up with standards for all
    of these
  • No clear line between mandatory services and
    conveniences (mem mgmt, I/O, window mgmt, bessel
    ftns, random numbers)
  • Vendors very protective of products, need product
    differentiation
  • API standards, e.g., posix
  • Works for both XP, Linux, Solaris, Mac, e.g.
Write a Comment
User Comments (0)
About PowerShow.com