SlideShare a Scribd company logo
1 of 168
OPERATING
          SYSTEMS

Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Objectives
To provide a grand tour of the major operating
 systems components
To provide coverage of basic computer system
 organization




     Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
What is an Operating System?

A program that acts as an intermediary between a user
 of a computer and the computer hardware.
Operating system goals:
Use the computer hardware in an efficient manner.




    Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Computer System Structure
 Computer system can be divided into four
  components
    Hardware
    Operating system
    Application programs
    Users




  Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Operating System Definition
        OS is a resource allocator
        OS is a control program




Operating System            Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Computer Startup
  bootstrap program is loaded at power-up or reboot
       Typically stored in ROM or EPROM, generally known
        as firmware
       Initializates all aspects of system
       Loads operating system kernel and starts execution




Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Computer System Organization




  Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Migration of Integer A from Disk to Register

  Multitasking environments must be careful to use most recent
      value, no matter where it is stored in the storage hierarchy




  Multiprocessor environment must provide cache coherency in
   hardware such that all CPUs have the most recent value in their
   cache
  Distributed environment situation even more complex
        Several copies of a datum can exist
        Various solutions covered in Chapter 17


Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
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 < 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 don’t fit in memory, swapping moves them in and
            out to run
          Virtual memory allows execution of processes not completely in
            memory
Operating System     Infosys-Campus Connect      M.LAVANYA M.C.A Dept
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
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

Operating System     Infosys-Campus Connect    M.LAVANYA M.C.A Dept
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




 Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
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
       Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
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




Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
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
    Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Memory Management
   Single Contiguous Memory Allocation
   Fixed Partition Memory Allocation
   Variable Partition Memory Allocation
   Relocatable Partition Memory Allocation
   Simple Paged Allocation




Operating System   Infosys-Campus Connect     M.LAVANYA M.C.A Dept
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



  Operating System       Infosys-Campus Connect       M.LAVANYA M.C.A Dept
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


Operating System      Infosys-Campus Connect   M.LAVANYA M.C.A Dept
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




Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Client-Server Computing
               Dumb terminals supplanted by smart PCs
               Many systems now servers, responding to requests generated by
               clients
                      Compute-server provides an interface to client to request
                       services (i.e. database)
                      File-server provides interface for clients to store and retrieve
                       files




Operating System            Infosys-Campus Connect       M.LAVANYA M.C.A Dept
Peer-to-Peer Computing
   Another model of distributed system
   P2P does not distinguish clients and servers
        Instead all nodes are considered peers
        May each act as client, server or both
        Node must join P2P network
             Registers its service with central lookup service on network,
              or
             Broadcast request for service and respond to requests for
              service via discovery protocol
        Examples include Napster and Gnutella

Operating System     Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Several jobs are kept in main memory at the same time, and the
      CPU is multiplexed among them.




Operating System    Infosys-Campus Connect    M.LAVANYA M.C.A Dept
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.




Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
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


Operating System      Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Time-Sharing Systems–Interactive 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 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 user’s
      keyboard.
     On-line system must be available for users to
      access data and code.




Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Real-Time Systems
         Often used as a control device in a dedicated
          application such as 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.




Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
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.




Operating System    Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Processes
               Process Concept
               Process Scheduling
               Operations on Processes
               Cooperating Processes
               Interprocess Communication
               Communication in Client-Server Systems




Operating System    Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Process Concept
        An operating system executes a variety of
            programs:
              Batch system – jobs
              Time-shared systems – user programs or tasks
        Process – a program in execution;
        process execution must progress in sequential
         fashion.
        A process includes:
              program counter
              stack
              data section




Operating System    Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Process State
        As a process executes, it changes state
           new: The process is being created.
           running: Instructions are being executed.
           waiting: The process is waiting for some event to
            occur.
           ready: The process is waiting to be assigned to a
            process.
           terminated: The process has finished execution.




Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Process Creation




Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Process Termination




Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Process Termination




Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Processes
 Not-running
      ready to execute
 Blocked
      waiting for I/O
 Dispatcher cannot just select the process that has
    been in the queue the longest because it may be
    blocked




Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
A Five-State Model
    Running
    Ready
    Blocked
    New
    Exit




Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Suspended Processes
   Processor is faster than I/O so all processes could be
    waiting for I/O
   Swap these processes to disk to free up more memory
   Blocked state becomes suspend state when swapped
    to disk
   Two new states
         Blocked/Suspend
         ReadySuspend




Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
One Suspend State




Case study -Two Suspend State
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Two Suspend States




Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Process Control Block (PCB)
              Information associated with each process.
              Process state
              Program counter
              CPU registers
              CPU scheduling information
              Memory-management information
              Accounting information
              I/O status information




Operating System    Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Process Scheduling Queues
      Job queue – set of all processes in the system.
      Ready queue – set of all processes residing in main
       memory, ready and waiting to execute.
      Device queues – set of processes waiting for an I/O
       device.
      Process migration between the various queues.




Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Implementation Questions
 How are links established?
 Can a link be associated with more than two
  processes?
 How many links can there be between every pair of
  communicating processes?
 What is the capacity of a link?
 Is the size of a message that the link can
  accommodate fixed or variable?
 Is a link unidirectional or bi-directional?

Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Direct Communication
Processes must name each other explicitly:
     send (P, message) – send a message to process P
     receive(Q, message) – receive a message from process
        Q
Properties of communication link
     Links are established automatically.
     A link is associated with exactly one pair of
      communicating processes.
     Between each pair there exists exactly one link.
     The link may be unidirectional, but is usually bi-
      directional.
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Indirect Communication
     Messages are directed and received from
        mailboxes (also referred to as ports).
           Each mailbox has a unique id.
           Processes can communicate only if they share a
             mailbox.
     Properties of communication link
        Link established only if processes share a common
         mailbox
        A link may be associated with many processes.
        Each pair of processes may share several
         communication links.
        Link may be unidirectional or bi-directional.



Operating System    Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Indirect Communication
     Operations
          create a new mailbox
          send and receive messages through mailbox
          destroy a mailbox
     Primitives are defined as:
        send(A, message) – send a message to mailbox
        A
        receive(A, message) – receive a message from
        mailbox A


Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Indirect Communication
Mailbox sharing
   P1, P2, and P3 share mailbox A.
   P1, sends; P2 and P3 receive.
   Who gets the message?
Solutions
   Allow a link to be associated with at most two
          processes.
       Allow only one process at a time to execute a receive
          operation.
       Allow the system to select arbitrarily the receiver.
          Sender is notified who the receiver was. Dept
Operating System    Infosys-Campus Connect M.LAVANYA M.C.A
CPU Scheduling
     Basic Concepts
     Scheduling Criteria
     Scheduling Algorithms
     Multiple-Processor Scheduling
     Real-Time Scheduling
     Algorithm Evaluation




Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Basic Concepts
 Maximum CPU utilization obtained with
  multiprogramming
 CPU–I/O Burst Cycle – Process execution consists of
  a cycle of CPU execution and I/O wait.
 CPU burst distribution




Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
CPU Scheduler
 Selects from among the processes in memory that are
  ready to execute, and allocates the CPU to one of them.
 CPU scheduling decisions may take place when a process:
      1. Switches from running to waiting state.
      2. Switches from running to ready state.
      3. Switches from waiting to ready.
      4.Terminates.
 Scheduling under 1 and 4 is nonpreemptive.
 All other scheduling is preemptive.


Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Dispatcher
 Dispatcher module gives control of the CPU to the
    process selected by the short-term scheduler; this
    involves:
      switching context
      switching to user mode
      jumping to the proper location in the user program to
         restart that program
 Dispatch latency – time it takes for the dispatcher to
    stop one process and start another running.


Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Scheduling Criteria
         CPU utilization – keep the CPU as busy as
          possible
         Throughput – # of processes that complete their
          execution per time unit
         Turnaround time – amount of time to execute a
          particular process
         Waiting time – amount of time a process has
          been waiting in the ready queue
         Response time – amount of time it takes from
          when a request was submitted until the first
          response is produced, not output (for time-
          sharing environment)

Optimization Criteria
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Optimization Criteria
 Max CPU utilization
 Max throughput
 Min turnaround time
 Min waiting time
 Min response time




Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
First-Come , First-Served (FCFS) Scheduling
                           Process     Burst Time
                               P1           24
                               P2            3
                               P3            3
        Suppose that the processes arrive in the order: P1 , P2 , P3
         The Gantt Chart for the schedule is:
                       P1                         P2        P3


           0                                 24        27        30

        Waiting time for P1 = 0; P2 = 24; P3 = 27
        Average waiting time: (0 + 24 + 27)/3 = 17


 Operating System   Infosys-Campus Connect         M.LAVANYA M.C.A Dept
FCFS Scheduling (Cont.)
 Suppose that the processes arrive in the order
                       P2 , P3 , P1 .
 The Gantt chart for the schedule is:

           P2          P3                            P1


     0             3            6                                  30

 Waiting time for P1 = 6; P2 = 0; P3 = 3
 Average waiting time: (6 + 0 + 3)/3 = 3
 Much better than previous case.
 Convoy effect short process behind long process
