+ All Categories
Home > Documents > RT linux

RT linux

Date post: 25-May-2015
Category:
Upload: saritha-reddy
View: 2,360 times
Download: 0 times
Share this document with a friend
Description:
Useful for PG students
Popular Tags:
34
OVERVIEW OF RTLINUX OVERVIEW OF RTLINUX & & FEATURES FEATURES Dr. C. Dr. C. SARITHA SARITHA Lecturer in Electronics Lecturer in Electronics SSBN Degree & PG College SSBN Degree & PG College Anantapur Anantapur
Transcript
Page 1: RT linux

OVERVIEW OF RTLINUX OVERVIEW OF RTLINUX &&

FEATURESFEATURES

Dr. C. Dr. C. SARITHASARITHA

Lecturer in ElectronicsLecturer in Electronics

SSBN Degree & PG CollegeSSBN Degree & PG College

AnantapurAnantapur

Page 2: RT linux

OVERVIEWOVERVIEW

• What is operating system?What is operating system?

• Real time operating systemReal time operating system

• Overview of Unix/LinuxOverview of Unix/Linux

• Features of LinuxFeatures of Linux

• RTLinuxRTLinux

Page 3: RT linux

What is an operating system?What is an operating system?• An operating system is a set of An operating system is a set of

programs that manage computer programs that manage computer hardware resources and provide hardware resources and provide common services for application common services for application software.software.

• The operating system is the most The operating system is the most important type of system software in a important type of system software in a computer system.computer system.

• A user cannot run an application A user cannot run an application program on the computer without an program on the computer without an operating system.operating system.

Page 4: RT linux

Types of Operating SystemsTypes of Operating Systems

Different types of operating systems Different types of operating systems areare

• Real timeReal time

• Multi userMulti user

• Multi-tasking vs -Single-taskingMulti-tasking vs -Single-tasking

• DistributedDistributed

• EmbeddedEmbedded

Page 5: RT linux

Real-time Operating SystemReal-time Operating System

• A Real-time operating system is a A Real-time operating system is a multitasking operating system intended multitasking operating system intended for applications with fixed deadlines.for applications with fixed deadlines.

• Applications include some small Applications include some small embedded systems, automobiles engine embedded systems, automobiles engine controllers, industrial robots, spacecraft, controllers, industrial robots, spacecraft, industrial control, and some large-scale industrial control, and some large-scale computing devices.computing devices.

Page 6: RT linux

Most widely deployed Real-time Most widely deployed Real-time operating system are operating system are

• LinuxLinux

• OSEOSE

• QNXQNX

• RTLinuxRTLinux

• VxWorksVxWorks

• Windows CEWindows CE

Page 7: RT linux

Categories Of Real-time SystemsCategories Of Real-time Systems

There are two flavors of real-time There are two flavors of real-time systems.systems.

• Hard Real-time SystemHard Real-time System

• Soft Real-time system. Soft Real-time system.

Page 8: RT linux

• Hard real-time system is hardware or Hard real-time system is hardware or software that must operate within the software that must operate within the confines of a stringent deadline.confines of a stringent deadline.

• The application may be considered to The application may be considered to have failed if it does not completes its have failed if it does not completes its function within the allotted time span.function within the allotted time span.

• Hard real time systems include aircraft Hard real time systems include aircraft control systems.control systems.

• In soft real-time systems, meeting the In soft real-time systems, meeting the deadline is important but missing the deadline is important but missing the deadline will not lead to a catastrophe. deadline will not lead to a catastrophe.

Page 9: RT linux

Overview of Unix/LinuxOverview of Unix/Linux• Unix stands for UNiplexed Information Unix stands for UNiplexed Information

and Computing  and Computing  • Unix was developed by Ken Thomson Unix was developed by Ken Thomson

and Dennis Ritchie beginning 1969.It and Dennis Ritchie beginning 1969.It became the popular operating system in became the popular operating system in the academic community during 1970’s.the academic community during 1970’s.

