Operating%20Systems%20I - PowerPoint PPT Presentation

About This Presentation
Title:

Operating%20Systems%20I

Description:

Operating Systems I – PowerPoint PPT presentation

Number of Views:73
Avg rating:3.0/5.0
Slides: 26
Provided by: Tah109
Category:

less

Transcript and Presenter's Notes

Title: Operating%20Systems%20I


1
O.S. STRUCTURE
2
OS Structure (View)
3
OS Structure
  • An OS consists of
  • all these components
  • system service routines
  • system programs (privileged and non-privileged)
  • The big issue
  • How to organise all of these components?
  • What are the entities and where do they exist?
  • How do these entities co-operate?

4
Monolithic Approach
  • Basically, how to build a complex system that is
  • performing well
  • reliable
  • extensible
  • Traditionally, systems were built as monolithic
    kernels

5
Monolithic Systems
  • Problems with monolithic kernels
  • hard to understand
  • hard to modify
  • unreliable a bug anywhere causes crashes
  • hard to maintain
  • Since the beginning, several ways of organising
    OS design and implementation were proposed

6
Structuring
  • Layering is the most popular approach
  • the system is implemented as a set of layers
  • each layer is a virtual machine to the layer
    below
  • each layer provides a machine that has higher
    level features

7
Layering in THE
  • Layering was used for the first time in
    Dijkstras THE system

8
THE layered OS
  • THE is composed of a set of static processes
  • Each process performs a sequential computation
  • Processes communicate through explicit
    synchronisation statements
  • Each process could be tested and verified
    independently
  • Each layer sees a logical machine provided by the
    lower layers
  • layer 0 Allocation of processor and
    multiprogramming
  • layer 1 Allocates space for processes in main
    memory
  • layer 2 handles commn between process and I/o
  • layer 3 handles commn different processes
  • Layer 4 handles the organization of file systems
  • Layer 5 handles user programs

9
Problems with layering
  • The approach is not flexible
  • Major changes in one layer will have effect on
    other layers
  • Security difficult due to interaction of layers
  • Difficult to customize the os

10
Microkernel Approach
  • The structure organisation currently in vogue is
    microkernel
  • Benefits of m-kernel implementation
  • uniform interfaces
  • object-oriented OS
  • distributed system support
  • minimise the kernel
  • put as much as possible in the user process level

11
Microkernel OS
  • As a result
  • better reliability and portability
  • easy to extend and customise
  • poor performance (unfortunately)
  • Examples
  • first micro-kernel was Hydra(CMU, 1970)
  • CMU Mach system
  • Chorus (Unix-like system)
  • in some ways Microsoft Windows NT

12
Microkernel System Structure
13
Hardware Features OS
14
OS and Hardware
  • OS is partly dedicated to a specific hardware
    architecture
  • Hardware support can greatly simplify (or
    complicate) the OS design
  • Example
  • PC OSs have been primitive, because of the lack
    in hardware support (e.g. VM)

15
OS Hardware
  • Some hardware features that can directly support
    OS needs
  • protected instructions
  • OS protection (kernel/user mode)
  • memory protection
  • interrupts and exceptions
  • timer (clock) operations
  • synchronisation (atomic instructions)
  • I/O control operations

16
Protected Instructions
  • Some instructions are typically restricted to the
    OS
  • users are not allowed direct access to I/O (disk,
    printer,) (can be done through privileged
    instructions or memory mapping)
  • Direct access to I/O devices like disks,
    printers, etc.
  • Must control instructions that manipulate memory
    management state (page table pointers, TLB load,
    etc.)
  • special mode bit settings (kernel mode)
  • halt instructions

17
Which of the following instructions (or
instruction sequences) should only be allowed in
kernel mode?
  • Disable all interrupts.
  • Read the time of day clock.
  • Set the time of day clock.
  • Change the memory map.
  • Write to the hard disk controller register.

18
(No Transcript)
19
Crossing Protection Boundaries
  • To execute a privileged instructions, one must
    call OS procedures
  • How does a user-mode call a kernel-mode service?
  • There must be system call instructions that
  • causes an exception, and kernel handler takes
    place
  • passes parameters indicating which system routine
    to run
  • saves callers state (PC, mode bit, )
  • must allow OS to check callers parameters
  • must be able to return to user-mode when finished

20
Protection and Crossing
21
Memory Protection
  • Must be able to protect users programs from each
    other
  • must protect OS from user programs
  • Simplest scheme to do so is to use base and limit
    registers
  • base and limit registers are loaded by the OS
    before starting the execution

22
Traps and exceptions
  • Traps and exceptions are initiated by the
    application
  • Hardware must detect special conditions page
    fault, write to
  • a read-only page, overflow, trace trap, odd
    address trap,
  • privileged instruction trap...
  • Must transfer control to handler within the
    O.S.
  • Hardware must save state on fault (PC, etc) so
    that the
  • faulting process can be restarted afterwards
  • Modern operating systems use VM traps for many
    functions
  • debugging, garbage collection

23
I/O issues
  • how to start an I/O (special instructions or
    memory-mapped I/O)
  • I/O completion (interrupts)
  • Synchronous I/O 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.
  • Asynchronous I/O After I/O starts, control
    returns to user program
  • without waiting for I/O completion.

24
I/O Control
  • Interrupts are the basis for asynchronous I/O
  • devices and CPU perform operations asynchronously
  • devices send interrupt signal when done
  • a vector table containing the list of kernel
    routine addresses to handle various events
  • CPU switches to the address indicated by the
    interrupt signal

25
Timer
  • How does the OS prevent against runaway user
    programs
  • (infinite loops)?
  • A timer can be set to generate an interrupt in
    a given time.
  • Before it transfers to a user program, the OS
    loads the timer
  • with a time to interrupt.
  • When the time arrives, the executing program is
    interrupted
  • and the OS regains control.
  • This ensures that the OS can get the CPU back
    even if a user
  • program erroneously or purposely continues to
    execute
  • past some allotted time.
  • The timer is privileged only the OS can load
    it.
Write a Comment
User Comments (0)
About PowerShow.com