Unformatted text preview:

An Introduction to Real Time Operating Systems and Schedulability Analysis Marco Di Natale Scuola Superiore S Anna Outline Background on Operating Systems An Introduction to RT Systems Model based development of Embedded RT systems the RTOS in the platform based design Scheduling and Resource Management Schedulability Analysis and Priority Inversion The Mars Pathfinder case Implementation issues and standards OSEK Credits Paolo Gai Evidence S r l slides on EDF and OSEK Giuseppe Lipari Scuola Superiore S Anna slides on OS Manas Saksena TimeSys examples on blocking time comput From Mathworks Simulink and RTW manuals slides on RT blocks Background on Operating Systems Fundamentals Algorithm It is the logical procedure to solve a certain problem It is informally specified a a sequence of elementary steps that an execution machine must follow to solve the problem It is not necessarily expressed in a formal programming language Program It is the implementation of an algorithm in a programming language Can be executed several times with different inputs Process An instance of a program that given a sequence of inputs produces a set of outputs Operating System An operating system is a program that Provides an abstraction of the physical machine Provides a simple interface to the machine Each part of the interface is a service An OS is also a resource manager The OS provides access to the physical resources of a computing machine The OS provides abstract resources for example a file a virtual page in memory etc Levels of abstraction User Level Programmer Level Kim Lisa Web Browser Shell System Level Bill Videogame Printer Daemon Interface System API Operating System Virtual Memory Device Driver Device Driver Scheduler Device Driver Device Driver Virtual File Sys Device Driver Device Driver HW Level Main Board CPU Keyboard Network Card Printer Video Card Printer Hard disk Abstraction mechanisms Why abstraction Programming the HW directly has several drawbacks It is difficult and error prone It is not portable Suppose you want to write a program that reads a text file from disk and outputs it on the screen Without a proper interface it is virtually impossible Abstraction Mechanisms Application programming interface API Provides a convenient and uniform way to access to one service so that HW details are hidden to the high level programmer One application does not depend on the HW The programmer can concentrate on higher level tasks Example For reading a file linux and many other unix OS provide the open read system calls that given a file name allow to load the data from an external support the need for concurrency there are many reason for concurrency functional performance expressive power functional many users may be connected to the same system at the same time each user can have its own processes that execute concurrently with the processes of the other users perform many operations concurrently for example listen to music write with a word processor burn a CD etc they are all different and independent activities they can be done at the same time the need for concurrency 2 performance take advantage of blocking time while some thread waits for a blocking condition another thread performs another operation parallelism in multi processor machines if we have a multi processor machine independent activities can be carried out on different processors are the same time expressive power many control application are inherently concurrent concurrency support helps in expressing concurrency making application development simpler theoretical model a system is a set of concurrent activities they can be processes or threads they interact in two ways they access the hardware resources processor disk memory etc they exchange data these activities compete for the resources and or cooperate for some common objective Process The fundamental concept in any operating system is the process A process is an executing program An OS can execute many processes at the same time concurrency Example running a Text Editor and a Web Browser at the same time in the PC Processes have separate memory spaces Each process is assigned a private memory space One process is not allowed to read or write in the memory space of another process If a process tries to access a memory location not in its space an exception is raised Segmentation fault and the process is terminated Two processes cannot directly share variables Memory layout of a Process Other data Heap Stack BSS Initialized Data Text Dynamically allocated Dynamically allocated memory memory variable size variable size Stack Stack variable size variable size Global variables Global variables non initialized non initialized Global variables Global variables initialized initialized Contains the process code Contains the process code machine code machine code Memory Protection By default two processes cannot share their memory If one process tries to access a memory location outside its space a processor exception is raised trap and the process is terminated The Segmentation Fault error Any reference to this Any reference to this memory results in a memory results in a segmentation fault segmentation fault Other data Heap Stack BSS Initialized Data Text Processes We can distinguish two aspects in a process Resource Ownership A process includes a virtual address space a process image code data It is allocated a set of resources like file descriptors I O channels etc Scheduling Execution The execution of a process follows an ececution path and generates a trace sequence of internal states It has a state ready Running etc And scheduling parameters priority time left in the round etc Multi threading Many OS separate these aspects by providing the concept of thread The process is the resource owner The thread is the scheduling entity One process can consists of one or more threads Threads are sometime called improperly lightweight processes Therefore on process can have many different and concurrent traces of execution Multi threaded process model In the multi threaded process model each process can have many threads One address space One PCB Many stacks Many TCB Thread Control blocks The threads are scheduled directly by the global scheduler Process control block Process address space Process Process Thread Thread Thread Thread Thread Thread Thread control block Thread control block Thread control block User stack User stack User stack Kernel stack Kernel stack Kernel


View Full Document

Berkeley ELENG C249A - An Introduction to Real-Time Operating Systems

Documents in this Course
Load more
Loading Unlocking...
Login

Join to view An Introduction to Real-Time Operating Systems and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view An Introduction to Real-Time Operating Systems and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?