2-systemstructure-110817130451-phpapp02.pdf

Embed Size (px)

Citation preview

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    1/32

    Vinay AroraCSED,TU

    System Structure

    Organized By: Vinay Arora

    Assistant Professor

    CSED, TU

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    2/32

    Vinay AroraCSED,TU

    Disclaimer

    This is NOT A COPYRIGHT MATERIAL

    Content has been taken mainly from the following books:

    Operating Systems Concepts By Silberschatz & Galvin,Operating Systems: Internals and Design Principles By William Stallings

    www.os-book.comwww.cs.jhu.edu/~yairamir/cs418/os2/sld001.htm

    www.personal.kent.edu/~rmuhamma/OpSystems/os.html

    http://msdn.microsoft.com/en-us/library/ms685096(VS.85).aspx

    http://www.computer.howsttuffworks.com/operating-system6.htm

    http://williamstallings.com/OS/Animations.htmlhttp://msdn.microsoft.com/en-us/library/aa450566.aspx

    www.os-book.com

    http://www.yolinux.com/TUTORIALS/ForkExecProcesses.html

    Etc

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    3/32

    Vinay AroraCSED,TU

    Operating System Services User Interface - Almost all operating systems have a user interface.

    Command-Line (CLI), Graphics User Interface (GUI)

    Program Execution - The system must be able to load a programinto memory and to run that program, end execution.

    I/O Operations - A running program may require I/O, which mayinvolve a file or an I/O device.

    File-System Manipulation - Programs need to read and write filesand directories, create and delete them, search them, list fileInformation, permission management.

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    4/32

    Vinay AroraCSED,TU

    Operating System Services

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    5/32

    Vinay AroraCSED,TU

    Communications Processes may exchange information.

    Communications may be via shared memory or through messagepassing.

    Error Detection OS needs to be constantly aware of possible errors

    May occur in the CPU and memory hardware, in I/O devices orin user program

    For each type of error, OS should take the appropriate action.

    Debugging facilities

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    6/32

    Vinay AroraCSED,TU

    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

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    7/32

    Vinay AroraCSED,TU

    CLI

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    8/32

    Vinay AroraCSED,TU

    CLI

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    9/32

    Vinay AroraCSED,TU

    Operating System Interface - GUI User-friendly 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 (known as a folder)

    Many systems now include both CLI and GUI interfaces

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    10/32

    Vinay AroraCSED,TU

    GUI

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    11/32

    Vinay AroraCSED,TU

    Layered View

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    12/32

    Vinay AroraCSED,TU

    System Call Programming interface to the services provided by the OS.

    Typically written in a high-level language (C or C++)

    The invocation of an operating system routine.

    Operating systems contain sets of routines for performing various low-

    level operations.

    For example, all operating systems have a routine for creating adirectory. If you want to execute an operating system routine from a

    program, you must make a system call.

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    13/32

    Vinay AroraCSED,TU

    Mostly accessed by programs via a high-level Application Program

    Interface (API) rather than direct system call use.

    Why use APIs rather than system calls? There are specific reasons for

    using APIs or Programming with APIs, Instead of direct System Calls.

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    14/32

    Vinay AroraCSED,TU

    System Call Sequence when Copying from One

    File to another

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    15/32

    Vinay AroraCSED,TU

    API Consider the ReadFile() function in the Win32 APIa function for reading from a file

    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 fromDWORD 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

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    16/32

    Vinay AroraCSED,TU

    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 returnsstatus 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 librariesincluded with compiler)

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    17/32

    Vinay AroraCSED,TU

    System Call Interface

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    18/32

    Vinay AroraCSED,TU

    Example Windows/Unix system Call

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    19/32

    Vinay AroraCSED,TU

    Types of System Calls Process Control

    File Management

    Device Management

    Information Maintenance

    Communications

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    20/32

    Vinay AroraCSED,TU

    System Program Provide a convenient environment for program development and

    execution

    Some of them are simply user interfaces to system calls; others are

    considerably more complex

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    21/32

    Vinay AroraCSED,TU

    Standard C Library Example C program invoking printf() library call, which calls write() system call

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    22/32

    Vinay AroraCSED,TU

    Operating System Design & Implementation

    Important principle to separate

    Policy: What will be done?

    Mechanism: How to do it?

    Mechanisms determine how to do something, policies decide what willbe done

    The separation of policy from mechanism is a very important

    principle, it allows maximum flexibility if policy decisions are to be

    changed later

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    23/32

    Vinay AroraCSED,TU

    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

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    24/32

    Vinay AroraCSED,TU

    Layered View of Operating System

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    25/32

    Vinay AroraCSED,TU

    Microkernel System Structure Moves as much from the kernel into user space

    Communication takes place between user modules using messagepassing

    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

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    26/32

    Vinay AroraCSED,TU

    Virtual Machines Fundamental Idea behind a virtual machine is to abstract the hardware

    of a single Computer into several different execution environments.

    Illusion will be created that each separate execution environment is

    running its own private computer.

    The Operating System creates the illusion of multiple processes, each

    executing on its own processor with its own (virtual) memory.

    The virtual-machine concept provides complete protection of system

    resources since each virtual machine is isolated from all other virtual

    machines.

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    27/32

    Vinay AroraCSED,TU

    VMware Architecture

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    28/32

    Vinay AroraCSED,TU

    BIOS

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    29/32

    Vinay AroraCSED,TU

    Motherboard BIOS

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    30/32

    Vinay AroraCSED,TU

    System Boot

    Operating system must be made available to hardware so hardware can

    start it

    Small piece of code bootstrap loader, locates the kernel, loads it

    into memory, and starts it

    Sometimes two-step process where boot block at fixed location

    loads bootstrap loader

    When power initialized on system, execution starts at a fixed

    memory location

    Firmware used to hold initial boot code

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    31/32

    Vinay AroraCSED,TU

    Booting Steps

    Power On the Computer Machine. NO Data to process for the Processor.

    Data present in BIOS ROM will be processed first.

    Perform POST.

    Display System Settings.

    Load Interrupt Handler and Device Drivers. Check CMOS for custom settings.

    Initiate the Bootstrap sequence.

    Searching for target BOOT drive.

    Locate the MBR .

    Start OS.

  • 8/14/2019 2-systemstructure-110817130451-phpapp02.pdf

    32/32

    Vinay AroraCSED,TU

    Thnx