Operating System            Infosys-Campus Connect        M.LAVANYA M.C.A Dept
Shortest-Job-First (SJR) Scheduling
  Associate with each process the length of its next CPU
   burst. Use these lengths to schedule the process with the
   shortest time.
  Two schemes:
         nonpreemptive – once CPU given to the process it cannot be
          preempted until completes its CPU burst.
         preemptive – if a new process arrives with CPU burst length
          less than remaining time of current executing process,
          preempt. This scheme is know as the
          Shortest-Remaining-Time-First (SRTF).
  SJF is optimal – gives minimum average waiting time for a
      given set of processes.


Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Example of Non-Preemptive SJF
        Process Arrival Time                      Burst Time
           P1        0.0                               7
           P2        2.0                               4
           P3        4.0                               1
           P4        5.0                               4
 SJF (non-preemptive)
                   P1                   P3       P2           P4


             0      3               7        8         12            16

 Average waiting time = (0 + 6 + 3 + 7)/4 - 4

Operating System    Infosys-Campus Connect            M.LAVANYA M.C.A Dept
Example of Preemptive SJF
        Process Arrival Time                         Burst Time
           P1        0.0                                  7
           P2        2.0                                  4
           P3        4.0                                  1
           P4        5.0                                  4
 SJF (preemptive)
                P1       P2       P3       P2       P4             P1


            0        2        4        5        7        11                16


 Average waiting time = (9 + 1 + 0 +2)/4 - 3

Operating System         Infosys-Campus Connect          M.LAVANYA M.C.A Dept
Operating System       Infosys-Campus Connect
      M.LAVANYA M.C.A Dept
Determining Length of Next CPU Burst
  Can only estimate the length.
  Can be done by using the length of previous CPU
     bursts, using exponential averaging.
           1. tn = actual lenght of nthCPU burst
           2. τ n +1 = predicted value for the next CPU burst
           3. α , 0 ≤ α ≤ 1
           4. Define :


            τ n=1 = α tn + (1 − α )τ n .



 Operating System          Infosys-Campus Connect    M.LAVANYA M.C.A Dept
Priority Scheduling
 A priority number (integer) is associated with each
  process
 The CPU is allocated to the process with the highest
  priority (smallest integer ≡ highest priority).
       Preemptive
       nonpreemptive
 SJF is a priority scheduling where priority is the predicted
  next CPU burst time.
 Problem ≡ Starvation – low priority processes may never
  execute.
 Solution ≡ Aging – as time progresses increase the priority
  of the process.
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Round Robin (RR)
Each process gets a small unit of CPU time (time
 quantum), usually 10-100 milliseconds. After this time has
 elapsed, the process is preempted and added to the end of
 the ready queue.
If there are n processes in the ready queue and the time
 quantum is q, then each process gets 1/n of the CPU time
 in chunks of at most q time units at once. No process
 waits more than (n-1)q time units.
Performance
     q large ⇒ FIFO
     q small ⇒ q must be large with respect to context switch,
       otherwise overhead is too high.


Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Example of RR with Time Quantum = 20
                         Process                           Burst Time
                             P1                                53
                             P2                                17
                             P3                                68
                             P4                                24
           The Gantt chart is:

                        P1    P2         P3    P4     P1    P3   P4     P1   P3     P3

                    0        20     37        57    77     97 117     121 134 154 162

           Typically, higher average turnaround than SJF, but better
             response.




 Operating System                 Infosys-Campus Connect         M.LAVANYA M.C.A Dept
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Traditional UNIX Scheduling
    Multilevel feedback using round robin within each of
     the priority queues
    If a running process does not block or complete
     within 1 second, it is preempted
    Priorities are recomputed once per second
    Base priority divides all processes into fixed bands of
     priority levels




Operating System   Infosys-Campus Connect         M.LAVANYA M.C.A Dept
Memory Management
     Background
     Swapping
     Contiguous Memory Allocation
     Paging
     Structure of the Page Table
     Segmentation
     Example: The Intel Pentium




Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Objectives
      To provide a detailed description of
       various ways of organizing memory
       hardware
      To discuss various memory-management
       techniques, including paging and
       segmentation
      To provide a detailed description of the
       Intel Pentium, which supports both pure
       segmentation and segmentation with
       paging


Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Background
       Program must be brought (from disk) into
        memory and placed within a process for it to be
        run
       Main memory and registers are only storage
        CPU can access directly
       Register access in one CPU clock (or less)
       Main memory can take many cycles
       Cache sits between main memory and CPU
        registers
       Protection of memory required to ensure
        correct operation

Operating System   Infosys-Campus Connect       M.LAVANYA M.C.A Dept
Base and Limit Registers
       A pair of base and limit registers define the
           logical address space




Operating System                   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Binding of Instructions and Data to Memory
        Address binding of instructions and data to memory
           addresses can happen at three different stages
              Compile time: If memory location known a priori,
               absolute code can be generated; must recompile code
               if starting location changes
              Load time: Must generate relocatable code if
               memory location is not known at compile time
              Execution time: Binding delayed until run time if the
               process can be moved during its execution from one
               memory segment to another. Need hardware support
               for address maps (e.g., base and limit registers)




Operating System     Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Logical vs. Physical Address Space
       The concept of a logical address space that is
          bound to a separate physical address space is
          central to proper memory management
             Logical address – generated by the CPU; also
              referred to as virtual address
             Physical address – address seen by the memory
              unit
       Logical and physical addresses are the same in
          compile-time and load-time address-binding
          schemes; logical (virtual) and physical addresses
          differ in execution-time address-binding scheme


Operating System    Infosys-Campus Connect           M.LAVANYA M.C.A Dept
Memory-Management Unit (MMU)
     Hardware device that maps virtual to physical
         address

     In MMU scheme, the value in the relocation
         register is added to every address generated by
         a user process at the time it is sent to memory

     The user program deals with logical addresses;
         it never sees the real physical addresses


Operating System   Infosys-Campus Connect            M.LAVANYA M.C.A Dept
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Dynamic Loading
        Routine is not loaded until it is called
        Better memory-space utilization; unused
         routine is never loaded
        Useful when large amounts of code are needed
         to handle infrequently occurring cases
        No special support from the operating system is
         required implemented through program design




Operating System   Infosys-Campus Connect           M.LAVANYA M.C.A Dept
Dynamic Linking
        Linking postponed until execution time
        Small piece of code, stub, used to locate the
         appropriate memory-resident library routine
        Stub replaces itself with the address of the
         routine, and executes the routine
        Operating system needed to check if routine is
         in processes’ memory address
        Dynamic linking is particularly useful for
         libraries
        System also known as shared libraries


Operating System           Infosys-Campus Connect        M.LAVANYA M.C.A Dept
Swapping
 A process can be swapped temporarily out of memory to a backing store, and
  then brought back into memory for continued execution

 Backing store – fast disk large enough to accommodate copies of all memory
  images for all users; must provide direct access to these memory images

 Roll out, roll in – swapping variant used for priority-based scheduling
  algorithms; lower-priority process is swapped out so higher-priority process
  can be loaded and executed

 Major part of swap time is transfer time; total transfer time is directly
  proportional to the amount of memory swapped

 Modified versions of swapping are found on many systems (i.e., UNIX, Linux,
  and Windows)
 System maintains a ready queue of ready-to-run processes which have
  memory images on disk

  Operating System                Infosys-Campus Connect    M.LAVANYA M.C.A Dept
Schematic View of Swapping




Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Contiguous Allocation (Cont.)
          Multiple-partition allocation
              Hole – block of available memory; holes of various
               size are scattered throughout memory
              When a process arrives, it is allocated memory from a
               hole large enough to accommodate it
              Operating system maintains information about:
               a) allocated partitions b) free partitions (hole)

                   OS         OS                     OS          OS

             process 5      process 5             process 5   process 5
                                                  process 9   process 9

             process 8                                        process 10


             process 2      process 2             process 2   process 2

Operating System                Infosys-Campus Connect              M.LAVANYA M.C.A
Dept
Dynamic Storage-Allocation Problem
        How to satisfy a request of size n from a list of free holes
        First-fit: Allocate the first hole that is big enough
        Best-fit: Allocate the smallest hole that is big
             enough; must search entire list, unless ordered by
             size
                Produces the smallest leftover hole
         Worst-fit: Allocate the largest hole; must also
             search entire list
                Produces the largest leftover hole

        First-fit and best-fit better than worst-fit in terms of
        speed and storage utilization




Operating System              Infosys-Campus Connect               M.LAVANYA M.C.A Dept
Paging
           Logical address space of a process can be noncontiguous;
            process is allocated physical memory whenever the latter
            is available
           Divide physical memory into fixed-sized blocks called
            frames (size is power of 2, between 512 bytes and 8,192
            bytes)
           Divide logical memory into blocks of same size called
            pages
           Keep track of all free frames
           To run a program of size n pages, need to find n free
            frames and load program
           Set up a page table to translate logical to physical
            addresses
           Internal fragmentation

Operating System    Infosys-Campus Connect                     M.LAVANYA M.C.A Dept
Address Translation Scheme
        Address generated by CPU is divided into:

              Page number (p) – used as an index into a page table which
                   contains base address of each page in physical memory

              Page offset (d) – combined with base address to define the
                   physical memory address that is sent to the memory unit

                              page number           page offset
                                       p              d
                                     m-n               n
              For given logical address space 2m and page size 2n




