EEE 243B Applied Computer Programming Timing considerations.

Slides:



Advertisements
Similar presentations
EEE 243B Applied Computer Programming Software engineering Life cycle and when to test.
Advertisements

10 Software Engineering Foundations of Computer Science ã Cengage Learning.
Slide 3: Real-Time Scheduling By: Dr. Mouaaz Nahas Embedded Systems Umm Al-Qura University Electrical Engineering Department 1.
Basic Real Time Concepts Systems Concepts Real-Time Definitions Events and Determinism CPU Utilization Real-Time System Design Issues Example Real-Time.
Chapter 3 Operating Systems. Chapter 3 Operating Systems 3.1 The Evolution of Operating Systems 3.1 The Evolution of Operating Systems 3.2 Operating System.
CS220 Software Development Lecture: Multi-threading A. O’Riordan, 2009.
Introduction to Operating Systems – Windows process and thread management In this lecture we will cover Threads and processes in Windows Thread priority.
Introduction to Operating Systems What is an operating system? Examples How do many programs run at the same time, with one processor?
Embedded and Real Time Systems Lecture #4 David Andrews
Chapter 13 Embedded Systems
Chapter 11 Operating Systems
Fall 2001CS 4471 Chapter 2: Performance CS 447 Jason Bakos.
MicroC/OS-II Embedded Systems Design and Implementation.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 3P. 1Winter Quarter Structured Engineering.
1 Chapter 13 Embedded Systems Embedded Systems Characteristics of Embedded Operating Systems.
EMBEDDED SOFTWARE Team victorious Team Victorious.
Java How to Program, 9/e CET 3640 Professor: Dr. Reyes Álamo © Copyright by Pearson Education, Inc. All Rights Reserved.
Chapter 1 Embedded And Real-Time System Department of Computer Science Hsu Hao Chen Professor Hsung-Pin Chang.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 15 Slide 1 Real-time Systems 1.
What is Concurrent Programming? Maram Bani Younes.
Parallel Processing (CS526) Spring 2012(Week 8).  Thread Status.  Synchronization in Shared Memory Programming(Java threads ) ◦ Locks ◦ Barriars.
Introduction to Embedded Systems
Operating System A program that controls the execution of application programs An interface between applications and hardware 1.
Real-Time Software Design Yonsei University 2 nd Semester, 2014 Sanghyun Park.
REAL-TIME SOFTWARE SYSTEMS DEVELOPMENT Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
Advanced Operating Systems CIS 720 Lecture 1. Instructor Dr. Gurdip Singh – 234 Nichols Hall –
Collage of Information Technology University of Palestine Advanced programming MultiThreading 1.
Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.
1 소프트웨어공학 강좌 Chap 11. Real-time software Design - Designing embedded software systems whose behaviour is subject to time constraints -
Threads in Java. History  Process is a program in execution  Has stack/heap memory  Has a program counter  Multiuser operating systems since the sixties.
EEL Software development for real-time engineering systems.
INTRODUCTION SOFTWARE HARDWARE DIFFERENCE BETWEEN THE S/W AND H/W.
Real Time Operating Systems Introduction to Real-Time Systems Course originally developed by Maj Ron Smith 17-Oct-151Dr. Alain Beaulieu.
Page 1 2P13 Week 9. Page 2 Table 9.2 Scheduling Criteria User Oriented, Performance Related Turnaround time This is the interval of time between the submission.
Multiprocessor and Real-Time Scheduling Chapter 10.
Instructore: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Concurrent and.
Chapter 101 Multiprocessor and Real- Time Scheduling Chapter 10.
CE Operating Systems Lecture 11 Windows – Object manager and process management.
Reference: Ian Sommerville, Chap 15  Systems which monitor and control their environment.  Sometimes associated with hardware devices ◦ Sensors: Collect.
Chapter 7 Software Engineering Introduction to CS 1 st Semester, 2015 Sanghyun Park.
Chapter 1 The Product. 2 Product  What is it?  Who does it?  Why is it important?  How to ensure it be done right?
Slide 1 Chapter 11 Real –time Software Designs. Slide 2 Real-time systems l Systems which monitor and control their environment l Inevitably associated.
Prepare by : Ihab shahtout.  Overview  To give an overview of fixed priority schedule  Scheduling and Fixed Priority Scheduling.
REAL-TIME SOFTWARE SYSTEMS DEVELOPMENT Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
Instructore: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Concurrent and.
C o n f i d e n t i a l 1 Course: BCA Semester: III Subject Code : BC 0042 Subject Name: Operating Systems Unit number : 1 Unit Title: Overview of Operating.
Real-time Software Design King Saud University College of Computer and Information Sciences Department of Computer Science Dr. S. HAMMAMI.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
2.5 Scheduling. Given a multiprogramming system, there are many times when more than 1 process is waiting for the CPU (in the ready queue). Given a multiprogramming.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
13-1 Chapter 13 Concurrency Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads C# Threads.
Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 2: The Linux System Part 3.
Time Management.  Time management is concerned with OS facilities and services which measure real time.  These services include:  Keeping track of.
Multithreading The objectives of this chapter are: To understand the purpose of multithreading To describe Java's multithreading mechanism.
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
Soft Timers : Efficient Microsecond Software Timer Support for Network Processing - Mohit Aron & Peter Druschel CS533 Winter 2007.
Preventing Interrupt Overload Presented by Jiyong Park Seoul National University, Korea John Regehr, Usit Duogsaa, School of Computing, University.
Real-time Software Design
Definition CASE tools are software systems that are intended to provide automated support for routine activities in the software process such as editing.
Unit OS9: Real-Time and Embedded Systems
Lecture 21 Concurrency Introduction
Introduction to Operating System (OS)
Chapter 2.2 : Process Scheduling
Real-time Software Design
Operating Systems CPU Scheduling.
What is Concurrent Programming?
Threads Chapter 4.
What is Concurrent Programming?
Chapter 2: Performance CS 447 Jason Bakos Fall 2001 CS 447.
Presentation transcript:

