SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Downloaden Sie, um offline zu lesen
Basics of Operating Systems

                 Prof. Anish Goel
What are operating systems?
       Operating systems are software environments that
        provide a buffer between the user and the low level
        interfaces to the hardware within a system.
       They provide a constant interface and a set of utilities to
        enable users to utilise the system quickly and efficiently.
       They allow software to be moved from one system to
        another and therefore can make application programs
        hardware independent.
       Many applications do not require any operating system
        support at all and run direct on the hardware.


    2                    Operating Systems   Anish Goel
Hardware independence through the use of
an operating system




3            Operating Systems   Anish Goel
Non OS systems
       Such software includes its own I/O routines, for example,
        to drive serial and parallel ports.
       With the addition of mass storage and the complexities
        of disk access and file structures, most applications
        immediately delegate these tasks to an operating system.
       The delegation decreases software development time by
        providing system calls to enable application software
        access to any of the I/O system facilities.
       These calls are typically made by building a parameter
        block, loading a specified register with its location and
        then executing a software interrupt instruction

    4                    Operating Systems   Anish Goel
Typical system call mechanism for the
M680x0 processor family




5             Operating Systems   Anish Goel
Typical system call mechanism for the
M680x0 processor family…
       The TRAP instruction is the MC68000 family equivalent
        of the software interrupt and switches the processor into
        supervisor mode to execute the required function.
       It effectively provides a communication path between the
        application and the operating system kernel.
       The kernel is the heart of the operating system which
        controls the hardware and deals with interrupts, memory
        usage, I/O systems etc.
       It locates a parameter block by using an address pointer
        stored in a predetermined address register
       It takes the commands stored in a parameter block and
        executes them.

    6                    Operating Systems   Anish Goel
Operating system internals
       The first widely used operating system was CP/M,
        developed for the Intel 8080 microprocessor and 8"
        floppy disk systems.
       It supported I/O calls by two jump tables — BDOS (basic
        disk operating system) and BIOS (basic I/O system)
       CP/M is a good example of a single tasking operating
        system.
       Only one task or application can be executed at any one
        time and therefore it only supports one user at a time.
       When an application is loaded, it provides the user-
        defined part of the total ‘CP/M’ program.

    7                   Operating Systems   Anish Goel
Program overlays




8           Operating Systems   Anish Goel
Program overlays
       Any application program has to be complete and
        therefore the available memory often becomes the
        limiting factor
       Program overlays are often used to solve this problem.
       Parts of the complete program are stored separately on
        disk and retrieved and loaded over an unused code area
        when needed
       This allows applications larger than the available memory
        to run, but it places the control responsibility on the
        application.


    9                    Operating Systems   Anish Goel
What is OS ?




10             Operating Systems   Anish Goel
Basic structure of OS




11            Operating Systems   Anish Goel
RTOS Concepts
    What Does Real-Time Mean?

     Main difference to other computation: time
     time means that correctness of system depends
    - not only on logical results
    - but also on the time the results are produced
     real => reaction to external events must occur
                   during their evolution.
    system time ( internal time ) has to be measured
      with same time scale as controlled environment
      ( external time )

    12                Operating Systems   Anish Goel
Foreground/Background.

    Systems which do not use an RTOS
    An application consist of an infinite loop which calls
     application modules to perform the desired operations.
    The modules are executed sequentially with interrupt
     service routines (ISRs) handling asynchronous events .

    Batch process
     A process which executes without user interaction.
    Interactive process
     A process which requires user interaction while
     executing

    13                Operating Systems   Anish Goel
Kernel
l Kernel: the smallest portion of the operating system that
  provides
l task scheduling, dispatching, and intertask communication.
l Kernel types
  n Nanokernel - the dispatcher


  n   Microkernel - a nanokernel with task scheduling
  n   Kernel - a microkernel with intertask synchronization
  n   Executive - a kernel that includes privatized memory blocks,
      I/O services, and other complex issues. Most commercial real-
      time kernels are in this category.

  n   Operating system - an executive that also provides generalized
      user interface, security, file management system, etc

 14                    Operating Systems   Anish Goel
What is RTOS?

    A real-time operating system (RTOS) that supports
     real-time applications and embedded systems.
    Real-time applications have the requirement to meet
     task deadlines in addition to the logical correctness of
     the results.

     – Multiple events handled by a single processor
     – Events may occur simultaneously
     – Processor must handle multiple, often
     competing events

    15                Operating Systems   Anish Goel
Desirable Features of Real-Time Systems
    Timeliness
        - OS has to provide kernel mechanisms for
        - time management
        - handling tasks with explicit time constraints

        Deterministic
        Design for peak load
        Predictability
        Fault tolerance
        Maintainability

    16                  Operating Systems   Anish Goel
Multitasking
    Must provide mechanisms for scheduling and
     switching for several user and kernel tasks
    Maximize CPU utilization
    Allow for managing of complex and real-time
     applications




    17              Operating Systems   Anish Goel
Categories

 Hard Real Time System:
failure to meet time constraints leads to system failure

          Firm Real Time System:
low occurrence of missing a deadline can be tolerated

           Soft Real Time System:
