UNIT 7.
STUDY OF COMMERCIAL RTOS
OVERVIEW
 Real time operating system
 Overview of Linux
 Linux Kernel
 Architecure of RTLinux
 RTLinux Modules
 Semaphor & Mutex Management
 Other RTOS
    REAL-TIME OPERATING SYSTEM
   A Real-time operating system is a multitasking
    operating system intended for applications with fixed
    deadlines.
   Applications include-
      some small embedded systems,
     automobiles engine controllers,
     industrial robots,
     spacecraft,
     industrial control
     and some large-scale computing devices.
    LINUX
   In April 1991, Linus Torvards, a 21-year-old student
    at the University of Helsinki, Finland started working
    on some simple ideas for an operating system.
   Linux is a Unix-like computer operating system
    assembled under the model of free and open source
    software development and distribution.
   Linux was originally developed as a free operating
    system for Intel x86-based personnel computers.
   Linux since has been ported to more computed
    hardware platforms than any other operating systems.
   Linux also run on embedded systems. Such as
       mobile phones, network routers, televisions.
 KERNEL:
 Kernel manages the tasks to achieve the desired
  performance of the system .
 To manage the tasks, the important requirements are
  to schedule the tasks and to provide inter-task
  communication facilities
 to achieve these two requirements, kernel objects are
  defined such as
       Tasks
       Mutexes
       ISR’s
       Events
       Message boxes
       Mailboxes
       Pipes and timers
   Kernel provide the memory management service,
    time management services, interrupt handling
    services and device management services.
LINUX KERNEL
ARCHITECTURE OF RTLINUX
 RTLinux is a hard RTOS microkernel that runs the
  entire Linux operating system as a fully preemptive
  process.
 It was developed by Victor Yodaiken, Michael
  Barabanov and others at the New Mexico Institute of
  Mining and Technology and then as a commercial
  product at FSMLabs.
   FSMLabs has two editions of RTLinux.
       RTLinux pro and RTLinux free.
   RTLinux pro is the priced edition and RTLinux is the
    open source release.
 RTLinux support hard real time applications,
 Linux kernel has been modified by adding a layer of
  software between the hardware and the Linux kernel.
   The new layer, RTLinux layer has a separate task
    scheduler. This task scheduler assigns lowest
    priority to the standard Linux kernel.
 Any task that has to met real-time constraints will run
  under RTLinux.
 Interrupts from Linux are disabled to achieve real-
  time performance.
ARCHITECTURE OF RTLINUX KERNEL
    DIFFERENCES BETWEEN THE LINUX AND RTLINUX:
 Linux                         RTLinux
 Linux is not a hard real      RTLinux supports hard
  time system.                   real-time applications.
 The tasks, which do not       Any task that has    real-
  have       any     time        time constraints will run
  constraints.                   under RTLinux.
 In RTLinux location of the various files are:
 RTLinux     will be installed in the directory
  /usr/rtlinux-xxx, where xxx is the version name.
   /usr/rtlinux/include contains all the include files
    necessary for development project.
   /usr/doc/rtlinux/man contains the manual pages for
    the RTLinux.
   /usr/rtlinux/modules contains the core RTLinux
    modules
RTLINUX MODULES
   RTLinux programs are not created as stand-alone units,
    they are created as modules, which are loaded into the
    Linux kernel space.
   The C source files are compiled into objects files using the
    gcc command with the argument –c flag.
   In the C file, the main() function gets replaced with the
    following lines:
     Int init_module();
     Void cleanup_module();
   Init_module is called when the module is first loaded into
    the kernel.
     This function returns 0 if the module is successfully loaded.
     It returns a negative value in case of failure.
   cleanup_module() is called When the module is loaded is
    to be unloaded.
EXECUTING THE RTLINUX MODULES
   In RTLinux load and stop user modules using the
    RTLinux commands.
   Using command, we can also obtain status information
    about RTLinux modules.
 The command syntax is:
 $rtlinux start my_program
 $rtlinux stop my_program
 $rtlinux status my_program
CREATING RTLINUX POSIX THREADS
   A real-time program generally consists of a number of
    threads.
   Each thread share a common address space .
   Pthread_create() function is used to create a new real-
    time thread.
   The corresponding header file is
     #include <pthread.h>
SEMAPHOR AND MUTEX MANAGEMENT IN RTLINUX
   To achieve real-time performance, various POSIX
    compliant API function calls are used.
   These function calls are related to create and cancel
    semaphores.
   To implement mutex, we have to include the header file
    <rtl_mutex.h> in the C program.
   To cancel a thread, the system call is pthread_cancel.
OTHER REAL TIME OPERATING SYSTEMS
   RTLinux – Monolithic kernel with loadable modules
   QNX – Microkernel approach
   VxWorks – Monolithic kernel
   LynxOS – Microkernel
   ARTS, Spring, KURT, RTAI, etc….