EEE 243B Applied Computer Programming Timing considerations

Winter 2005Maj JGA Beaulieu & Capt MWP LeSauvage Review What benefits does reuse have? What is the definition of a component?

Winter 2005Maj JGA Beaulieu & Capt MWP LeSauvage Outline Normal flow Periodic tasks Cyclic executives Aperiodic tasks Scheduling

Winter 2005Maj JGA Beaulieu & Capt MWP LeSauvage Normal flow So far in this course, we have studied programs that are controlled through programming language structures Our programs follow a structure that is dictated through if-else, while,do- while, switch,… statements But is this all there is to controlling the behaviour of programs?

Winter 2005Maj JGA Beaulieu & Capt MWP LeSauvage Normal flow Each instruction or set of instruction takes some time to execute; even if it is only microseconds There may be some programs for which we may want to control the elapsed time between various instructions (functions or tasks) This control of time is common among applied programs (robotics, process control, sampling,…)

Winter 2005Maj JGA Beaulieu & Capt MWP LeSauvage Normal flow The first time we played God with our robots (and face it, we are Gods to our Bots) is when we delayed their activities We used the sleep() or msleep functions to enlist the help of the brickOS operating system to impose a timeout to our programs

Winter 2005Maj JGA Beaulieu & Capt MWP LeSauvage Normal flow So if we do not impose some form of time control, our programs will execute following the control flow logic; in this case, the only time limitation is the execution time of the instructions Most applications that we use from day to day follow this kind of “static” scheduling of tasks where no timing behaviour is specified

Winter 2005Maj JGA Beaulieu & Capt MWP LeSauvage Periodic tasks Closely related to static task execution, is the concept of periodic tasks Some systems require some tasks (functions) to execute at given intervals to ensure that the system behaves in a specific manner Most control systems include periodic tasks Periodic tasks are “clockwork” maintenance events

Winter 2005Maj JGA Beaulieu & Capt MWP LeSauvage Periodic tasks The period of a task is dictated by control requirements and stability concerns Systems with periodic tasks can be implemented in several ways Some operating systems allow programmers to specify the periodicity of tasks. This spec may be: Actual period that the task will take (run every 10 msecs) Priority of a task is determined by its required frequency (period). A task with high frequency requirement will have a high priority so that it executes often Release time, execution time and deadline

Winter 2005Maj JGA Beaulieu & Capt MWP LeSauvage Cyclic executives Perhaps the easiest way to implement periodic tasks is the cyclic executive In the implementation of a cyclic executive, the programmer specifically directs or “hand controls” the timing behaviour of every task At the base of the cyclic executive is a loop with counters (or a set of loops) that execute “tasks” at given frequencies Cyclic executives do not require much support from the operating system; the entire schedule is embedded in the program itself

Winter 2005Maj JGA Beaulieu & Capt MWP LeSauvage Cyclic executives Cyclic executives mean that the programmer knows the hardware intimately The programmer must know how long each instruction takes to execute in order to tweak the cycles or loops that contain each tasks Most of the time, the programmer will measure the execution times empirically with tests Delays are used to tweak loop frequencies

Winter 2005Maj JGA Beaulieu & Capt MWP LeSauvage A Cyclic executives ABBCBBCAA Period of A Period of B Period of C Delay/idle time time 0

Winter 2005Maj JGA Beaulieu & Capt MWP LeSauvage Cyclic executives … while (1) { //tasks at high frequency each time the loop executes if (!(count%2)) { //tasks at half frequency every second loop //some delay } if (!(count%4)) { //tasks at quarter freq and delay} count++; sleep(x); //idle time that regulates the //highest frequency loop } …

Winter 2005Maj JGA Beaulieu & Capt MWP LeSauvage Aperiodic tasks Very few systems operate on a set of “pure” periodic tasks In order to be responsive, most applied systems allow for tasks to occur at unknown times; hence the tasks are aperiodic Aperiodic tasks occur in a spontaneous fashion through a computer’s interrupt facilities The operating system must have a mechanism to handle interrupts

Winter 2005Maj JGA Beaulieu & Capt MWP LeSauvage Aperiodic tasks Timing behaviour for aperiodic tasks is, in general, unpredictable, because you cannot know “when” an event will occur: When a temperature will be reached Data comes on a port Robot hits an obstacle…

Winter 2005Maj JGA Beaulieu & Capt MWP LeSauvage Aperiodic tasks Aperiodic tasks can, however, be modelled as pseudo periodic tasks In many systems, it is possible to estimate the frequency of aperiodic events When you model aperiodic tasks, you goal is only to see if you will have “enough room” in your schedule so that the system can respond to a maximum number of events

Winter 2005Maj JGA Beaulieu & Capt MWP LeSauvage Scheduling Scheduling is a software engineering discipline that deals with several problems: Efficiency: maximises system resources Throughput: execute as many tasks as possible for a given time Fairness: ensure that users on a multi-user system get their fair share of system resources Safety: ensures that all tasks in a real-time system meet their deadlines Response time: ensures that the system is responsive to requests

Winter 2005Maj JGA Beaulieu & Capt MWP LeSauvage Scheduling All the programs that we have written so far run in a single task and have a single thread In some systems, it is possible for a program to have several tasks that can execute in parallel These tasks can be full processes or execution threads; where the processor is shared in some fashion (round-robin, priority based, …)

Winter 2005Maj JGA Beaulieu & Capt MWP LeSauvage Quiz Time How would you implement a cyclic executive?