performance is degraded by failure to meet time
 constraints

    An RTOS differs from common OS, in that the user when
     using the former has the ability to directly access the
     microprocessor and peripherals.
    Such an ability of the RTOS helps to meet deadlines.

    18               Operating Systems   Anish Goel
Real-Time Systems
RTOS is a multitasking system where multiple tasks
 run concurrently
 – system shifts from task to task
 – must remember key registers of each task
     • called its context

RTOS responsible for all activities related to a task:
 – scheduling and dispatching
 – intertask communication
 – memory system management
 – input/output system management
 – timing
 – error management
 – message management

 19                Operating Systems   Anish Goel
Basic requirements of an RTOS.
(i) Multi-threading and preemptibility
(ii) Thread priority
(iii) Thread synchronization mechanisms
(iv) Priority inheritance
(v) Predefined latencies

    Task switching latency: time to save the context of a
     currently executing task and switch to another task..
     Interrupt latency: time elapsed between the execution
     of the last instruction of the interrupted task and the first
     instruction in the interrupt handler
     Interrupt dispatch latency: This is the time to go
     from the last instruction in the interrupt handler to the
     next task scheduled to run.

    20                 Operating Systems   Anish Goel
Basic requirements of an RTOS
priority inversion
        occurs when a higher priority task must wait on a low priority
  task to release a resource




    Priority Ceiling
      Each resource has an assigned priority
      Priority of thread is the highest of all priorities of the resources
       it’s holding
    Priority Inheritance
      The thread holding a resource inherits the priority of the thread
       blocked on that resource

    21                    Operating Systems     Anish Goel
  Preemptive scheduling.
   In a preemptive kernel, when an event makes a higher priority task ready to
   run, the current task is immediately suspended and the higher priority task
   is given control of the CPU.
 Reentrancy.
 reentrant function : can be used by more than one task without fear of data
   corruption.
 non-reentrant function : cannot be shared by more than one task unless
   mutual exclusion to the function is ensured by either using a semaphore, by
   disabling interrupts during critical sections of code.
A reentrant function can be interrupted at any time and resumed at a later
   time without loss of data.
 Reentrant functions either use local variables (CPU registers or variables on
   the stack) or protect their data when global variables are used.
Compilers specifically designed for embedded software will generally provide
   reentrant run-time libraries.


    22                   Operating Systems      Anish Goel
Dynamic Memory Allocation
  RTOS uses abstract data types such as record, linked
  list, and queue
 These data types normally use RAM dynamic memory
  allocation techniques
 Data structures are created (allocated) on the fly during
  program execution and destroyed when no longer
  needed
     – Requires large RAM memory
 Heap is portion of memory used for dynamic memory
  allocation
 Must allocate separate RAM spaces for the Heap as well
  as the Stack
 Stack : Last-in-first-out (LIFO) data structure
 RTOS requires multiple stacks - one for each task


    23             Operating Systems   Anish Goel
Memory Management
    Two issues
        Heap management
        Stack management


    Heap management
        Classic heap
        Priority heap
        Fixed block heap




    24                      Operating Systems   Anish Goel
Memory Management
    Classic heap
      The memory is collected into one giant heap and partitioned
       according to the demand from tasks.
      There are several “fit” memory allocation algorithms, e.g., best-fit,
       first-fit, that also attempt to minimize the memory fragmentation.
      Has a big management overhead so is not used in real-time
       systems
    Priority heap
      partitions the memory along priority boundaries, e.g., a high and a
       low priority partitions are created

    Fixed block heap
      partitions the memory into several pools of fixed block length
        and upon a request, allocates a single block of memory from the
        pool with size equal or larger than the requested amount

    25                    Operating Systems     Anish Goel
Stack management:
    When multiple tasks share a single processor, their contexts
     (volatile information such as the contents of hardware registers,
     memory-management registers, and the program counter)
     need to be saved and restored so as to switch them.
            This can be done using
         task-control block model OR one or more run-time stacks
    Run-time stacks
         - used to keep context
      may use only one run-time stack for all the tasks or one run-time
       stack in conjunction with several application stacks (or private
       stacks), one for each task in memory
      Multiple stack case allows tasks to interrupt themselves,
      Stack size must be known a priori.
      Operating system manages the stacks



    26                   Operating Systems   Anish Goel
Task and Task Control Blocks

  In RTOS program consists of
  independent,asynchronous, and interacting tasks
        – Must have capability to store task context
 Context is kept in the control block of the task.
 Having multiple tasks means multiple control blocks, which are
  maintained in a list
• RTOS updates TCB when task is switched
 best for full-featured real-time operating systems


    Device Control Block (DCB)
         – tracks status of system associated devices

    27                Operating Systems   Anish Goel
Priorities

    Priority
      An ordinal number which represents the relative
     importance of a task.
    Static priority
     A priority which is not automatically adjusted by the
     system.
     Static priority can typically be changed by user.
    Dynamic priority
     A priority which is adjusted automatically by the system
     according to task behavior and system loading.
     Dynamic priority imposes an overhead on the system.
     Dynamic priority can improve response times and
     eliminate indefinite postponing
    28                Operating Systems   Anish Goel