Operating System           Infosys-Campus Connect                    M.LAVANYA M.C.A Dept
Operating System       Infosys-Campus
Connect            M.LAVANYA M.C.A
Dept
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
32-byte memory and 4-byte pages
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Before allocation              After allocation
Operating System      Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Implementation of Page Table
      Page table is kept in main memory
      Page-table base register (PTBR) points to the page
       table
      Page-table length register (PRLR) indicates size of
       the page table
      In this scheme every data/instruction access requires
       two memory accesses. One for the page table and one
       for the data/instruction.
      The two memory access problem can be solved by the
       use of a special fast-lookup hardware cache called
       associative memory or translation look-aside
       buffers (TLBs)
      Some TLBs store address-space identifiers (ASIDs) in
       each TLB entry – uniquely identifies each process to
       provide address-space protection for that process




Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Associative Memory
      Associative memory – parallel search
                                Page #       Frame #




         Address translation (p, d)
           If p is in associative register, get frame # out
           Otherwise get frame # from page table in
              memory

Operating System    Infosys-Campus Connect      M.LAVANYA M.C.A Dept
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Effective Access Time
        Associative Lookup = ε time unit
        Assume memory cycle time is 1 microsecond
        Hit ratio – percentage of times that a page
         number is found in the associative registers;
         ratio related to number of associative registers
        Hit ratio = α
        Effective Access Time (EAT)
                        EAT = (1 + ε) α + (2 + ε)(1 – α)
                           =2+ε–α
CASE STUDY-UNIX and Solaris
Memory Management
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
UNIX and Solaris Memory Management
                   Page Replacement
                     Refinement of the clock policy




Operating System       Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Memory Protection
       Memory protection implemented by
           associating protection bit with each frame

       Valid-invalid bit attached to each entry in
           the page table:
             “valid” indicates that the associated page is in
              the process’ logical address space, and is thus
              a legal page
             “invalid” indicates that the page is not in the
              process’ logical address space



Operating System     Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Shared Pages
       Shared code
        One copy of read-only (reentrant) code
          shared among processes (i.e., text editors,
          compilers, window systems).
        Shared code must appear in same location in
          the logical address space of all processes

       Private code and data
        Each process keeps a separate copy of the
          code and data
        The pages for the private code and data can
          appear anywhere in the logical address space


Operating System   Infosys-Campus Connect        M.LAVANYA M.C.A Dept
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Segmentation scheme that supports user
    Memory-management
         view of memory
        A program is a collection of segments. A segment is
         a logical unit such as:
                      main program,
                      procedure,
                      function,
                      method,
                      object,
                      local variables, global variables,
                      common block,
                      stack,
                      symbol table, arrays



Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
1

                                                         4
                       1

                                     2


                   3                                     2
                                    4

                                                         3




                   user space                physical memory space



Operating System    Infosys-Campus Connect   M.LAVANYA
M.C.A Dept
Segmentation Architecture
 Logical address consists of a two tuple:
              <segment-number, offset>,
 Segment table – maps two-dimensional
  physical addresses; each table entry has:
    base – contains the starting physical address
     where the segments reside in memory
    limit – specifies the length of the segment
 Segment-table base register (STBR) points
  to the segment table’s location in memory
 Segment-table length register (STLR)
  indicates number of segments used by a
  program;
             segment number s is legal if s <
  STLR
              Operating System       Infosys-Campus
              Connect            M.LAVANYA M.C.A
              Dept
Segmentation Architecture (Cont.)
 Protection
  With each entry in segment table associate:
      validation bit = 0 ⇒ illegal segment
      read/write/execute privileges

 Protection bits associated with segments;
  code sharing occurs at segment level
 Since segments vary in length, memory
  allocation is a dynamic storage-allocation
  problem
 A segmentation example is shown in the
  following diagram
              Operating System       Infosys-Campus
              Connect            M.LAVANYA M.C.A
              Dept
Operating System       Infosys-Campus
Connect            M.LAVANYA M.C.A
Dept
Operating System       Infosys-Campus
Connect            M.LAVANYA M.C.A
Dept
Example: The Intel Pentium
Supports both segmentation and segmentation with
 paging
CPU generates logical address
  Given to segmentation unit
       Which produces linear addresses
  Linear address given to paging unit
     Which generates physical address in main memory
     Paging units form equivalent of MMU




                 Operating System       Infosys-Campus
                 Connect            M.LAVANYA M.C.A
                 Dept
Operating System       Infosys-Campus
Connect            M.LAVANYA M.C.A
Dept
Background
 Virtual memory – separation of user logical
  memory from physical memory.
   Only part of the program needs to be in memory
    for execution.
   Logical address space can therefore be much
    larger than physical address space.
   Allows address spaces to be shared by several
    processes.
   Allows for more efficient process creation.


 Virtual memory can be implemented via:
   Demand paging
            Operating System       Infosys-Campus
   Demand segmentation
            Connect
            Dept
                               M.LAVANYA M.C.A
⇒




Operating System       Infosys-Campus
Connect            M.LAVANYA M.C.A
Dept
Operating System       Infosys-Campus
Connect            M.LAVANYA M.C.A
Dept
Background
 Virtual memory – separation of user logical
  memory from physical memory.
   Only part of the program needs to be in memory
    for execution.
   Logical address space can therefore be much
    larger than physical address space.
   Allows address spaces to be shared by several
    processes.
   Allows for more efficient process creation.


 Virtual memory can be implemented via:
   Demand paging
            Operating System       Infosys-Campus
   Demand segmentation
            Connect
            Dept
                               M.LAVANYA M.C.A
⇒




Operating System       Infosys-Campus
Connect            M.LAVANYA M.C.A
Dept
Operating System       Infosys-Campus
Connect            M.LAVANYA M.C.A
Dept
Operating System   Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Demand Paging
Bring a page into memory only when it is needed
  Less I/O needed
  Less memory needed
  Faster response
  More users


Page is needed ⇒ reference to it
  invalid reference ⇒ abort
  not-in-memory ⇒ bring to memory

                Operating System       Infosys-Campus
                Connect            M.LAVANYA M.C.A
                Dept
Operating System       Infosys-Campus
Connect            M.LAVANYA M.C.A
Dept
Operating System       Infosys-Campus
Connect            M.LAVANYA M.C.A
Dept
Operating System       Infosys-Campus
Connect            M.LAVANYA M.C.A
Dept
Performance of Demand Paging
Page Fault Rate 0 ≤ p ≤ 1.0
  if p = 0 no page faults
  if p = 1, every reference is a fault


Effective Access Time (EAT)
                EAT = (1 – p) x memory access
                          + p (page fault overhead
                          + [swap page out ]
                          + swap page in
                Connect
                          + restart overhead)
                Operating System     Infosys-Campus
                                 M.LAVANYA M.C.A
                Dept
Copy-on-Write
Copy-on-Write (COW) allows both parent and child
 processes to initially share the same pages in memory

 If either process modifies a shared page, only then is
 the page copied

COW allows more efficient process creation as only
 modified pages are copied

Free pages are allocated from a pool of zeroed-out
              Operating System       Infosys-Campus
 pages        Connect
              Dept
                                 M.LAVANYA M.C.A
Page Replacement
Prevent over-allocation of memory by modifying
 page-fault service routine to include page
 replacement

Use modify (dirty) bit to reduce overhead of page
 transfers – only modified pages are written to disk

Page replacement completes separation between
 logical memory and physical memory – large virtual
 memory can be provided on a smaller physical
 memory      Operating System
             Connect
                                  Infosys-Campus
                              M.LAVANYA M.C.A
              Dept
Operating System       Infosys-Campus
Connect            M.LAVANYA M.C.A
Dept
Basic Page Replacement
 1. Find the location of the desired page on disk

 2. Find a free frame:
        - If there is a free frame, use it
        - If there is no free frame, use a page
    replacement        algorithm to select a victim
    frame

 3. Read the desired page into the (newly) free
    frame. Update the page and frame tables.

 4. Restart the process
              Operating System
              Connect
                                     Infosys-Campus
                                 M.LAVANYA M.C.A
                 Dept