• It was commercialized in and since It was commercialized in and since then ,its use in both academic and then ,its use in both academic and commercial world has grown commercial world has grown tremendously.tremendously.

Page 10: RT linux

• Unix operating systems are widely Unix operating systems are widely used in servers, workstation, used in servers, workstation, and mobile devices. and mobile devices.

• Unix was designed to Unix was designed to be portable, multi-tasking and multi-be portable, multi-tasking and multi-user in a time-sharing configuration.user in a time-sharing configuration.

• Unix operating systems are not open Unix operating systems are not open source operrting systems.source operrting systems.

Page 11: RT linux

The main attractions of Unix are:The main attractions of Unix are:• Most of the operating system was Most of the operating system was

developed in a high level languages. developed in a high level languages. This was revolutionary during those This was revolutionary during those days because before advent of days because before advent of UNIX ,operating system were UNIX ,operating system were developed in assembly languages.developed in assembly languages.

• The main attraction of Unix is that The main attraction of Unix is that provide a large number of utilities for provide a large number of utilities for software debuggers, source code software debuggers, source code control systems.control systems.

Page 12: RT linux

Unix has some popular myths:Unix has some popular myths:

• It is a complicated operating system.It is a complicated operating system.

• Too many options for each Too many options for each command.command.

• Too many commands and utilities.Too many commands and utilities.

• Unix was not free and open source it Unix was not free and open source it is commercial operating system.is commercial operating system.

Page 13: RT linux

• In April 1991, Linus Torvards, a 21-In April 1991, Linus Torvards, a 21-year-old student at the University of year-old student at the University of Helsinki, Finland started working on Helsinki, Finland started working on some simple ideas for an operating some simple ideas for an operating system. system.

• Linux is a Unix-like computer operating Linux is a Unix-like computer operating system assembled under the model of system assembled under the model of free and open source software free and open source software development and distribution.development and distribution.

• Linux is the kernel of the operating Linux is the kernel of the operating system.system.

Page 14: RT linux

• Linux was originally developed as a Linux was originally developed as a free operating system for Intel x86-free operating system for Intel x86-based personnel computers.based personnel computers.

• Linux since has been ported to more Linux since has been ported to more computed hardware platforms than computed hardware platforms than any other operating systems.any other operating systems.

• Linux also run on embedded Linux also run on embedded systems. Such as mobile phones, systems. Such as mobile phones, network routers, televisions.network routers, televisions.

Page 15: RT linux

Features of LinuxFeatures of Linux• Linux is a multi-user operating Linux is a multi-user operating

system. Every user is given a system. Every user is given a username or login name. username or login name.

• The heading system is organized The heading system is organized hierarchically. At the topmost level hierarchically. At the topmost level is the root directory denoted by / is the root directory denoted by / under which there will be sub-under which there will be sub-directories. Under each subdirectory directories. Under each subdirectory there can be directories or files.there can be directories or files.

Page 16: RT linux

Important directories areImportant directories are

• /bin contains commonly used /bin contains commonly used commandscommands

• /usr/bin contains less commonly used /usr/bin contains less commonly used commandscommands

• /etc contains the system /etc contains the system administration commandsadministration commands

• /dev contains device files/dev contains device files

• /usr /spool/mail contains mail files./usr /spool/mail contains mail files.

Page 17: RT linux

A variety of user interfaces are A variety of user interfaces are available.available.

• The command user interfaces are shell, The command user interfaces are shell, k-shell, and C shell. X-windows provide k-shell, and C shell. X-windows provide the graphical user interface.the graphical user interface.

• To provide security for user’s files, a To provide security for user’s files, a user will have a password.user will have a password.

• Every file is given protections read, Every file is given protections read, write and execute permissions are write and execute permissions are given to the owner, group and others.given to the owner, group and others.