Scheduling algorithms of RTOS

    The most commonly used static scheduling
     algorithm is the Rate Monotonic (RM) scheduling
     algorithm

    The RM algorithm assigns different priorities
     proportional to the frequency of tasks.
    The task with the shortest period gets the highest
     priority, and the task with the longest period gets
     the lowest static priority.

    Rate monotonic algorithm is a dynamic preemptive
     algorithm based on static priorities
    RM algorithm provides no support for dynamically
     changing task periods and/or priorities and tasks
     that may experience priority inversion.
    29               Operating Systems   Anish Goel

Weitere ähnliche Inhalte

Was ist angesagt?

Operating system lecture1
Operating system lecture1Operating system lecture1
Operating system lecture1AhalyaSri
 
Operating Systems
Operating SystemsOperating Systems
Operating Systemsvampugani
 
Bba i-introduction to computer-u-3-functions operating systems
Bba  i-introduction to computer-u-3-functions operating systemsBba  i-introduction to computer-u-3-functions operating systems
Bba i-introduction to computer-u-3-functions operating systemsRai University
 
Operating Systems 1 (12/12) - Summary
Operating Systems 1 (12/12) - SummaryOperating Systems 1 (12/12) - Summary
Operating Systems 1 (12/12) - SummaryPeter Tröger
 
Operating Systems As a Product
Operating Systems As a ProductOperating Systems As a Product
Operating Systems As a ProductHarshit Srivastava
 
Types or evolution of operating system
Types or evolution of operating systemTypes or evolution of operating system
Types or evolution of operating systemEkta Bafna
 
How Operating system works.
How Operating system works. How Operating system works.
How Operating system works. Fahad Farooq
 
MODERN OPERATING SYSTEM
MODERN OPERATING SYSTEMMODERN OPERATING SYSTEM
MODERN OPERATING SYSTEMkhanz2012
 
operating system
operating systemoperating system
operating systemKadianAman
 
Operating systems (For CBSE School Students)
Operating systems (For CBSE School Students)Operating systems (For CBSE School Students)
Operating systems (For CBSE School Students)Gaurav Aggarwal
 
Types of operating system unit 1 by Ram K Paliwal
Types of operating system  unit 1 by Ram K PaliwalTypes of operating system  unit 1 by Ram K Paliwal
Types of operating system unit 1 by Ram K PaliwalRam Paliwal
 
evolution of operating system
evolution of operating systemevolution of operating system
evolution of operating systemAmir Khan
 
Operating System- Services,types.Batch files and DOS history
Operating System- Services,types.Batch files and DOS historyOperating System- Services,types.Batch files and DOS history
Operating System- Services,types.Batch files and DOS historySURBHI SAROHA
 

Was ist angesagt? (20)

Operating system lecture1
Operating system lecture1Operating system lecture1
Operating system lecture1
 
Types Of Operating Systems
Types Of Operating SystemsTypes Of Operating Systems
Types Of Operating Systems
 
Operating Systems
Operating SystemsOperating Systems
Operating Systems
 
Bba i-introduction to computer-u-3-functions operating systems
Bba  i-introduction to computer-u-3-functions operating systemsBba  i-introduction to computer-u-3-functions operating systems
Bba i-introduction to computer-u-3-functions operating systems
 
Operating Systems 1 (12/12) - Summary
Operating Systems 1 (12/12) - SummaryOperating Systems 1 (12/12) - Summary
Operating Systems 1 (12/12) - Summary
 
Operating systems1[1]
Operating systems1[1]Operating systems1[1]
Operating systems1[1]
 
Operating Systems As a Product
Operating Systems As a ProductOperating Systems As a Product
Operating Systems As a Product
 
Chapter02 new
Chapter02 newChapter02 new
Chapter02 new
 
Types or evolution of operating system
Types or evolution of operating systemTypes or evolution of operating system
Types or evolution of operating system
 
How Operating system works.
How Operating system works. How Operating system works.
How Operating system works.
 
MODERN OPERATING SYSTEM
MODERN OPERATING SYSTEMMODERN OPERATING SYSTEM
MODERN OPERATING SYSTEM
 
operating system
operating systemoperating system
operating system
 
Operating systems (For CBSE School Students)
Operating systems (For CBSE School Students)Operating systems (For CBSE School Students)
Operating systems (For CBSE School Students)
 
OPERATING SYSTEM
OPERATING SYSTEMOPERATING SYSTEM
OPERATING SYSTEM
 
Presentation on operating system
 Presentation on operating system Presentation on operating system
Presentation on operating system
 
Types of operating system unit 1 by Ram K Paliwal
Types of operating system  unit 1 by Ram K PaliwalTypes of operating system  unit 1 by Ram K Paliwal
Types of operating system unit 1 by Ram K Paliwal
 
evolution of operating system
evolution of operating systemevolution of operating system
evolution of operating system
 
OS
OSOS
OS
 
Operating System- Services,types.Batch files and DOS history
Operating System- Services,types.Batch files and DOS historyOperating System- Services,types.Batch files and DOS history
Operating System- Services,types.Batch files and DOS history
 
operating system
operating systemoperating system
operating system
 