Operating System       Infosys-Campus
Connect            M.LAVANYA M.C.A
Dept
Operating System       Infosys-Campus
Connect            M.LAVANYA M.C.A
Dept
NTFS(New Technology File System
 Features of NTFS
   Security and access control
   Size of the files/The number of Files
   Recovery/Reliability
   Long file names




                Operating System       Infosys-Campus
                Connect            M.LAVANYA M.C.A
                Dept
NTFS(New Technology File System
 Overview of the partition structure
 Limitations of NTFS




               Operating System       Infosys-Campus
               Connect            M.LAVANYA M.C.A
               Dept
Device Management
I/O Channels
I/O devices and the CPU can execute concurrently.
Each device controller is 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.
                  Operating System       Infosys-Campus
                  Connect            M.LAVANYA M.C.A
                  Dept
Common Functions of Interrupts
Interrupt transfers control to the interrupt service
 routine generally, through the interrupt vector .
Incoming interrupts are 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.


               Operating System       Infosys-Campus
               Connect            M.LAVANYA M.C.A
               Dept
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



              Operating System       Infosys-Campus
              Connect            M.LAVANYA M.C.A
              Dept
Operating System       Infosys-Campus
Connect            M.LAVANYA M.C.A
Dept
I/O Structure
  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.


               Operating System       Infosys-Campus
               Connect            M.LAVANYA M.C.A
               Dept
Synchronous                        Asynchronous




   Operating System       Infosys-Campus
   Connect            M.LAVANYA M.C.A
   Dept
Operating System       Infosys-Campus
Connect            M.LAVANYA M.C.A
Dept
Device Management
   User Program                e.g. printf(“hello”)
                                                             language I/O interface
  Run-time Library
                                                               System Call interface:
                                                               … write stream of
                                                               chars
                                Identify device,
 I/O Manager                  check permissions
         Operating
         System
 Device Driver
                                                                Hardware interface:
                                                                …write character
 Interface Hardware
                                                                … put bits on screen
                                                                … write disk block
                     Operating System       Infosys-Campus
                     Connect            M.LAVANYA M.C.A
                     Dept
Device Speeds
        Device           Transfer Rate CPU Instructions per
                       (bytes per second)byte transferred (*)
       Keyboard                   10                 10 million

      56K modem
                                  6.8 K             ~15 thousand

        Ethernet                  1M+                   100
    (Cable modem?                (~63K)               (~1500)
        ADSL?)
      Disk Drive                 10 M                  ~10
      (CD ROM?)                 (few M)                (tens)
        Screen
                                10s M                   ~2
       (Printer?)
    (*) assume 100 MIPS.
    CPU speed: instructions/second (cf with clock speed: MHz)
    E.g.: Pentium 1GHz: up to 3000 MIPS, but, ...

            Operating System       Infosys-Campus
            Connect            M.LAVANYA M.C.A
            Dept
I/O Hardware
Variety of devices (WO, RO, RW)
Communicate with the machine via a
 connection point: port (e.g., serial port)
Devices within a computer are connected
 via a bus.
Controller: electronics that can operate a
 port, a bus, or a device.
  SCSI bus controller - host adapter circuit board:
   processes SCSI protocol messages

             Operating System       Infosys-Campus
             Connect            M.LAVANYA M.C.A
             Dept
An Input/Output interface
                     Input Buffer
  Memory

                     Output Buffer


                        Control

                                                input ready
   CPU                  Status


                                               output ready
           Bus


            Operating System          Infosys-Campus
            Connect               M.LAVANYA M.C.A
            Dept
Synchronising CPU and I/O
Polling:
 CPU loops waiting for I/O ready
 simple, reliable
 slow if many quiescent devices
 wastes CPU time
 not good for time-critical systems

Interrupts:
  CPU initiates I/O action
  CPU does other stuff
  I/O interface signals ready by interrupting CPU
  needs hardware support



             Operating System       Infosys-Campus
             Connect            M.LAVANYA M.C.A
             Dept
Interrupt Actions (Bacon, figs 3.4, 3.5)
                                                             Interrupt
                        Program                               Service
                                                              Routine




          Memory
                     ISR

Program     Vector                                     CPU
            Table
                                              PC
                                             PSR

                     Operating System       Infosys-Campus
                     Connect            M.LAVANYA M.C.A
                     Dept
Interrupt Priorities
    Some events:
         routine
         urgent
                  should interrupt routine events
         critical
                  should interrupt urgent and routine events




Operating System         Infosys-Campus Connect   M.LAVANYA M.C.A Dept
Priorities in action
                                                Medium
                                                Priority
                 Low Priority                                        High
Program             ISR
                                                 ISR
                                                                    Priority
                                                                     ISR


                                            Issues:
                  High Priority               • how should we hold PC/PSR/etc?
                      ISR                     • low priority interrupts during
                                                high priority ISR’s
Program
                             Low Priority
                                ISR

          Operating System          Infosys-Campus
          Connect               M.LAVANYA M.C.A
          Dept
Assigning Interrupt Priorities
High Priorities
  What type of devices?


Lower Priorities
  What type of devices?




              Operating System       Infosys-Campus
              Connect            M.LAVANYA M.C.A
              Dept
File System Management
MS-DOS File System
File –Organization in MS-DOS
Data Access in MS-DOSn
Volume Structure of the Disk in MS-DOS
MS-DOS Booting Process
UNIX File System




             Operating System       Infosys-Campus
             Connect            M.LAVANYA M.C.A
             Dept
The UNIX Filesystem
· The UNIX filesystem and directory structure.
· File and directory handling commands.
· How to make symbolic and hard links.
· How wildcard filename expansion works.
· What argument quoting is and when it should be
 used.




              Operating System       Infosys-Campus
              Connect            M.LAVANYA M.C.A
              Dept
The UNIX Filesystem
UNIX filesystem belongs to one of four types:
  Ordinary files
  Directories
  Devices
  Links




              Operating System       Infosys-Campus
              Connect            M.LAVANYA M.C.A
              Dept
Typical UNIX Directory Structure




        Operating System       Infosys-Campus
        Connect            M.LAVANYA M.C.A
        Dept
Specifying multiple filenames
'?' matches any single character in that position in the
 filename.
'*' matches zero or more characters in the filename
('[' and ']') will match any filename that has one of
 those characters in that position.
A list of comma separated strings enclosed in curly
 braces ("{" and "}") will be expanded as a Cartesian
 product with the surrounding characters.


               Operating System       Infosys-Campus
               Connect            M.LAVANYA M.C.A
               Dept
Quotes
Try insert a '' in front of the special character.
Use double quotes (") around arguments to prevent
 most expansions.
Use single forward quotes (') around arguments to
 prevent all expansions.




               Operating System       Infosys-Campus
               Connect            M.LAVANYA M.C.A
               Dept
Directory and File Handling Commands
    $ pwd
     /usr/bin
  implies that /usr/bin is the current working directory.

    ls (list directory)
  $ ls
      bin dev home mnt share usr var
      boot etc lib proc sbin tmp vol
   $ ls –a
  $ ls -a -l
        (or, equivalently,) Connect
    Operating System Infosys-Campus M.LAVANYA M.C.A Dept
File Premissions




Operating System       Infosys-Campus
Connect            M.LAVANYA M.C.A
Dept
Basic Commands in UNIX
$ man ls
$ info ls
$ cd path
$ cd
$ cd –
$ mkdir directory
$ rmdir directory
$ cp source-file(s) destination
$ cp -rd source-directories destination-directory
               Operating System       Infosys-Campus
               Connect            M.LAVANYA M.C.A
               Dept
Basic Commands in UNIX
$ mv source destination
$ rm target-file(s)
$ rm -rf / home/will
$ cat target-file(s)
$ more target-file(s)




               Operating System       Infosys-Campus
               Connect            M.LAVANYA M.C.A
               Dept
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 one interrupt is generated per block, rather than
 the one interrupt per byte.



              Operating System       Infosys-Campus
              Connect            M.LAVANYA M.C.A
              Dept
Storage Structure
 Main memory – only large storage media that the
  CPU can access directly(RAM)-DRAM:LOAD &SORE.
 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.
                Operating System       Infosys-Campus
                Connect            M.LAVANYA M.C.A
                Dept
PARTS OF MAGNETIC DISK
SPINDLE
TRACK
SECTOR
CYLINDER
PLATTER
ARM




            Operating System       Infosys-Campus
            Connect            M.LAVANYA M.C.A
            Dept
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.



                Operating System       Infosys-Campus
                Connect            M.LAVANYA M.C.A
                Dept
Operating System              Infosys-Campus
 Connect                  M.LAVANYA M.C.A
                   Dept
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
   Cache management important design problem
   Cache size and replacement policy
                 Operating System       Infosys-Campus
                 Connect            M.LAVANYA M.C.A
                 Dept
Performance of Various Levels of Storage

 Movement between levels of storage hierarchy can be
   explicit or implicit




                 Operating System       Infosys-Campus
                 Connect            M.LAVANYA M.C.A
                 Dept
Subject of Comparison   NTFS                             FAT16                         FAT32
Operating system        A computer running               File access is available to   File access is available only
compatibility           Windows Vista, Windows           computers running             to computers running
                        Server 2003, Windows 2000,       Microsoft® MS-DOS®, all       Microsoft® Windows 95
                        or Windows XP can access         versions of Windows,          OSR2, Windows 98,
                        files on an NTFS partition. A    Windows NT, Windows XP,       Windows Me,
                        computer running                 Windows Vista, and OS/2.      Windows 2000,
                        Windows NT 4.0 with                                            Windows XP, and
                        Service Pack 4 or later can                                    Windows Vista.
                        access files on the partition,
                        but some NTFS features,
                        such as Disk Quotas, are not
                        available. Other operating
                        systems allow no access.

Volume size             Recommended minimum              Volumes up to 4 GB.           Volumes from 512 MB to
                        volume size is                   Cannot be used on floppy      2 terabytes.
                        approximately 10 MB.             disks.                        In Windows Vista, you can
                        Recommended practical                                          format a FAT32 volume only
                        maximum for volumes is                                         up to 32 GB.
                        2 terabytes. Much larger                                       Cannot be used on floppy
                        sizes are possible.                                            disks.
                        Cannot be used on floppy
                        disks.
File size               Maximum file size                Maximum file size 4 GB        Maximum file size 4 GB
                        16 terabytes minus 64 KB
                        (244 minus 64 KB)
Files per volume        4,294,967,295 (232 minus 1 65,536 (216 files)
                            Operating System         Infosys-Campus                    Approximately 4,177,920
                        files)
                            Connect              M.LAVANYA M.C.A
                           Dept
FAT                    FAT32 (vFAT)                   NTFS

Systems               DOS, Windows9x, all NTs        Windows98, NT5           NT4, NT5

Maximal volume size 2 GBytes                         near by unlimited        near by unlimited

Maximal files count   around 65000                   near by unlimited        near by unlimited
                                                    Long names (up to 255 Long names (up to 255
                      Long names (up to 255
File name                                           chars), system character chars), unicode character
                      chars), system character set.
                                                    set.                     set.
File attributes       Basic set                      Basic set                All that programmers want
                                                                              yes (capability of physical
Security              No                             no                       encryption, starting from
                                                                              NT5.0)
Compression           no                             no                       yes
Fault tolerance       middle                         low                      fully (automatic)
                                                     improved (small
Economy               minimal                                                 maximal
                                                     clusters)
                                                     as for FAT, but also
                                                                              very effective for all
Performance           high for small files count     additional penalty for
                                                                              volumes
                               Operating System      big volumes
                                                       Infosys-Campus
                               Connect             M.LAVANYA M.C.A
                               Dept

More Related Content

What's hot

Operating system notes ch1
Operating system notes ch1Operating system notes ch1
Operating system notes ch1Emmanuel Damka
 
Basics of Operating System
Basics of Operating SystemBasics of Operating System
Basics of Operating SystemSoumit Ghosh
 
Operating system notes
Operating system notesOperating system notes
Operating system notesSANTOSH RATH
 
Operating System Concepts Presentation
Operating System Concepts PresentationOperating System Concepts Presentation
Operating System Concepts PresentationNitish Jadia
 
Operating system Concepts
Operating system Concepts Operating system Concepts
Operating system Concepts RANVIJAY GAUR
 
COMPUTER HARDWARE - SHORT NOTES
COMPUTER HARDWARE - SHORT NOTESCOMPUTER HARDWARE - SHORT NOTES
COMPUTER HARDWARE - SHORT NOTESsuthi
 
Operating system
Operating systemOperating system
Operating systemmak120
 
Operating system concepts (notes)
Operating system concepts (notes)Operating system concepts (notes)
Operating system concepts (notes)Sohaib Danish
 
System Z operating system
System Z operating systemSystem Z operating system
System Z operating systemArpana shree
 
Operating system concepts
Operating system conceptsOperating system concepts
Operating system conceptsStarlee Lathong
 
Concepts of o s chapter 1
Concepts of o s  chapter 1Concepts of o s  chapter 1
Concepts of o s chapter 1cathline44
 
OS Functions and Services
OS Functions and ServicesOS Functions and Services
OS Functions and Servicessgpraju
 
Operating System BCA 301
Operating System BCA 301Operating System BCA 301
Operating System BCA 301cpjcollege
 
Silberschatz / OS Concepts
Silberschatz /  OS Concepts Silberschatz /  OS Concepts
Silberschatz / OS Concepts Alanisca Alanis
 
Ch1kiit [compatibility mode]
Ch1kiit [compatibility mode]Ch1kiit [compatibility mode]
Ch1kiit [compatibility mode]Amit Gupta
 

What's hot (19)

Operating system notes ch1
Operating system notes ch1Operating system notes ch1
Operating system notes ch1
 
Basics of Operating System
Basics of Operating SystemBasics of Operating System
Basics of Operating System
 
Operating System
Operating SystemOperating System
Operating System
 
Operating system notes
Operating system notesOperating system notes
Operating system notes
 
Operating System Concepts Presentation
Operating System Concepts PresentationOperating System Concepts Presentation
Operating System Concepts Presentation
 
Operating system Concepts
Operating system Concepts Operating system Concepts
Operating system Concepts
 
COMPUTER HARDWARE - SHORT NOTES
COMPUTER HARDWARE - SHORT NOTESCOMPUTER HARDWARE - SHORT NOTES
COMPUTER HARDWARE - SHORT NOTES
 
Operating system notes pdf
Operating system notes pdfOperating system notes pdf
Operating system notes pdf
 
Operating system
Operating systemOperating system
Operating system
 
Operating system concepts (notes)
Operating system concepts (notes)Operating system concepts (notes)
Operating system concepts (notes)
 
System Z operating system
System Z operating systemSystem Z operating system
System Z operating system
 
Operating system concepts
Operating system conceptsOperating system concepts
Operating system concepts
 
Concepts of o s chapter 1
Concepts of o s  chapter 1Concepts of o s  chapter 1
Concepts of o s chapter 1
 
Unit 1 introduction to operating system
Unit 1 introduction to operating systemUnit 1 introduction to operating system
Unit 1 introduction to operating system
 
OS Functions and Services
OS Functions and ServicesOS Functions and Services
OS Functions and Services
 
Operating System BCA 301
Operating System BCA 301Operating System BCA 301
Operating System BCA 301
 
Operating System
Operating SystemOperating System
Operating System
 
Silberschatz / OS Concepts
Silberschatz /  OS Concepts Silberschatz /  OS Concepts
Silberschatz / OS Concepts
 
Ch1kiit [compatibility mode]
Ch1kiit [compatibility mode]Ch1kiit [compatibility mode]
Ch1kiit [compatibility mode]
 

Viewers also liked

Tie up between jet & etihad airways
Tie up between jet & etihad airwaysTie up between jet & etihad airways
Tie up between jet & etihad airwaysMohit Banka
 
Strategic Planning for Successful International Expansion
Strategic Planning for Successful International ExpansionStrategic Planning for Successful International Expansion
Strategic Planning for Successful International ExpansionWalter Adamson
 
Narayana murthy presentation
Narayana murthy presentationNarayana murthy presentation
Narayana murthy presentationMVIT
 
Logistics and supply chain of IOC & ONGC
Logistics and supply chain of IOC & ONGCLogistics and supply chain of IOC & ONGC
Logistics and supply chain of IOC & ONGCTony Sebastian
 
Flipkart - Strategic Business Management
Flipkart - Strategic Business ManagementFlipkart - Strategic Business Management
Flipkart - Strategic Business ManagementChandresh Dedhia
 
Final infosys ppt...
Final infosys ppt...Final infosys ppt...
Final infosys ppt...nitinpandey5
 
PPT on Narayan Murthy
PPT on Narayan MurthyPPT on Narayan Murthy
PPT on Narayan MurthyGeeta Naidu
 
Tata consultancy services final
Tata consultancy services finalTata consultancy services final
Tata consultancy services finalWasim Akram
 
Airline Industry
Airline IndustryAirline Industry
Airline Industryautomotive
 
Capital structure Analysis of Indian Oil Corporation Limited (IOCL)
Capital structure Analysis of Indian Oil Corporation Limited (IOCL)Capital structure Analysis of Indian Oil Corporation Limited (IOCL)
Capital structure Analysis of Indian Oil Corporation Limited (IOCL)Kangkan Deka
 
Infosys ppt.
Infosys ppt.Infosys ppt.
Infosys ppt.Roshni17
 
Airline Industry Marketing Ppt
Airline Industry Marketing PptAirline Industry Marketing Ppt
Airline Industry Marketing PptAMANPREETJOHAL
 

Viewers also liked (15)

Shubham kumar
Shubham kumarShubham kumar
Shubham kumar
 
Tie up between jet & etihad airways
Tie up between jet & etihad airwaysTie up between jet & etihad airways
Tie up between jet & etihad airways
 
Top 10 Global Expansion Best Practices
Top 10 Global Expansion Best PracticesTop 10 Global Expansion Best Practices
Top 10 Global Expansion Best Practices
 
LIC presentation... 001
LIC presentation... 001LIC presentation... 001
LIC presentation... 001
 
Strategic Planning for Successful International Expansion
Strategic Planning for Successful International ExpansionStrategic Planning for Successful International Expansion
Strategic Planning for Successful International Expansion
 
Narayana murthy presentation
Narayana murthy presentationNarayana murthy presentation
Narayana murthy presentation
 
Logistics and supply chain of IOC & ONGC
Logistics and supply chain of IOC & ONGCLogistics and supply chain of IOC & ONGC
Logistics and supply chain of IOC & ONGC
 
Flipkart - Strategic Business Management
Flipkart - Strategic Business ManagementFlipkart - Strategic Business Management
Flipkart - Strategic Business Management
 
Final infosys ppt...
Final infosys ppt...Final infosys ppt...
Final infosys ppt...
 
PPT on Narayan Murthy
PPT on Narayan MurthyPPT on Narayan Murthy
PPT on Narayan Murthy
 
Tata consultancy services final
Tata consultancy services finalTata consultancy services final
Tata consultancy services final
 
Airline Industry
Airline IndustryAirline Industry
Airline Industry
 
Capital structure Analysis of Indian Oil Corporation Limited (IOCL)
Capital structure Analysis of Indian Oil Corporation Limited (IOCL)Capital structure Analysis of Indian Oil Corporation Limited (IOCL)
Capital structure Analysis of Indian Oil Corporation Limited (IOCL)
 
Infosys ppt.
Infosys ppt.Infosys ppt.
Infosys ppt.
 
Airline Industry Marketing Ppt
Airline Industry Marketing PptAirline Industry Marketing Ppt
Airline Industry Marketing Ppt
 

Similar to Presentation1 cc

Similar to Presentation1 cc (20)

Ch3 OS
Ch3 OSCh3 OS
Ch3 OS
 
OSCh3
OSCh3OSCh3
OSCh3
 
OS_Ch3
OS_Ch3OS_Ch3
OS_Ch3
 
Ch3
Ch3Ch3
Ch3
 
chapter 3 opreating system lecture note and its is impaortamt concept for mn
chapter 3 opreating system  lecture note and its is impaortamt concept for mnchapter 3 opreating system  lecture note and its is impaortamt concept for mn
chapter 3 opreating system lecture note and its is impaortamt concept for mn
 
Basic os-concepts
Basic os-conceptsBasic os-concepts
Basic os-concepts
 
Types of os
Types of osTypes of os
Types of os
 
OS UNIT 1 PPT.pptx
OS UNIT 1 PPT.pptxOS UNIT 1 PPT.pptx
OS UNIT 1 PPT.pptx
 
operating system structure
operating system structureoperating system structure
operating system structure
 
Operating-System Structures
Operating-System StructuresOperating-System Structures
Operating-System Structures
 
ITM(2).ppt
ITM(2).pptITM(2).ppt
ITM(2).ppt
 
Unit 1-Operating Systems Overview .pptx
Unit 1-Operating Systems Overview .pptxUnit 1-Operating Systems Overview .pptx
Unit 1-Operating Systems Overview .pptx
 
Introduction to OS 1.ppt
Introduction to OS 1.pptIntroduction to OS 1.ppt
Introduction to OS 1.ppt
 
Operating system
Operating systemOperating system
Operating system
 
Operating system
Operating systemOperating system
Operating system
 
ch3 - operating system structures.ppt
ch3 - operating system structures.pptch3 - operating system structures.ppt
ch3 - operating system structures.ppt
 
Operating system v1 d1
Operating system v1 d1Operating system v1 d1
Operating system v1 d1
 
Operating system (BCS303) MODULE 1 NOTES
Operating system (BCS303) MODULE 1 NOTESOperating system (BCS303) MODULE 1 NOTES
Operating system (BCS303) MODULE 1 NOTES
 
Basic os-concepts
Basic os-conceptsBasic os-concepts
Basic os-concepts
 
OS UNIT1.pptx
OS UNIT1.pptxOS UNIT1.pptx
OS UNIT1.pptx
 

Presentation1 cc

  • 1. OPERATING SYSTEMS Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 2. Objectives To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 3. What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer hardware. Operating system goals: Use the computer hardware in an efficient manner. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 4. Computer System Structure Computer system can be divided into four components Hardware Operating system Application programs Users Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 5. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 6. Operating System Definition OS is a resource allocator OS is a control program Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 7. Computer Startup bootstrap program is loaded at power-up or reboot Typically stored in ROM or EPROM, generally known as firmware Initializates all aspects of system Loads operating system kernel and starts execution Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 8. Computer System Organization Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 9. Migration of Integer A from Disk to Register Multitasking environments must be careful to use most recent value, no matter where it is stored in the storage hierarchy Multiprocessor environment must provide cache coherency in hardware such that all CPUs have the most recent value in their cache Distributed environment situation even more complex  Several copies of a datum can exist  Various solutions covered in Chapter 17 Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 10. 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 < 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 don’t fit in memory, swapping moves them in and out to run  Virtual memory allows execution of processes not completely in memory Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 11. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 12. 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 Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 13. 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 Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 14. 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 Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 15. 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 Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 16. 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 Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 17. Memory Management Single Contiguous Memory Allocation Fixed Partition Memory Allocation Variable Partition Memory Allocation Relocatable Partition Memory Allocation Simple Paged Allocation Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 18. 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 Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 19. 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 Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 20. 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 Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 21. Client-Server Computing Dumb terminals supplanted by smart PCs Many systems now servers, responding to requests generated by clients  Compute-server provides an interface to client to request services (i.e. database)  File-server provides interface for clients to store and retrieve files Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 22. Peer-to-Peer Computing Another model of distributed system P2P does not distinguish clients and servers Instead all nodes are considered peers May each act as client, server or both Node must join P2P network  Registers its service with central lookup service on network, or  Broadcast request for service and respond to requests for service via discovery protocol Examples include Napster and Gnutella Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 23. Several jobs are kept in main memory at the same time, and the CPU is multiplexed among them. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 24. 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. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 25. 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 Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 26. Time-Sharing Systems–Interactive 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 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 user’s keyboard. On-line system must be available for users to access data and code. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 27. Real-Time Systems Often used as a control device in a dedicated application such as 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. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 28. 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. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 29. Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server Systems Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 30. Process Concept An operating system executes a variety of programs:  Batch system – jobs  Time-shared systems – user programs or tasks Process – a program in execution; process execution must progress in sequential fashion. A process includes:  program counter  stack  data section Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 31. Process State As a process executes, it changes state  new: The process is being created.  running: Instructions are being executed.  waiting: The process is waiting for some event to occur.  ready: The process is waiting to be assigned to a process.  terminated: The process has finished execution. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 32. Process Creation Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 33. Process Termination Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 34. Process Termination Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 35. Processes Not-running ready to execute Blocked waiting for I/O Dispatcher cannot just select the process that has been in the queue the longest because it may be blocked Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 36. A Five-State Model Running Ready Blocked New Exit Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 37. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 38. Suspended Processes Processor is faster than I/O so all processes could be waiting for I/O Swap these processes to disk to free up more memory Blocked state becomes suspend state when swapped to disk Two new states Blocked/Suspend ReadySuspend Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 39. One Suspend State Case study -Two Suspend State Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 40. Two Suspend States Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 41. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 42. Process Control Block (PCB) Information associated with each process. Process state Program counter CPU registers CPU scheduling information Memory-management information Accounting information I/O status information Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 43. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 44. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 45. Process Scheduling Queues Job queue – set of all processes in the system. Ready queue – set of all processes residing in main memory, ready and waiting to execute. Device queues – set of processes waiting for an I/O device. Process migration between the various queues. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 46. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 47. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 48. Implementation Questions How are links established? Can a link be associated with more than two processes? How many links can there be between every pair of communicating processes? What is the capacity of a link? Is the size of a message that the link can accommodate fixed or variable? Is a link unidirectional or bi-directional? Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 49. Direct Communication Processes must name each other explicitly: send (P, message) – send a message to process P receive(Q, message) – receive a message from process Q Properties of communication link Links are established automatically. A link is associated with exactly one pair of communicating processes. Between each pair there exists exactly one link. The link may be unidirectional, but is usually bi- directional. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 50. Indirect Communication Messages are directed and received from mailboxes (also referred to as ports).  Each mailbox has a unique id.  Processes can communicate only if they share a mailbox. Properties of communication link  Link established only if processes share a common mailbox  A link may be associated with many processes.  Each pair of processes may share several communication links.  Link may be unidirectional or bi-directional. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 51. Indirect Communication Operations create a new mailbox send and receive messages through mailbox destroy a mailbox Primitives are defined as: send(A, message) – send a message to mailbox A receive(A, message) – receive a message from mailbox A Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 52. Indirect Communication Mailbox sharing P1, P2, and P3 share mailbox A. P1, sends; P2 and P3 receive. Who gets the message? Solutions Allow a link to be associated with at most two processes. Allow only one process at a time to execute a receive operation. Allow the system to select arbitrarily the receiver. Sender is notified who the receiver was. Dept Operating System Infosys-Campus Connect M.LAVANYA M.C.A
  • 53. CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 54. Basic Concepts Maximum CPU utilization obtained with multiprogramming CPU–I/O Burst Cycle – Process execution consists of a cycle of CPU execution and I/O wait. CPU burst distribution Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 55. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 56. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 57. CPU Scheduler Selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them. CPU scheduling decisions may take place when a process: 1. Switches from running to waiting state. 2. Switches from running to ready state. 3. Switches from waiting to ready. 4.Terminates. Scheduling under 1 and 4 is nonpreemptive. All other scheduling is preemptive. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 58. Dispatcher Dispatcher module gives control of the CPU to the process selected by the short-term scheduler; this involves: switching context switching to user mode jumping to the proper location in the user program to restart that program Dispatch latency – time it takes for the dispatcher to stop one process and start another running. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 59. Scheduling Criteria CPU utilization – keep the CPU as busy as possible Throughput – # of processes that complete their execution per time unit Turnaround time – amount of time to execute a particular process Waiting time – amount of time a process has been waiting in the ready queue Response time – amount of time it takes from when a request was submitted until the first response is produced, not output (for time- sharing environment) Optimization Criteria Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 60. Optimization Criteria Max CPU utilization Max throughput Min turnaround time Min waiting time Min response time Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 61. First-Come , First-Served (FCFS) Scheduling Process Burst Time P1 24 P2 3 P3 3 Suppose that the processes arrive in the order: P1 , P2 , P3 The Gantt Chart for the schedule is: P1 P2 P3 0 24 27 30 Waiting time for P1 = 0; P2 = 24; P3 = 27 Average waiting time: (0 + 24 + 27)/3 = 17 Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 62. FCFS Scheduling (Cont.) Suppose that the processes arrive in the order P2 , P3 , P1 . The Gantt chart for the schedule is: P2 P3 P1 0 3 6 30 Waiting time for P1 = 6; P2 = 0; P3 = 3 Average waiting time: (6 + 0 + 3)/3 = 3 Much better than previous case. Convoy effect short process behind long process Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 63. Shortest-Job-First (SJR) Scheduling Associate with each process the length of its next CPU burst. Use these lengths to schedule the process with the shortest time. Two schemes:  nonpreemptive – once CPU given to the process it cannot be preempted until completes its CPU burst.  preemptive – if a new process arrives with CPU burst length less than remaining time of current executing process, preempt. This scheme is know as the Shortest-Remaining-Time-First (SRTF). SJF is optimal – gives minimum average waiting time for a given set of processes. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 64. Example of Non-Preemptive SJF Process Arrival Time Burst Time P1 0.0 7 P2 2.0 4 P3 4.0 1 P4 5.0 4 SJF (non-preemptive) P1 P3 P2 P4 0 3 7 8 12 16 Average waiting time = (0 + 6 + 3 + 7)/4 - 4 Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 65. Example of Preemptive SJF Process Arrival Time Burst Time P1 0.0 7 P2 2.0 4 P3 4.0 1 P4 5.0 4 SJF (preemptive) P1 P2 P3 P2 P4 P1 0 2 4 5 7 11 16 Average waiting time = (9 + 1 + 0 +2)/4 - 3 Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 66. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 67.
  • 68. Determining Length of Next CPU Burst Can only estimate the length. Can be done by using the length of previous CPU bursts, using exponential averaging. 1. tn = actual lenght of nthCPU burst 2. τ n +1 = predicted value for the next CPU burst 3. α , 0 ≤ α ≤ 1 4. Define : τ n=1 = α tn + (1 − α )τ n . Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 69. Priority Scheduling A priority number (integer) is associated with each process The CPU is allocated to the process with the highest priority (smallest integer ≡ highest priority).  Preemptive  nonpreemptive SJF is a priority scheduling where priority is the predicted next CPU burst time. Problem ≡ Starvation – low priority processes may never execute. Solution ≡ Aging – as time progresses increase the priority of the process. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 70. Round Robin (RR) Each process gets a small unit of CPU time (time quantum), usually 10-100 milliseconds. After this time has elapsed, the process is preempted and added to the end of the ready queue. If there are n processes in the ready queue and the time quantum is q, then each process gets 1/n of the CPU time in chunks of at most q time units at once. No process waits more than (n-1)q time units. Performance  q large ⇒ FIFO  q small ⇒ q must be large with respect to context switch, otherwise overhead is too high. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 71. Example of RR with Time Quantum = 20 Process Burst Time P1 53 P2 17 P3 68 P4 24  The Gantt chart is: P1 P2 P3 P4 P1 P3 P4 P1 P3 P3 0 20 37 57 77 97 117 121 134 154 162  Typically, higher average turnaround than SJF, but better response. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 72. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 73. Traditional UNIX Scheduling Multilevel feedback using round robin within each of the priority queues If a running process does not block or complete within 1 second, it is preempted Priorities are recomputed once per second Base priority divides all processes into fixed bands of priority levels Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 74. Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 75. Objectives To provide a detailed description of various ways of organizing memory hardware To discuss various memory-management techniques, including paging and segmentation To provide a detailed description of the Intel Pentium, which supports both pure segmentation and segmentation with paging Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 76. Background Program must be brought (from disk) into memory and placed within a process for it to be run Main memory and registers are only storage CPU can access directly Register access in one CPU clock (or less) Main memory can take many cycles Cache sits between main memory and CPU registers Protection of memory required to ensure correct operation Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 77. Base and Limit Registers A pair of base and limit registers define the logical address space Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 78. Binding of Instructions and Data to Memory Address binding of instructions and data to memory addresses can happen at three different stages  Compile time: If memory location known a priori, absolute code can be generated; must recompile code if starting location changes  Load time: Must generate relocatable code if memory location is not known at compile time  Execution time: Binding delayed until run time if the process can be moved during its execution from one memory segment to another. Need hardware support for address maps (e.g., base and limit registers) Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 79. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 80. Logical vs. Physical Address Space The concept of a logical address space that is bound to a separate physical address space is central to proper memory management  Logical address – generated by the CPU; also referred to as virtual address  Physical address – address seen by the memory unit Logical and physical addresses are the same in compile-time and load-time address-binding schemes; logical (virtual) and physical addresses differ in execution-time address-binding scheme Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 81. Memory-Management Unit (MMU) Hardware device that maps virtual to physical address In MMU scheme, the value in the relocation register is added to every address generated by a user process at the time it is sent to memory The user program deals with logical addresses; it never sees the real physical addresses Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 82. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 83. Dynamic Loading Routine is not loaded until it is called Better memory-space utilization; unused routine is never loaded Useful when large amounts of code are needed to handle infrequently occurring cases No special support from the operating system is required implemented through program design Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 84. Dynamic Linking Linking postponed until execution time Small piece of code, stub, used to locate the appropriate memory-resident library routine Stub replaces itself with the address of the routine, and executes the routine Operating system needed to check if routine is in processes’ memory address Dynamic linking is particularly useful for libraries System also known as shared libraries Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 85. Swapping  A process can be swapped temporarily out of memory to a backing store, and then brought back into memory for continued execution  Backing store – fast disk large enough to accommodate copies of all memory images for all users; must provide direct access to these memory images  Roll out, roll in – swapping variant used for priority-based scheduling algorithms; lower-priority process is swapped out so higher-priority process can be loaded and executed  Major part of swap time is transfer time; total transfer time is directly proportional to the amount of memory swapped  Modified versions of swapping are found on many systems (i.e., UNIX, Linux, and Windows)  System maintains a ready queue of ready-to-run processes which have memory images on disk Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 86. Schematic View of Swapping Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 87. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 88. Contiguous Allocation (Cont.)  Multiple-partition allocation  Hole – block of available memory; holes of various size are scattered throughout memory  When a process arrives, it is allocated memory from a hole large enough to accommodate it  Operating system maintains information about: a) allocated partitions b) free partitions (hole) OS OS OS OS process 5 process 5 process 5 process 5 process 9 process 9 process 8 process 10 process 2 process 2 process 2 process 2 Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 89. Dynamic Storage-Allocation Problem How to satisfy a request of size n from a list of free holes First-fit: Allocate the first hole that is big enough Best-fit: Allocate the smallest hole that is big enough; must search entire list, unless ordered by size  Produces the smallest leftover hole Worst-fit: Allocate the largest hole; must also search entire list  Produces the largest leftover hole First-fit and best-fit better than worst-fit in terms of speed and storage utilization Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 90. Paging  Logical address space of a process can be noncontiguous; process is allocated physical memory whenever the latter is available  Divide physical memory into fixed-sized blocks called frames (size is power of 2, between 512 bytes and 8,192 bytes)  Divide logical memory into blocks of same size called pages  Keep track of all free frames  To run a program of size n pages, need to find n free frames and load program  Set up a page table to translate logical to physical addresses  Internal fragmentation Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 91. Address Translation Scheme  Address generated by CPU is divided into:  Page number (p) – used as an index into a page table which contains base address of each page in physical memory  Page offset (d) – combined with base address to define the physical memory address that is sent to the memory unit page number page offset p d m-n n  For given logical address space 2m and page size 2n Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 92. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 93. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 94. 32-byte memory and 4-byte pages Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 95. Before allocation After allocation Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 96. Implementation of Page Table  Page table is kept in main memory  Page-table base register (PTBR) points to the page table  Page-table length register (PRLR) indicates size of the page table  In this scheme every data/instruction access requires two memory accesses. One for the page table and one for the data/instruction.  The two memory access problem can be solved by the use of a special fast-lookup hardware cache called associative memory or translation look-aside buffers (TLBs)  Some TLBs store address-space identifiers (ASIDs) in each TLB entry – uniquely identifies each process to provide address-space protection for that process Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 97. Associative Memory Associative memory – parallel search Page # Frame # Address translation (p, d) If p is in associative register, get frame # out Otherwise get frame # from page table in memory Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 98. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 99. Effective Access Time Associative Lookup = ε time unit Assume memory cycle time is 1 microsecond Hit ratio – percentage of times that a page number is found in the associative registers; ratio related to number of associative registers Hit ratio = α Effective Access Time (EAT) EAT = (1 + ε) α + (2 + ε)(1 – α) =2+ε–α CASE STUDY-UNIX and Solaris Memory Management Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 100. UNIX and Solaris Memory Management Page Replacement Refinement of the clock policy Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 101. Memory Protection Memory protection implemented by associating protection bit with each frame Valid-invalid bit attached to each entry in the page table: “valid” indicates that the associated page is in the process’ logical address space, and is thus a legal page “invalid” indicates that the page is not in the process’ logical address space Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 102. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 103. Shared Pages Shared code One copy of read-only (reentrant) code shared among processes (i.e., text editors, compilers, window systems). Shared code must appear in same location in the logical address space of all processes Private code and data Each process keeps a separate copy of the code and data The pages for the private code and data can appear anywhere in the logical address space Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 104. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 105. Segmentation scheme that supports user Memory-management view of memory A program is a collection of segments. A segment is a logical unit such as: main program, procedure, function, method, object, local variables, global variables, common block, stack, symbol table, arrays Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 106. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 107. 1 4 1 2 3 2 4 3 user space physical memory space Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 108. Segmentation Architecture Logical address consists of a two tuple: <segment-number, offset>, Segment table – maps two-dimensional physical addresses; each table entry has:  base – contains the starting physical address where the segments reside in memory  limit – specifies the length of the segment Segment-table base register (STBR) points to the segment table’s location in memory Segment-table length register (STLR) indicates number of segments used by a program; segment number s is legal if s < STLR Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 109. Segmentation Architecture (Cont.) Protection With each entry in segment table associate:  validation bit = 0 ⇒ illegal segment  read/write/execute privileges Protection bits associated with segments; code sharing occurs at segment level Since segments vary in length, memory allocation is a dynamic storage-allocation problem A segmentation example is shown in the following diagram Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 110. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 111. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 112. Example: The Intel Pentium Supports both segmentation and segmentation with paging CPU generates logical address Given to segmentation unit  Which produces linear addresses Linear address given to paging unit  Which generates physical address in main memory  Paging units form equivalent of MMU Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 113. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 114. Background Virtual memory – separation of user logical memory from physical memory. Only part of the program needs to be in memory for execution. Logical address space can therefore be much larger than physical address space. Allows address spaces to be shared by several processes. Allows for more efficient process creation. Virtual memory can be implemented via: Demand paging Operating System Infosys-Campus Demand segmentation Connect Dept M.LAVANYA M.C.A
  • 115. ⇒ Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 116. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 117. Background Virtual memory – separation of user logical memory from physical memory. Only part of the program needs to be in memory for execution. Logical address space can therefore be much larger than physical address space. Allows address spaces to be shared by several processes. Allows for more efficient process creation. Virtual memory can be implemented via: Demand paging Operating System Infosys-Campus Demand segmentation Connect Dept M.LAVANYA M.C.A
  • 118. ⇒ Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 119. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 120. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 121. Demand Paging Bring a page into memory only when it is needed Less I/O needed Less memory needed Faster response More users Page is needed ⇒ reference to it invalid reference ⇒ abort not-in-memory ⇒ bring to memory Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 122. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 123. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 124. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 125. Performance of Demand Paging Page Fault Rate 0 ≤ p ≤ 1.0 if p = 0 no page faults if p = 1, every reference is a fault Effective Access Time (EAT) EAT = (1 – p) x memory access + p (page fault overhead + [swap page out ] + swap page in Connect + restart overhead) Operating System Infosys-Campus M.LAVANYA M.C.A Dept
  • 126. Copy-on-Write Copy-on-Write (COW) allows both parent and child processes to initially share the same pages in memory If either process modifies a shared page, only then is the page copied COW allows more efficient process creation as only modified pages are copied Free pages are allocated from a pool of zeroed-out Operating System Infosys-Campus pages Connect Dept M.LAVANYA M.C.A
  • 127. Page Replacement Prevent over-allocation of memory by modifying page-fault service routine to include page replacement Use modify (dirty) bit to reduce overhead of page transfers – only modified pages are written to disk Page replacement completes separation between logical memory and physical memory – large virtual memory can be provided on a smaller physical memory Operating System Connect Infosys-Campus M.LAVANYA M.C.A Dept
  • 128. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 129. Basic Page Replacement 1. Find the location of the desired page on disk 2. Find a free frame: - If there is a free frame, use it - If there is no free frame, use a page replacement algorithm to select a victim frame 3. Read the desired page into the (newly) free frame. Update the page and frame tables. 4. Restart the process Operating System Connect Infosys-Campus M.LAVANYA M.C.A Dept
  • 130. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 131. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 132. NTFS(New Technology File System Features of NTFS Security and access control Size of the files/The number of Files Recovery/Reliability Long file names Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 133. NTFS(New Technology File System Overview of the partition structure Limitations of NTFS Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 134. Device Management I/O Channels I/O devices and the CPU can execute concurrently. Each device controller is 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. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 135. Common Functions of Interrupts Interrupt transfers control to the interrupt service routine generally, through the interrupt vector . Incoming interrupts are 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. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 136. 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 Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 137. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 138. I/O Structure 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. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 139. Synchronous Asynchronous Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 140. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 141. Device Management User Program e.g. printf(“hello”) language I/O interface Run-time Library System Call interface: … write stream of chars Identify device, I/O Manager check permissions Operating System Device Driver Hardware interface: …write character Interface Hardware … put bits on screen … write disk block Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 142. Device Speeds Device Transfer Rate CPU Instructions per (bytes per second)byte transferred (*) Keyboard 10 10 million 56K modem 6.8 K ~15 thousand Ethernet 1M+ 100 (Cable modem? (~63K) (~1500) ADSL?) Disk Drive 10 M ~10 (CD ROM?) (few M) (tens) Screen 10s M ~2 (Printer?) (*) assume 100 MIPS. CPU speed: instructions/second (cf with clock speed: MHz) E.g.: Pentium 1GHz: up to 3000 MIPS, but, ... Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 143. I/O Hardware Variety of devices (WO, RO, RW) Communicate with the machine via a connection point: port (e.g., serial port) Devices within a computer are connected via a bus. Controller: electronics that can operate a port, a bus, or a device. SCSI bus controller - host adapter circuit board: processes SCSI protocol messages Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 144. An Input/Output interface Input Buffer Memory Output Buffer Control input ready CPU Status output ready Bus Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 145. Synchronising CPU and I/O Polling: CPU loops waiting for I/O ready simple, reliable slow if many quiescent devices wastes CPU time not good for time-critical systems Interrupts: CPU initiates I/O action CPU does other stuff I/O interface signals ready by interrupting CPU needs hardware support Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 146. Interrupt Actions (Bacon, figs 3.4, 3.5) Interrupt Program Service Routine Memory ISR Program Vector CPU Table PC PSR Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 147. Interrupt Priorities Some events: routine urgent  should interrupt routine events critical  should interrupt urgent and routine events Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 148. Priorities in action Medium Priority Low Priority High Program ISR ISR Priority ISR Issues: High Priority • how should we hold PC/PSR/etc? ISR • low priority interrupts during high priority ISR’s Program Low Priority ISR Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 149. Assigning Interrupt Priorities High Priorities What type of devices? Lower Priorities What type of devices? Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 150. File System Management MS-DOS File System File –Organization in MS-DOS Data Access in MS-DOSn Volume Structure of the Disk in MS-DOS MS-DOS Booting Process UNIX File System Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 151. The UNIX Filesystem · The UNIX filesystem and directory structure. · File and directory handling commands. · How to make symbolic and hard links. · How wildcard filename expansion works. · What argument quoting is and when it should be used. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 152. The UNIX Filesystem UNIX filesystem belongs to one of four types: Ordinary files Directories Devices Links Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 153. Typical UNIX Directory Structure Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 154. Specifying multiple filenames '?' matches any single character in that position in the filename. '*' matches zero or more characters in the filename ('[' and ']') will match any filename that has one of those characters in that position. A list of comma separated strings enclosed in curly braces ("{" and "}") will be expanded as a Cartesian product with the surrounding characters. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 155. Quotes Try insert a '' in front of the special character. Use double quotes (") around arguments to prevent most expansions. Use single forward quotes (') around arguments to prevent all expansions. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 156. Directory and File Handling Commands  $ pwd /usr/bin implies that /usr/bin is the current working directory. ls (list directory) $ ls bin dev home mnt share usr var boot etc lib proc sbin tmp vol  $ ls –a $ ls -a -l (or, equivalently,) Connect Operating System Infosys-Campus M.LAVANYA M.C.A Dept
  • 157. File Premissions Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 158. Basic Commands in UNIX $ man ls $ info ls $ cd path $ cd $ cd – $ mkdir directory $ rmdir directory $ cp source-file(s) destination $ cp -rd source-directories destination-directory Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 159. Basic Commands in UNIX $ mv source destination $ rm target-file(s) $ rm -rf / home/will $ cat target-file(s) $ more target-file(s) Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 160. 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 one interrupt is generated per block, rather than the one interrupt per byte. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 161. Storage Structure Main memory – only large storage media that the CPU can access directly(RAM)-DRAM:LOAD &SORE. 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. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 162. PARTS OF MAGNETIC DISK SPINDLE TRACK SECTOR CYLINDER PLATTER ARM Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 163. 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. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 164. Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 165. 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  Cache management important design problem  Cache size and replacement policy Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 166. Performance of Various Levels of Storage Movement between levels of storage hierarchy can be explicit or implicit Operating System Infosys-Campus Connect M.LAVANYA M.C.A Dept
  • 167. Subject of Comparison NTFS FAT16 FAT32 Operating system A computer running File access is available to File access is available only compatibility Windows Vista, Windows computers running to computers running Server 2003, Windows 2000, Microsoft® MS-DOS®, all Microsoft® Windows 95 or Windows XP can access versions of Windows, OSR2, Windows 98, files on an NTFS partition. A Windows NT, Windows XP, Windows Me, computer running Windows Vista, and OS/2. Windows 2000, Windows NT 4.0 with Windows XP, and Service Pack 4 or later can Windows Vista. access files on the partition, but some NTFS features, such as Disk Quotas, are not available. Other operating systems allow no access. Volume size Recommended minimum Volumes up to 4 GB. Volumes from 512 MB to volume size is Cannot be used on floppy 2 terabytes. approximately 10 MB. disks. In Windows Vista, you can Recommended practical format a FAT32 volume only maximum for volumes is up to 32 GB. 2 terabytes. Much larger Cannot be used on floppy sizes are possible. disks. Cannot be used on floppy disks. File size Maximum file size Maximum file size 4 GB Maximum file size 4 GB 16 terabytes minus 64 KB (244 minus 64 KB) Files per volume 4,294,967,295 (232 minus 1 65,536 (216 files) Operating System Infosys-Campus Approximately 4,177,920 files) Connect M.LAVANYA M.C.A Dept
  • 168. FAT FAT32 (vFAT) NTFS Systems DOS, Windows9x, all NTs Windows98, NT5 NT4, NT5 Maximal volume size 2 GBytes near by unlimited near by unlimited Maximal files count around 65000 near by unlimited near by unlimited Long names (up to 255 Long names (up to 255 Long names (up to 255 File name chars), system character chars), unicode character chars), system character set. set. set. File attributes Basic set Basic set All that programmers want yes (capability of physical Security No no encryption, starting from NT5.0) Compression no no yes Fault tolerance middle low fully (automatic) improved (small Economy minimal maximal clusters) as for FAT, but also very effective for all Performance high for small files count additional penalty for volumes Operating System big volumes Infosys-Campus Connect M.LAVANYA M.C.A Dept