Page 18: RT linux

KERNELKERNEL::

• Kernel manages the tasks to achieve Kernel manages the tasks to achieve the desired performance of the the desired performance of the system . system .

• To manage the tasks, the important To manage the tasks, the important requirements are to schedule the requirements are to schedule the tasks and to provide inter-task tasks and to provide inter-task communication facilitiescommunication facilities

• to achieve these two requirements, to achieve these two requirements, kernel objects are defined such as kernel objects are defined such as

Page 19: RT linux

• TasksTasks• MutexesMutexes• ISR’sISR’s• EventsEvents• Message boxesMessage boxes• MailboxesMailboxes• Pipes and timersPipes and timers• Kernel provide the memory Kernel provide the memory

management service, time management service, time management services, interrupt management services, interrupt handling services and device handling services and device management services.management services.

Page 20: RT linux

hardware

Users processors

Users processors

Users processors

Users processors

LINUX KERNELLINUX KERNEL

System libraries

Device drivers Unix/Linux kernel

Page 21: RT linux

RTLINUXRTLINUX• RTLinux is a hard real-time RTOS RTLinux is a hard real-time RTOS

microkernel that runs the entire microkernel that runs the entire Linux operating system as a fully Linux operating system as a fully preemptive process.preemptive process.

• It was developed by Victor Yodaiken, It was developed by Victor Yodaiken, Michael Barabanov and others at the Michael Barabanov and others at the New Mexico Institute of Mining and New Mexico Institute of Mining and Technology and then as a Technology and then as a commercial product at FSMLabs.commercial product at FSMLabs.

• FSMLabs has two editions of RTLinux. FSMLabs has two editions of RTLinux.

Page 22: RT linux

• RTLinux pro and RTLinux free. RTLinux pro and RTLinux free. RTLinux pro is the priced edition and RTLinux pro is the priced edition and RTLinux is the open source release.RTLinux is the open source release.

• RTLinux support hard real time RTLinux support hard real time applications, the Linux kernel has applications, the Linux kernel has been modified by adding a layer of been modified by adding a layer of software between the hardware and software between the hardware and the Linux kernel. This additional layer the Linux kernel. This additional layer is called “virtual machine”.is called “virtual machine”.

• A foot print of 4MB is required A foot print of 4MB is required RTLinux. RTLinux.

Page 23: RT linux

• The new layer, RTLinux layer has a The new layer, RTLinux layer has a separate task scheduler. This task separate task scheduler. This task scheduler assigns lowest priority to scheduler assigns lowest priority to the standard Linux kernel. Any task the standard Linux kernel. Any task that has to met real-time constraints that has to met real-time constraints will run under RTLinux.will run under RTLinux.

• Interrupts from Linux are disabled to Interrupts from Linux are disabled to achieve real-time performance.achieve real-time performance.

Page 24: RT linux

RTLINUXRTLINUX KERNELKERNELUsers

processorsUsers

processorsUsers

processorsUsers

processors

hardware

System libraries RTlinux kernel

Device drivers Unix/Linux kernel

Page 25: RT linux

DIFFERENCESS BETWEENTHE DIFFERENCESS BETWEENTHE LINUX AND RTLINUXLINUX AND RTLINUX::LinuxLinux

• Linux is not a Linux is not a hard real time hard real time system.system.

• The tasks, which The tasks, which do not have any do not have any time constraints.time constraints.

RTLinuxRTLinux

• RTLinux supports RTLinux supports hard real-time hard real-time applications.applications.

• Any task that has Any task that has real-time real-time constraints will run constraints will run under RTLinux.under RTLinux.

Page 26: RT linux

In RTLinux location of the various files In RTLinux location of the various files are:are:

• RTLinux will be installed in the RTLinux will be installed in the directory /usr/rtlinux-xxx, where xxx is directory /usr/rtlinux-xxx, where xxx is the version name.the version name.