Andere mochten auch

Electronic mail : Introduction, drafting effective email, email etiquettes
Electronic mail : Introduction, drafting effective email, email etiquettesElectronic mail : Introduction, drafting effective email, email etiquettes
Electronic mail : Introduction, drafting effective email, email etiquettesDinesh Sharma
 
Operating systems Basics
Operating systems BasicsOperating systems Basics
Operating systems BasicsSherif Mousa
 
Operating System - Types Of Operating System Unit-1
Operating System - Types Of Operating System Unit-1Operating System - Types Of Operating System Unit-1
Operating System - Types Of Operating System Unit-1abhinav baba
 
Learning Session 2: Computer Basics, Operating Systems, File Management, an...
Learning Session 2:   Computer Basics, Operating Systems, File Management, an...Learning Session 2:   Computer Basics, Operating Systems, File Management, an...
Learning Session 2: Computer Basics, Operating Systems, File Management, an...Clint Born
 
4 various operating systems
4 various operating systems4 various operating systems
4 various operating systemsmyrajendra
 
Basics of Internet and WWW
Basics of Internet and WWWBasics of Internet and WWW
Basics of Internet and WWWSagar Rai
 
Windows 95 Powepoint Presentation
Windows 95 Powepoint PresentationWindows 95 Powepoint Presentation
Windows 95 Powepoint Presentationaedryanadovas
 
Types of operating system
Types of operating systemTypes of operating system
Types of operating systemMohammad Alam
 
Types of Operating System
Types of Operating SystemTypes of Operating System
Types of Operating SystemPriya Patra
 
INTRODUCTION TO OPERATING SYSTEM
INTRODUCTION TO OPERATING SYSTEMINTRODUCTION TO OPERATING SYSTEM
INTRODUCTION TO OPERATING SYSTEMTrinity Dwarka
 
Overview of various types of operating system
Overview of various types of operating systemOverview of various types of operating system
Overview of various types of operating systemUmme habiba
 
Computer Internet Basics I
Computer Internet Basics IComputer Internet Basics I
Computer Internet Basics Idebbie43
 
Operating Systems Basics
Operating Systems BasicsOperating Systems Basics
Operating Systems Basicsnishantsri
 
Types of Operating System
Types of Operating SystemTypes of Operating System
Types of Operating SystemHemant Raj
 
Chapter 1: Introduction to Operating System
Chapter 1: Introduction to Operating SystemChapter 1: Introduction to Operating System
Chapter 1: Introduction to Operating SystemShafaan Khaliq Bhatti
 

Andere mochten auch (20)

Windows 98
Windows 98Windows 98
Windows 98
 
Email Basics
Email BasicsEmail Basics
Email Basics
 
Electronic mail : Introduction, drafting effective email, email etiquettes
Electronic mail : Introduction, drafting effective email, email etiquettesElectronic mail : Introduction, drafting effective email, email etiquettes
Electronic mail : Introduction, drafting effective email, email etiquettes
 
Lesson 4 Types Of Operating Systems
Lesson 4 Types Of Operating SystemsLesson 4 Types Of Operating Systems
Lesson 4 Types Of Operating Systems
 
Operating systems Basics
Operating systems BasicsOperating systems Basics
Operating systems Basics
 
Operating System - Types Of Operating System Unit-1
Operating System - Types Of Operating System Unit-1Operating System - Types Of Operating System Unit-1
Operating System - Types Of Operating System Unit-1
 
Learning Session 2: Computer Basics, Operating Systems, File Management, an...
Learning Session 2:   Computer Basics, Operating Systems, File Management, an...Learning Session 2:   Computer Basics, Operating Systems, File Management, an...
Learning Session 2: Computer Basics, Operating Systems, File Management, an...
 
4 various operating systems
4 various operating systems4 various operating systems
4 various operating systems
 
Basics of Internet and WWW
Basics of Internet and WWWBasics of Internet and WWW
Basics of Internet and WWW
 
Windows 95 Powepoint Presentation
Windows 95 Powepoint PresentationWindows 95 Powepoint Presentation
Windows 95 Powepoint Presentation
 
Types of operating system
Types of operating systemTypes of operating system
Types of operating system
 
Types of Operating System
Types of Operating SystemTypes of Operating System
Types of Operating System
 
INTRODUCTION TO OPERATING SYSTEM
INTRODUCTION TO OPERATING SYSTEMINTRODUCTION TO OPERATING SYSTEM
INTRODUCTION TO OPERATING SYSTEM
 
Overview of various types of operating system
Overview of various types of operating systemOverview of various types of operating system
Overview of various types of operating system
 
Windows 98
Windows 98Windows 98
Windows 98
 
Computer Internet Basics I
Computer Internet Basics IComputer Internet Basics I
Computer Internet Basics I
 
Operating Systems Basics
Operating Systems BasicsOperating Systems Basics
Operating Systems Basics
 
Batch operating system
Batch operating system Batch operating system
Batch operating system
 
Types of Operating System
Types of Operating SystemTypes of Operating System
Types of Operating System
 
Chapter 1: Introduction to Operating System
Chapter 1: Introduction to Operating SystemChapter 1: Introduction to Operating System
Chapter 1: Introduction to Operating System
 

Ähnlich wie Operating systems

Intermediate Operating Systems
Intermediate Operating SystemsIntermediate Operating Systems
Intermediate Operating SystemsJohn Cutajar
 
OPERATING SYSTEM - SHORT NOTES
OPERATING SYSTEM - SHORT NOTESOPERATING SYSTEM - SHORT NOTES
OPERATING SYSTEM - SHORT NOTESsuthi
 
MYSQL DATABASE Operating System Part2 (1).pptx
MYSQL DATABASE Operating System Part2 (1).pptxMYSQL DATABASE Operating System Part2 (1).pptx
MYSQL DATABASE Operating System Part2 (1).pptxArjayBalberan1
 
lecture 1 (Part 2) kernal and its categories
lecture 1 (Part 2) kernal and its categorieslecture 1 (Part 2) kernal and its categories
lecture 1 (Part 2) kernal and its categoriesWajeehaBaig
 
Unit 1os processes and threads
Unit 1os processes and threadsUnit 1os processes and threads
Unit 1os processes and threadsdonny101
 
Bedtime Stories on Operating Systems.pdf
Bedtime Stories on Operating Systems.pdfBedtime Stories on Operating Systems.pdf
Bedtime Stories on Operating Systems.pdfAyushBaiswar1
 
NE223_chapter 1_Overview of operating systems.ppt
NE223_chapter 1_Overview of operating systems.pptNE223_chapter 1_Overview of operating systems.ppt
NE223_chapter 1_Overview of operating systems.pptMemMem25
 
Oslecture1
Oslecture1Oslecture1
Oslecture1kausik23
 
EMBEDDED OS
EMBEDDED OSEMBEDDED OS
EMBEDDED OSAJAL A J
 
LM1 - Computer System Overview, system calls
LM1 - Computer System Overview, system callsLM1 - Computer System Overview, system calls
LM1 - Computer System Overview, system callsmanideepakc
 
Real Time Operating Systems for Embedded Systems
Real Time Operating Systems for Embedded SystemsReal Time Operating Systems for Embedded Systems
Real Time Operating Systems for Embedded SystemsAditya Vichare
 
Nt introduction(os)
Nt introduction(os)Nt introduction(os)
Nt introduction(os)NehaTadam
 

Ähnlich wie Operating systems (20)

Intermediate Operating Systems
Intermediate Operating SystemsIntermediate Operating Systems
Intermediate Operating Systems
 
OPERATING SYSTEM - SHORT NOTES
OPERATING SYSTEM - SHORT NOTESOPERATING SYSTEM - SHORT NOTES
OPERATING SYSTEM - SHORT NOTES
 
MYSQL DATABASE Operating System Part2 (1).pptx
MYSQL DATABASE Operating System Part2 (1).pptxMYSQL DATABASE Operating System Part2 (1).pptx
MYSQL DATABASE Operating System Part2 (1).pptx
 
OS-ch01-2024.ppt
OS-ch01-2024.pptOS-ch01-2024.ppt
OS-ch01-2024.ppt
 
lecture 1 (Part 2) kernal and its categories
lecture 1 (Part 2) kernal and its categorieslecture 1 (Part 2) kernal and its categories
lecture 1 (Part 2) kernal and its categories
 
Unit 1os processes and threads
Unit 1os processes and threadsUnit 1os processes and threads
Unit 1os processes and threads
 
UNIT 2.pptx
UNIT 2.pptxUNIT 2.pptx
UNIT 2.pptx
 
Bedtime Stories on Operating Systems.pdf
Bedtime Stories on Operating Systems.pdfBedtime Stories on Operating Systems.pdf
Bedtime Stories on Operating Systems.pdf
 
NE223_chapter 1_Overview of operating systems.ppt
NE223_chapter 1_Overview of operating systems.pptNE223_chapter 1_Overview of operating systems.ppt
NE223_chapter 1_Overview of operating systems.ppt
 
Unit v
Unit vUnit v
Unit v
 
Oslecture1
Oslecture1Oslecture1
Oslecture1
 
Oslecture1
Oslecture1Oslecture1
Oslecture1
 
Cs8493 unit 1
Cs8493 unit 1Cs8493 unit 1
Cs8493 unit 1
 
Unit 1 q&a
Unit  1 q&aUnit  1 q&a
Unit 1 q&a
 
EMBEDDED OS
EMBEDDED OSEMBEDDED OS
EMBEDDED OS
 
LM1 - Computer System Overview, system calls
LM1 - Computer System Overview, system callsLM1 - Computer System Overview, system calls
LM1 - Computer System Overview, system calls
 
Unit I OS CS.ppt
Unit I OS CS.pptUnit I OS CS.ppt
Unit I OS CS.ppt
 
Operating system
Operating systemOperating system
Operating system
 
Real Time Operating Systems for Embedded Systems
Real Time Operating Systems for Embedded SystemsReal Time Operating Systems for Embedded Systems
Real Time Operating Systems for Embedded Systems
 
Nt introduction(os)
Nt introduction(os)Nt introduction(os)
Nt introduction(os)
 