• /usr/rtlinux/include contains all the /usr/rtlinux/include contains all the include files necessary for development include files necessary for development project.project.

• /usr/doc/rtlinux/man contains the /usr/doc/rtlinux/man contains the manual pages for the RTLinux.manual pages for the RTLinux.

• /usr/rtlinux/modules contains the core /usr/rtlinux/modules contains the core RTLinux modulesRTLinux modules

Page 27: RT linux

The two important aspects while The two important aspects while doing programming in RTLinux are:doing programming in RTLinux are:

• By default, the RTLinux tasks do not By default, the RTLinux tasks do not have access to the computer’s have access to the computer’s floating points unit. Hence need to floating points unit. Hence need to explicitly set the permissions for explicitly set the permissions for every RTLinux task.every RTLinux task.

• Cannot pass arguments from the Cannot pass arguments from the command prompt.command prompt.

Page 28: RT linux

RTLINUX MODULESRTLINUX MODULES• RTLinux programs are not created as RTLinux programs are not created as

stand-alone units, they are created as stand-alone units, they are created as modules, which are loaded into the modules, which are loaded into the Linux kernel space. Linux kernel space.

• The C source files are compiled into The C source files are compiled into objects files using the gcc command objects files using the gcc command with the argument –c flag. In the C file, with the argument –c flag. In the C file, the main() function gets replaced with the main() function gets replaced with the fallowing lines:the fallowing lines:

Page 29: RT linux

• Int init_module();Int init_module();

• Void cleanup_module();Void cleanup_module();

• Init_module is called when the Init_module is called when the module is first loaded into the kernel. module is first loaded into the kernel.

• This function returns 0 if the module This function returns 0 if the module is successfully loaded. It returns a is successfully loaded. It returns a negative value in case of failure. negative value in case of failure. When the module is loaded is to be When the module is loaded is to be unloaded , the cleanup_module() is unloaded , the cleanup_module() is called.called.

Page 30: RT linux

EXECUTING THE RTLINUX EXECUTING THE RTLINUX MODULESMODULES

• In RTLinux load and stop user modules In RTLinux load and stop user modules using the RTLinux command. Using this using the RTLinux command. Using this command we can obtain status command we can obtain status information about RTLinux modules. information about RTLinux modules.

• The command syntax is:The command syntax is:

• $rtlinux start my_program$rtlinux start my_program

• $rtlinux stop my_program$rtlinux stop my_program

• $rtlinux status my_program$rtlinux status my_program

Page 31: RT linux

CREATING RTLINUX POSIX CREATING RTLINUX POSIX THREADSTHREADS

• A real-time program generally consists A real-time program generally consists of a number of threads.of a number of threads.

• Each thread share a common address Each thread share a common address space .space .

• Pthread_create() function is used to Pthread_create() function is used to create a new real-time thread.create a new real-time thread.

The corresponding header file is The corresponding header file is

#include <pthread.h>#include <pthread.h>

Page 32: RT linux

• To achieve real-time performance. To achieve real-time performance. The various POSIX compliant API The various POSIX compliant API function calls are used. These function calls are used. These function calls are related to create function calls are related to create and cancel semaphores.and cancel semaphores.

• To implement mutex, we have to To implement mutex, we have to include the header file include the header file <rtl_mutex.h> in the C program.<rtl_mutex.h> in the C program.

• To cancel a thread, the system call is To cancel a thread, the system call is pthread_cancel.pthread_cancel.

Page 33: RT linux

TIMER MANAGEMENTTIMER MANAGEMENT

• A number of internal clocks are A number of internal clocks are available in RTLinux to manage the available in RTLinux to manage the timers. timers.

• To obtain the current clock reading To obtain the current clock reading using command is:using command is:

clock-set time() functionclock-set time() function

clock_id gives the identification of clock_id gives the identification of the clock to be read.the clock to be read.

Page 34: RT linux

Recommended