Mehr von anishgoel

Computer Organization
Computer OrganizationComputer Organization
Computer Organizationanishgoel
 
Learning vhdl by examples
Learning vhdl by examplesLearning vhdl by examples
Learning vhdl by examplesanishgoel
 
Dot matrix module interface wit Raspberry Pi
Dot matrix module interface wit Raspberry PiDot matrix module interface wit Raspberry Pi
Dot matrix module interface wit Raspberry Pianishgoel
 
Input interface with Raspberry pi
Input interface with Raspberry piInput interface with Raspberry pi
Input interface with Raspberry pianishgoel
 
Learning Python for Raspberry Pi
Learning Python for Raspberry PiLearning Python for Raspberry Pi
Learning Python for Raspberry Pianishgoel
 
Raspberry Pi
Raspberry PiRaspberry Pi
Raspberry Pianishgoel
 
learning vhdl by examples
learning vhdl by exampleslearning vhdl by examples
learning vhdl by examplesanishgoel
 
Digital System Design Basics
Digital System Design BasicsDigital System Design Basics
Digital System Design Basicsanishgoel
 
digital design of communication systems
digital design of communication systemsdigital design of communication systems
digital design of communication systemsanishgoel
 
Rtos concepts
Rtos conceptsRtos concepts
Rtos conceptsanishgoel
 
8051 Microcontroller Timer
8051 Microcontroller Timer8051 Microcontroller Timer
8051 Microcontroller Timeranishgoel
 
8051 Microcontroller I/O ports
8051 Microcontroller I/O ports8051 Microcontroller I/O ports
8051 Microcontroller I/O portsanishgoel
 
Serial Communication Interfaces
Serial Communication InterfacesSerial Communication Interfaces
Serial Communication Interfacesanishgoel
 
Embedded systems ppt iv part d
Embedded systems ppt iv   part dEmbedded systems ppt iv   part d
Embedded systems ppt iv part danishgoel
 
Embedded systems ppt iv part c
Embedded systems ppt iv   part cEmbedded systems ppt iv   part c
Embedded systems ppt iv part canishgoel
 
Embedded systems ppt iv part b
Embedded systems ppt iv   part bEmbedded systems ppt iv   part b
Embedded systems ppt iv part banishgoel
 
Embedded systems ppt ii
Embedded systems ppt iiEmbedded systems ppt ii
Embedded systems ppt iianishgoel
 
Embedded systems ppt iii
Embedded systems ppt iiiEmbedded systems ppt iii
Embedded systems ppt iiianishgoel
 
Embedded systems ppt iv part a
Embedded systems ppt iv   part aEmbedded systems ppt iv   part a
Embedded systems ppt iv part aanishgoel
 
Embedded systems ppt i
Embedded systems ppt iEmbedded systems ppt i
Embedded systems ppt ianishgoel
 

Mehr von anishgoel (20)

Computer Organization
Computer OrganizationComputer Organization
Computer Organization
 
Learning vhdl by examples
Learning vhdl by examplesLearning vhdl by examples
Learning vhdl by examples
 
Dot matrix module interface wit Raspberry Pi
Dot matrix module interface wit Raspberry PiDot matrix module interface wit Raspberry Pi
Dot matrix module interface wit Raspberry Pi
 
Input interface with Raspberry pi
Input interface with Raspberry piInput interface with Raspberry pi
Input interface with Raspberry pi
 
Learning Python for Raspberry Pi
Learning Python for Raspberry PiLearning Python for Raspberry Pi
Learning Python for Raspberry Pi
 
Raspberry Pi
Raspberry PiRaspberry Pi
Raspberry Pi
 
learning vhdl by examples
learning vhdl by exampleslearning vhdl by examples
learning vhdl by examples
 
Digital System Design Basics
Digital System Design BasicsDigital System Design Basics
Digital System Design Basics
 
digital design of communication systems
digital design of communication systemsdigital design of communication systems
digital design of communication systems
 
Rtos concepts
Rtos conceptsRtos concepts
Rtos concepts
 
8051 Microcontroller Timer
8051 Microcontroller Timer8051 Microcontroller Timer
8051 Microcontroller Timer
 
8051 Microcontroller I/O ports
8051 Microcontroller I/O ports8051 Microcontroller I/O ports
8051 Microcontroller I/O ports
 
Serial Communication Interfaces
Serial Communication InterfacesSerial Communication Interfaces
Serial Communication Interfaces
 
Embedded systems ppt iv part d
Embedded systems ppt iv   part dEmbedded systems ppt iv   part d
Embedded systems ppt iv part d
 
Embedded systems ppt iv part c
Embedded systems ppt iv   part cEmbedded systems ppt iv   part c
Embedded systems ppt iv part c
 
Embedded systems ppt iv part b
Embedded systems ppt iv   part bEmbedded systems ppt iv   part b
Embedded systems ppt iv part b
 
Embedded systems ppt ii
Embedded systems ppt iiEmbedded systems ppt ii
Embedded systems ppt ii
 
Embedded systems ppt iii
Embedded systems ppt iiiEmbedded systems ppt iii
Embedded systems ppt iii
 
Embedded systems ppt iv part a
Embedded systems ppt iv   part aEmbedded systems ppt iv   part a
Embedded systems ppt iv part a
 
Embedded systems ppt i
Embedded systems ppt iEmbedded systems ppt i
Embedded systems ppt i
 

Operating systems

  • 1. Basics of Operating Systems Prof. Anish Goel
  • 2. What are operating systems?  Operating systems are software environments that provide a buffer between the user and the low level interfaces to the hardware within a system.  They provide a constant interface and a set of utilities to enable users to utilise the system quickly and efficiently.  They allow software to be moved from one system to another and therefore can make application programs hardware independent.  Many applications do not require any operating system support at all and run direct on the hardware. 2 Operating Systems Anish Goel
  • 3. Hardware independence through the use of an operating system 3 Operating Systems Anish Goel
  • 4. Non OS systems  Such software includes its own I/O routines, for example, to drive serial and parallel ports.  With the addition of mass storage and the complexities of disk access and file structures, most applications immediately delegate these tasks to an operating system.  The delegation decreases software development time by providing system calls to enable application software access to any of the I/O system facilities.  These calls are typically made by building a parameter block, loading a specified register with its location and then executing a software interrupt instruction 4 Operating Systems Anish Goel
  • 5. Typical system call mechanism for the M680x0 processor family 5 Operating Systems Anish Goel
  • 6. Typical system call mechanism for the M680x0 processor family…  The TRAP instruction is the MC68000 family equivalent of the software interrupt and switches the processor into supervisor mode to execute the required function.  It effectively provides a communication path between the application and the operating system kernel.  The kernel is the heart of the operating system which controls the hardware and deals with interrupts, memory usage, I/O systems etc.  It locates a parameter block by using an address pointer stored in a predetermined address register  It takes the commands stored in a parameter block and executes them. 6 Operating Systems Anish Goel
  • 7. Operating system internals  The first widely used operating system was CP/M, developed for the Intel 8080 microprocessor and 8" floppy disk systems.  It supported I/O calls by two jump tables — BDOS (basic disk operating system) and BIOS (basic I/O system)  CP/M is a good example of a single tasking operating system.  Only one task or application can be executed at any one time and therefore it only supports one user at a time.  When an application is loaded, it provides the user- defined part of the total ‘CP/M’ program. 7 Operating Systems Anish Goel
  • 8. Program overlays 8 Operating Systems Anish Goel
  • 9. Program overlays  Any application program has to be complete and therefore the available memory often becomes the limiting factor  Program overlays are often used to solve this problem.  Parts of the complete program are stored separately on disk and retrieved and loaded over an unused code area when needed  This allows applications larger than the available memory to run, but it places the control responsibility on the application. 9 Operating Systems Anish Goel
  • 10. What is OS ? 10 Operating Systems Anish Goel
  • 11. Basic structure of OS 11 Operating Systems Anish Goel
  • 12. RTOS Concepts  What Does Real-Time Mean?  Main difference to other computation: time  time means that correctness of system depends  - not only on logical results  - but also on the time the results are produced  real => reaction to external events must occur during their evolution.  system time ( internal time ) has to be measured with same time scale as controlled environment ( external time ) 12 Operating Systems Anish Goel
  • 13. Foreground/Background.  Systems which do not use an RTOS  An application consist of an infinite loop which calls application modules to perform the desired operations.  The modules are executed sequentially with interrupt service routines (ISRs) handling asynchronous events .  Batch process A process which executes without user interaction.  Interactive process A process which requires user interaction while executing 13 Operating Systems Anish Goel
  • 14. Kernel l Kernel: the smallest portion of the operating system that provides l task scheduling, dispatching, and intertask communication. l Kernel types n Nanokernel - the dispatcher n Microkernel - a nanokernel with task scheduling n Kernel - a microkernel with intertask synchronization n Executive - a kernel that includes privatized memory blocks, I/O services, and other complex issues. Most commercial real- time kernels are in this category. n Operating system - an executive that also provides generalized user interface, security, file management system, etc 14 Operating Systems Anish Goel
  • 15. What is RTOS?  A real-time operating system (RTOS) that supports real-time applications and embedded systems.  Real-time applications have the requirement to meet task deadlines in addition to the logical correctness of the results. – Multiple events handled by a single processor – Events may occur simultaneously – Processor must handle multiple, often competing events 15 Operating Systems Anish Goel
  • 16. Desirable Features of Real-Time Systems  Timeliness - OS has to provide kernel mechanisms for - time management - handling tasks with explicit time constraints  Deterministic  Design for peak load  Predictability  Fault tolerance  Maintainability 16 Operating Systems Anish Goel
  • 17. Multitasking  Must provide mechanisms for scheduling and switching for several user and kernel tasks  Maximize CPU utilization  Allow for managing of complex and real-time applications 17 Operating Systems Anish Goel
  • 18. Categories  Hard Real Time System: failure to meet time constraints leads to system failure  Firm Real Time System: low occurrence of missing a deadline can be tolerated  Soft Real Time System: performance is degraded by failure to meet time constraints  An RTOS differs from common OS, in that the user when using the former has the ability to directly access the microprocessor and peripherals.  Such an ability of the RTOS helps to meet deadlines. 18 Operating Systems Anish Goel
  • 19. Real-Time Systems RTOS is a multitasking system where multiple tasks run concurrently – system shifts from task to task – must remember key registers of each task • called its context RTOS responsible for all activities related to a task:  – scheduling and dispatching  – intertask communication  – memory system management  – input/output system management  – timing  – error management  – message management 19 Operating Systems Anish Goel
  • 20. Basic requirements of an RTOS. (i) Multi-threading and preemptibility (ii) Thread priority (iii) Thread synchronization mechanisms (iv) Priority inheritance (v) Predefined latencies  Task switching latency: time to save the context of a currently executing task and switch to another task..  Interrupt latency: time elapsed between the execution of the last instruction of the interrupted task and the first instruction in the interrupt handler  Interrupt dispatch latency: This is the time to go from the last instruction in the interrupt handler to the next task scheduled to run. 20 Operating Systems Anish Goel
  • 21. Basic requirements of an RTOS priority inversion occurs when a higher priority task must wait on a low priority task to release a resource  Priority Ceiling  Each resource has an assigned priority  Priority of thread is the highest of all priorities of the resources it’s holding  Priority Inheritance  The thread holding a resource inherits the priority of the thread blocked on that resource 21 Operating Systems Anish Goel
  • 22.  Preemptive scheduling. In a preemptive kernel, when an event makes a higher priority task ready to run, the current task is immediately suspended and the higher priority task is given control of the CPU.  Reentrancy. reentrant function : can be used by more than one task without fear of data corruption. non-reentrant function : cannot be shared by more than one task unless mutual exclusion to the function is ensured by either using a semaphore, by disabling interrupts during critical sections of code. A reentrant function can be interrupted at any time and resumed at a later time without loss of data. Reentrant functions either use local variables (CPU registers or variables on the stack) or protect their data when global variables are used. Compilers specifically designed for embedded software will generally provide reentrant run-time libraries. 22 Operating Systems Anish Goel
  • 23. Dynamic Memory Allocation  RTOS uses abstract data types such as record, linked list, and queue  These data types normally use RAM dynamic memory allocation techniques  Data structures are created (allocated) on the fly during program execution and destroyed when no longer needed – Requires large RAM memory  Heap is portion of memory used for dynamic memory allocation  Must allocate separate RAM spaces for the Heap as well as the Stack Stack : Last-in-first-out (LIFO) data structure  RTOS requires multiple stacks - one for each task 23 Operating Systems Anish Goel
  • 24. Memory Management  Two issues  Heap management  Stack management  Heap management  Classic heap  Priority heap  Fixed block heap 24 Operating Systems Anish Goel
  • 25. Memory Management  Classic heap  The memory is collected into one giant heap and partitioned according to the demand from tasks.  There are several “fit” memory allocation algorithms, e.g., best-fit, first-fit, that also attempt to minimize the memory fragmentation.  Has a big management overhead so is not used in real-time systems  Priority heap  partitions the memory along priority boundaries, e.g., a high and a low priority partitions are created  Fixed block heap  partitions the memory into several pools of fixed block length and upon a request, allocates a single block of memory from the pool with size equal or larger than the requested amount 25 Operating Systems Anish Goel
  • 26. Stack management:  When multiple tasks share a single processor, their contexts (volatile information such as the contents of hardware registers, memory-management registers, and the program counter) need to be saved and restored so as to switch them. This can be done using  task-control block model OR one or more run-time stacks  Run-time stacks - used to keep context  may use only one run-time stack for all the tasks or one run-time stack in conjunction with several application stacks (or private stacks), one for each task in memory  Multiple stack case allows tasks to interrupt themselves,  Stack size must be known a priori.  Operating system manages the stacks 26 Operating Systems Anish Goel
  • 27. Task and Task Control Blocks  In RTOS program consists of independent,asynchronous, and interacting tasks – Must have capability to store task context  Context is kept in the control block of the task.  Having multiple tasks means multiple control blocks, which are maintained in a list • RTOS updates TCB when task is switched  best for full-featured real-time operating systems  Device Control Block (DCB) – tracks status of system associated devices 27 Operating Systems Anish Goel
  • 28. Priorities  Priority An ordinal number which represents the relative importance of a task.  Static priority A priority which is not automatically adjusted by the system. Static priority can typically be changed by user.  Dynamic priority A priority which is adjusted automatically by the system according to task behavior and system loading. Dynamic priority imposes an overhead on the system. Dynamic priority can improve response times and eliminate indefinite postponing 28 Operating Systems Anish Goel
  • 29. Scheduling algorithms of RTOS  The most commonly used static scheduling algorithm is the Rate Monotonic (RM) scheduling algorithm  The RM algorithm assigns different priorities proportional to the frequency of tasks.  The task with the shortest period gets the highest priority, and the task with the longest period gets the lowest static priority.  Rate monotonic algorithm is a dynamic preemptive algorithm based on static priorities  RM algorithm provides no support for dynamically changing task periods and/or priorities and tasks that may experience priority inversion. 29 Operating Systems Anish Goel