Modern Embedded Systems Programming: Beyond the RTOS
|
|
- Millicent Elliott
- 5 years ago
- Views:
Transcription
1 Modern Embedded Systems Programming: Beyond the RTOS Miro Samek Quantum Leaps, LLC 1
2 Presentation Outline A quick introduction to RTOS and the perils of blocking Active objects State machines ~40 min Active object frameworks for deeply embedded systems Demonstrations Q&A ~10 min ~10 min 2
3 In the beginning was the Superloop // adapted from the Arduino Blink Tutorial (*) void main() { pinmode(led_pin, OUTPUT); // setup: set the LED pin as output while (1) { // endless loop digitalwrite(led_pin, HIGH); // turn LED on delay(1000); // wait for 1000ms digitalwrite(led_pin, LOW); // turn LED off delay(1000); // wait for 1000ms (*) Arduino Blink Tutorial: 3
4 RTOS Multithreading: Multiple Superloops void thread_alarm() { // RTOS thread routine pinmode(sw_pin, INPUT); // setup: set the Switch pin as input while (1) { // endless loop if (digitalread(sw_pin) == HIGH) { // is the switch depressed? digitalwrite(alarm_pin, HIGH); // start the alarm void thread_blink() { // RTOS thread routine pinmode(led_pin, OUTPUT); // setup: set the LED pin else { while (1) { // endless loop the alarm digitalwrite(alarm_pin, LOW); // stop digitalwrite(led_pin, HIGH); // turn the LED on void thread_blink() { // RTOS thread routine RTOS_delay(1000);// wait // for wait100ms for 1000ms RTOS_delay(100); pinmode(led_pin, OUTPUT); // setup: set pin as output digitalwrite(led_pin, LOW); // turn the LED off while (1) { // endless loop RTOS_delay(1000); // wait for 1000ms digitalwrite(led_pin, HIGH); // turn the LED on RTOS_delay(1000); // wait for 1000ms digitalwrite(led_pin, LOW); // turn the LED off RTOS_delay(1000); // wait for 1000ms 4
5 Thread Context & Context Switch TCB sp... Thread Control Blocks (TCBs) TCB sp stack stack void thread_blink() { per-thread stacks pinmode(led_pin, OUTPUT); While (1) { // endless loop digitalwrite(led_pin, HIGH); Memory pc RTOS_delay(1000); digitalwrite(led_pin, LOW); CPU registers pc RTOS_delay(1000); status register sr sp stack pointer context save... pc context restore program counter 5
6 priority Thread Blocking Thread makes a blocking call, e.g, RTOS_delay() Thread-A runs RTOS kernel Thread-B blocked K Clock tick interrupt ISR K RTOS kernel context switch Thread-A blocked (6b) Thread-A runs context switch Thread-B runs Thread-B blocked time 6
7 RTOS Benefits 1) Divide and conquer strategy Multiple threads are easier to develop than one kitchen sink superloop 2) More efficient CPU use Threads that are efficiently blocked don't consume CPU cycles 3) Threads can be decoupled in the time domain Under a preemptive, priority-based scheduler, changes in low-priority threads have no impact on the timing of high-priority threads (Rate Monotonic Analysis (RMA)) 7
8 Perils of Blocking Starvation Shared-state concurrency Race conditions Mutual Exclusion Failure Deadlock Missed deadlines Blocking Priority inversion Synchronization by blocking Unresponsive threads More threads Architectural decay 8
9 Best Practices of Concurrent Programming(*) Don't block inside your code Communicate and synchronize threads asynchronously via event objects Don't share data or resources among threads Keep data isolated and bound to threads (strict encapsulation) Structure your threads as message pumps (*) Herb Sutter Prefer Using Active Objects Instead of Naked Threads 9
10 Best Practices: RTOS Implementation Event object Event queue Event object Private thread BLOCKING ISR Event object Event queue Event queue start Private data and resources Wait for event Process event Event loop NO BLOCKING void thread_handler(ao_type *ao) { // AO thread routine... // setup while (1) { // event loop // pend on the event queue (BLOCKING!) Event e = RTOS_queuePend(ao->queue); ao->handle(e); // handle event (NON-BLOCKING!) 10
11 Active Object (Actor) Design Pattern Active Objects (Actors) are event-driven, strictly encapsulated software objects running in their own threads and communicating asynchronously by means of events. Not a novelty. Carl Hewitt's actors 1970s. ROOM actors 1990s. Adapted from ROOM into UML as active objects ROOM actors and UML active objects use hierarchical state machines (UML statecharts) to specify the behavior of event-driven active objects. 11
12 Active Object Framework Implement the Active Object pattern as a framework void thread_handler(ao_type *ao) { // AO thread routine... // setup while (1) { // event loop // pend on the event queue (BLOCKING!) Event e = RTOS_queuePend(ao->queue); ao->handle(e); // handle event (NON-BLOCKING!) Inversion of control (main difference from RTOS) automates and enforces the best practices (safer design) brings conceptual integrity and consistency to the applications 12
13 Paradigm Shift: Sequential Event-Driven Sequential programming with RTOS No blocking No use for most RTOS mechanisms! Event-driven active object framework Paradigm Shift Events Semaphores Threads Mutexes Event Flags void thread_blink() { pinmode(led_pin, OUTPUT); delay() while (1) { digitalwrite(led_pin, HIGH); Callback RTOS_delay(1000); // NOT allowed!timers... Message Queues* Active Objects Event Posting Publish/ Subscribe Memory Pools Time Events State Machines 13
14 Reduce Spaghetti Code with State Machines Finite State Machines the best known spaghetti reducers State captures only the relevant aspects of the system's history Natural fit for event-driven programming, where the code cannot block and must return to the event-loop after each event Minimal context (a single state-variable) instead of the whole call stack default ANY_KEY / send_lower_case_scan_code(); internal transitions CAPS_LOCK CAPS_LOCK caps_locked ANY_KEY / send_upper_case_scan_code(); trigger list of actions 14
15 State Machines are not Flowcharts Statechart (event-driven) represents all states of a system driven by explicit events processing happens on arcs (transitions) no notion of progression (a) Flowchart (sequential) represents stages of processing in a system gets from node to node upon completion processing happens in nodes progresses from start to finish (b) s1 E1 / action1(); do X s2 E2 / action2(); do Y do Z s3 E3 / action3(); do W 15
16 Hierarchical State Machines Traditional FSMs explode due to repetitions C (a) State hierarchy eliminates repetitions programming-by-difference (b) OFF on operand1 OPER C C OPER operand1 DIGIT_0_9, C POINT OPER result OFF operand2 DIGIT_0_9, POINT OFF C result EQUALS opentered OPER DIGIT_0_9, POINT OFF opentered EQUALS operand2 OFF DIGIT_0_9, POINT 16
17 AO Frameworks for Deeply Embedded Systems 17
18 AO Frameworks can be smaller than RTOS kernels, because they don't need blocking RAM (data) AO Frameworks vs. RTOS kernels Linux, Windows XP 1MB Windows CE VxWorks 100KB A typical small preemptive RTOS 10KB QP/C, QP/C++ 1KB QP-nano 100B 10B 1KB 2KB 10KB 100KB 1MB 10MB ROM (code) 18
19 AO Framework Software Bus direct event posting Active Object 1 Active Object 2 Active Object N... multicasting a published event publish-subscribe software bus ISR_1() ISR_2() 19
20 Coding Hierarchical State Machines top on entry / exit / C ready OFF QState Calc_on(Calc * const me, QEvt const *e) { QState status; switch (e->sig) { case Q_ENTRY_SIG: /* entry action */... status = Q_HANDLED(); break; case Q_EXIT_SIG: /* exit action */... status = Q_HANDLED(); break; case Q_INIT_SIG: /* initial transition */ status = Q_TRAN(&Calc_ready); break; case C_SIG: /* state transition */ BSP_clear(); /* clear the display */ status = Q_TRAN(&Calc_on); break; case OFF_SIG: /* state transition */ status = Q_TRAN(&Calc_final); break; default: status = Q_SUPER(&QHsm_top); /* superstate */ break; return status; 20
21 Cooperative Kernel (QV) find highest-priority non-empty queue priority = n all queues empty (idle condition) vanilla scheduler priority = n-1 priority = 1... idle processing e = queue.get(); e = queue.get();... e = queue.get(); dispatch(e); dispatch(e);... dispatch(e); priority = 0 21
22 Preemptive, Non-Blocking Kernel (QK) Synchronous Preemption priority low priority task high priority task function call (3) interrupt entry/exit RTC scheduler (4) (2) (1) 0 task preempted time Asynchronous Preemption priority interrupt 10 (5) (3) (4) interrupt call (5) (6) interrupt return (7) low priority task high priority task function call (8) (9) interrupt entry/exit (10) RTC scheduler (2) (1) 0 task preempted (11) time 22
23 Graphical Modeling and Code Generation Active Objects enable you to effectively apply UML modeling A modeling tool needs an AO framework as a target for automatic code generation 23
24 Summary Experts use the Active Object design pattern instead of naked RTOS AO framework is an ideal fit for deeply embedded real-time systems AO framework requires a paradigm shift (sequential event-driven) Compared to RTOS, AO framework opens new possibilities: Safer architecture and state-machine design method (functional safety) Simpler, more efficient kernels (lower-power applications) Easier unit testing and software tracing (V&V) Higher level of abstraction suitable for modeling and code generation Welcome to the 21st century! 24
25 Demo: Blinky on Arduino 25
26 Demo: PELICAN on Arduino 26
27 Demo: Dining Philosophers with Q-SPY QF Philo[n] thinking (2) (1) Philo[m] Table thinking serving (3) TIMEOUT hungry eating TIMEOUT HUNGRY(m) EAT(m) (5) (4) (6) hungry (7) HUNGRY(n) (8) TIMEOUT (10) eating thinking DONE(m) (9) EAT(n) 27
28 Demo: Fly 'n' Shoot game on Windows 28
Modern Embedded Systems Programming: Beyond the RTOS
Modern Embedded Systems Programming: Beyond the RTOS Miro Samek Quantum Leaps, LLC 1 Presentation Outline A quick introduction to RTOS and the perils of blocking Active objects State machines ~40 min Active
More informationThis talk is based on my 15 years of experience with developing and refining active object frameworks for deeply embedded real-time systems.
In this presentation I'd like to talk about a modern way to build real-time embedded software that goes beyond the traditional Real-Time Operating System (RTOS). Even though the ideas I'll discuss today
More informationThis presentation provides an overview of the QP active object (actor) frameworks and the QM modeling and code-generation tool from Quantum Leaps.
This presentation provides an overview of the QP active object (actor) frameworks and the QM modeling and code-generation tool from Quantum Leaps. You can't just look at the QP frameworks and the QM modeling
More informationstate-machine.com 2018, Quantum Leaps
The embedded software industry is in the midst of a major revolution. Tremendous amount of new development lays ahead. This new software needs an actual architecture that is safer, better structured and
More informationPractical UML Statecharts in C/C++
Practical UML Statecharts in C/C++ Event-Driven Programming for Embedded Systems 2nd Edition Miro Samek ELSEVIER AMSTERDAM. BOSTON. HEIDELBERG LONDON NEW YORK. OXFORD PARIS SAN DIEGO SAN FRANCISCO SINGAPORE
More informationOperating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy
Operating Systems Designed and Presented by Dr. Ayman Elshenawy Elsefy Dept. of Systems & Computer Eng.. AL-AZHAR University Website : eaymanelshenawy.wordpress.com Email : eaymanelshenawy@yahoo.com Reference
More informationChapter 2 Processes and Threads
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 2 Processes and Threads The Process Model Figure 2-1. (a) Multiprogramming of four programs. (b) Conceptual model of four independent,
More informationA Predictable RTOS. Mantis Cheng Department of Computer Science University of Victoria
A Predictable RTOS Mantis Cheng Department of Computer Science University of Victoria Outline I. Analysis of Timeliness Requirements II. Analysis of IO Requirements III. Time in Scheduling IV. IO in Scheduling
More informationTasks. Task Implementation and management
Tasks Task Implementation and management Tasks Vocab Absolute time - real world time Relative time - time referenced to some event Interval - any slice of time characterized by start & end times Duration
More informationAC OB S. Multi-threaded FW framework (OS) for embedded ARM systems Torsten Jaekel, June 2014
AC OB S Multi-threaded FW framework (OS) for embedded ARM systems Torsten Jaekel, June 2014 ACOBS ACtive OBject (operating) System Simplified FW System for Multi-Threading on ARM embedded systems ACOBS
More informationCHAPTER 6: PROCESS SYNCHRONIZATION
CHAPTER 6: PROCESS SYNCHRONIZATION The slides do not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams. TOPICS Background
More informationEvents! Event Driven Embedded Software and UML State Charts. Matthew Eshleman covemountainsoftware.com
Events! Event Driven Embedded Software and UML State Charts Matthew Eshleman covemountainsoftware.com Background - Matthew Eshleman Nearly 20 years of embedded software engineering, architecture, and project
More informationEmbedded Systems. 5. Operating Systems. Lothar Thiele. Computer Engineering and Networks Laboratory
Embedded Systems 5. Operating Systems Lothar Thiele Computer Engineering and Networks Laboratory Embedded Operating Systems 5 2 Embedded Operating System (OS) Why an operating system (OS) at all? Same
More informationIntroduction to Real-Time Operating Systems
Introduction to Real-Time Operating Systems GPOS vs RTOS General purpose operating systems Real-time operating systems GPOS vs RTOS: Similarities Multitasking Resource management OS services to applications
More informationWhat s An OS? Cyclic Executive. Interrupts. Advantages Simple implementation Low overhead Very predictable
What s An OS? Provides environment for executing programs Process abstraction for multitasking/concurrency scheduling Hardware abstraction layer (device drivers) File systems Communication Do we need an
More informationProcesses The Process Model. Chapter 2 Processes and Threads. Process Termination. Process States (1) Process Hierarchies
Chapter 2 Processes and Threads Processes The Process Model 2.1 Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling Multiprogramming of four programs Conceptual
More informationDesign Pattern Deferred Event
QP state machine framework pattern Design Pattern Document Revision C October 2013 Copyright Quantum Leaps, LLC www.quantum-leaps.com www.state-machine.com The following excerpt comes from the book Practical
More informationLecture 3: Concurrency & Tasking
Lecture 3: Concurrency & Tasking 1 Real time systems interact asynchronously with external entities and must cope with multiple threads of control and react to events - the executing programs need to share
More informationProcesses Prof. James L. Frankel Harvard University. Version of 6:16 PM 10-Feb-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved.
Processes Prof. James L. Frankel Harvard University Version of 6:16 PM 10-Feb-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved. Process Model Each process consists of a sequential program
More informationMain Points of the Computer Organization and System Software Module
Main Points of the Computer Organization and System Software Module You can find below the topics we have covered during the COSS module. Reading the relevant parts of the textbooks is essential for a
More informationThe Real Time Thing. What the hack is real time and what to do with it. 22C3 30. December Erwin Erkinger e.at
The Real Time Thing What the hack is real time and what to do with it 22C3 30. December 2005 Erwin Erkinger vindaome@p e.at Content Part 1: Introduction the vocabulary and the concepts Part 2: Practical
More informationLecture notes Lectures 1 through 5 (up through lecture 5 slide 63) Book Chapters 1-4
EE445M Midterm Study Guide (Spring 2017) (updated February 25, 2017): Instructions: Open book and open notes. No calculators or any electronic devices (turn cell phones off). Please be sure that your answers
More informationTimers 1 / 46. Jiffies. Potent and Evil Magic
Timers 1 / 46 Jiffies Each timer tick, a variable called jiffies is incremented It is thus (roughly) the number of HZ since system boot A 32-bit counter incremented at 1000 Hz wraps around in about 50
More informationCS A331 Programming Language Concepts
CS A331 Programming Language Concepts Lecture 12 Alternative Language Examples (General Concurrency Issues and Concepts) March 30, 2014 Sam Siewert Major Concepts Concurrent Processing Processes, Tasks,
More informationSemaphore. Originally called P() and V() wait (S) { while S <= 0 ; // no-op S--; } signal (S) { S++; }
Semaphore Semaphore S integer variable Two standard operations modify S: wait() and signal() Originally called P() and V() Can only be accessed via two indivisible (atomic) operations wait (S) { while
More informationProcesses The Process Model. Chapter 2. Processes and Threads. Process Termination. Process Creation
Chapter 2 Processes The Process Model Processes and Threads 2.1 Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling Multiprogramming of four programs Conceptual
More informationLesson 6: Process Synchronization
Lesson 6: Process Synchronization Chapter 5: Process Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Mutex Locks Semaphores Classic Problems of Synchronization
More informationConcurrency: Deadlock and Starvation. Chapter 6
Concurrency: Deadlock and Starvation Chapter 6 Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate with each other Involve conflicting needs for resources
More informationPROCESSES & THREADS. Charles Abzug, Ph.D. Department of Computer Science James Madison University Harrisonburg, VA Charles Abzug
PROCESSES & THREADS Charles Abzug, Ph.D. Department of Computer Science James Madison University Harrisonburg, VA 22807 Voice Phone: 540-568-8746; Cell Phone: 443-956-9424 E-mail: abzugcx@jmu.edu OR CharlesAbzug@ACM.org
More informationExam TI2720-C/TI2725-C Embedded Software
Exam TI2720-C/TI2725-C Embedded Software Wednesday April 16 2014 (18.30-21.30) Koen Langendoen In order to avoid misunderstanding on the syntactical correctness of code fragments in this examination, we
More informationCSE 4/521 Introduction to Operating Systems
CSE 4/521 Introduction to Operating Systems Lecture 7 Process Synchronization II (Classic Problems of Synchronization, Synchronization Examples) Summer 2018 Overview Objective: 1. To examine several classical
More informationSynchronization Principles
Synchronization Principles Gordon College Stephen Brinton The Problem with Concurrency Concurrent access to shared data may result in data inconsistency Maintaining data consistency requires mechanisms
More informationThreads SPL/2010 SPL/20 1
Threads 1 Today Processes and Scheduling Threads Abstract Object Models Computation Models Java Support for Threads 2 Process vs. Program processes as the basic unit of execution managed by OS OS as any
More informationChapter 6: Process Synchronization. Operating System Concepts 8 th Edition,
Chapter 6: Process Synchronization, Silberschatz, Galvin and Gagne 2009 Module 6: Process Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Semaphores
More informationCS A320 Operating Systems for Engineers
CS A320 Operating Systems for Engineers Lecture 4 Conclusion of MOS Chapter 2 September 18, 2013 Sam Siewert Many Ways to Schedule a CPU Core We ve Come a Long way Since Batch Scheduling Sam Siewert 2
More informationDesigning Responsive and Real-Time Systems
Designing Responsive and Real-Time Systems Chapter 10 Renesas Electronics America Inc. Embedded Systems using the RX63N Rev. 1.0 00000-A Learning Objectives Most Embedded Systems have multiple real time
More informationToday s Topics. u Thread implementation. l Non-preemptive versus preemptive threads. l Kernel vs. user threads
Today s Topics COS 318: Operating Systems Implementing Threads u Thread implementation l Non-preemptive versus preemptive threads l Kernel vs. user threads Jaswinder Pal Singh and a Fabulous Course Staff
More informationEmbedded Software Programming
Embedded Software Programming Computer Science & Engineering Department Arizona State University Tempe, AZ 85287 Dr. Yann-Hang Lee yhlee@asu.edu (480) 727-7507 Event and Time-Driven Threads taskspawn (name,
More informationAUTOBEST: A United AUTOSAR-OS And ARINC 653 Kernel. Alexander Züpke, Marc Bommert, Daniel Lohmann
AUTOBEST: A United AUTOSAR-OS And ARINC 653 Kernel Alexander Züpke, Marc Bommert, Daniel Lohmann alexander.zuepke@hs-rm.de, marc.bommert@hs-rm.de, lohmann@cs.fau.de Motivation Automotive and Avionic industry
More informationChapter 5: Process Synchronization. Operating System Concepts 9 th Edition
Chapter 5: Process Synchronization Silberschatz, Galvin and Gagne 2013 Chapter 5: Process Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Mutex Locks
More informationChapter 6 Process Synchronization
Chapter 6 Process Synchronization Cooperating Process process that can affect or be affected by other processes directly share a logical address space (threads) be allowed to share data via files or messages
More informationChapter 6: Synchronization. Operating System Concepts 8 th Edition,
Chapter 6: Synchronization, Silberschatz, Galvin and Gagne 2009 Outline Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Semaphores Classic Problems of Synchronization
More informationChapter 6: Synchronization. Chapter 6: Synchronization. 6.1 Background. Part Three - Process Coordination. Consumer. Producer. 6.
Part Three - Process Coordination Chapter 6: Synchronization 6.1 Background Concurrent access to shared data may result in data inconsistency Maintaining data consistency requires mechanisms to ensure
More informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Spring 1018 L11 Synchronization Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ Multilevel feedback queue:
More informationChapter 6: Process Synchronization
Chapter 6: Process Synchronization Chapter 6: Synchronization 6.1 Background 6.2 The Critical-Section Problem 6.3 Peterson s Solution 6.4 Synchronization Hardware 6.5 Mutex Locks 6.6 Semaphores 6.7 Classic
More informationModule 6: Process Synchronization
Module 6: Process Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Semaphores Classic Problems of Synchronization Monitors Synchronization Examples Atomic
More informationChapter 6: Process Synchronization
Chapter 6: Process Synchronization Chapter 6: Process Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Mutex Locks Semaphores Classic Problems of Synchronization
More informationMidterm Exam. October 20th, Thursday NSC
CSE 421/521 - Operating Systems Fall 2011 Lecture - XIV Midterm Review Tevfik Koşar University at Buffalo October 18 th, 2011 1 Midterm Exam October 20th, Thursday 9:30am-10:50am @215 NSC Chapters included
More informationRoadmap for This Lecture
Thread Scheduling 1 Roadmap for This Lecture Overview Priorities Scheduling States Scheduling Data Structures Quantum Scheduling Scenarios Priority Adjustments (boosts and decays) Multiprocessor Scheduling
More informationEI 338: Computer Systems Engineering (Operating Systems & Computer Architecture)
EI 338: Computer Systems Engineering (Operating Systems & Computer Architecture) Dept. of Computer Science & Engineering Chentao Wu wuct@cs.sjtu.edu.cn Download lectures ftp://public.sjtu.edu.cn User:
More informationChapter 6: Process Synchronization. Operating System Concepts 8 th Edition,
Chapter 6: Process Synchronization, Silberschatz, Galvin and Gagne 2009 Module 6: Process Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Semaphores
More information6/20/2018. Lecture 2: Platforms & RTOS. Outline. Lab Setup (20 min) Labs work. Lecture: Platform + RTOS
Lecture 2: Platforms & RTOS 1 Outline Lab Setup (20 min) Labs work Workbench + vxworks Documentations (15 min) Project Management (25 min) Host Shell (25 min) Lecture: Platform + RTOS 2 1 3 Microcomputer
More informationZiLOG Real-Time Kernel Version 1.2.0
ez80acclaim Family of Microcontrollers Version 1.2.0 PRELIMINARY Introduction The (RZK) is a realtime, preemptive, multitasking kernel designed for time-critical embedded applications. It is currently
More informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2017 Lecture 11 Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ Multilevel Feedback Queue: Q0, Q1,
More informationCS 31: Introduction to Computer Systems : Threads & Synchronization April 16-18, 2019
CS 31: Introduction to Computer Systems 22-23: Threads & Synchronization April 16-18, 2019 Making Programs Run Faster We all like how fast computers are In the old days (1980 s - 2005): Algorithm too slow?
More informationCS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University
CS 571 Operating Systems Midterm Review Angelos Stavrou, George Mason University Class Midterm: Grading 2 Grading Midterm: 25% Theory Part 60% (1h 30m) Programming Part 40% (1h) Theory Part (Closed Books):
More informationRTOS Real T i Time me Operating System System Concepts Part 2
RTOS Real Time Operating System Concepts Part 2 Real time System Pitfalls - 4: The Ariane 5 satelite launch rocket Rocket self destructed in 4 June -1996. Exactly after 40 second of lift off at an attitude
More informationCSE 153 Design of Operating Systems Fall 2018
CSE 153 Design of Operating Systems Fall 2018 Lecture 5: Threads/Synchronization Implementing threads l Kernel Level Threads l u u All thread operations are implemented in the kernel The OS schedules all
More informationDesign Pattern Transition to History
QP state machine framework pattern Design Pattern Document Revision C October 2013 Copyright Quantum Leaps, LLC www.quantum-leaps.com www.state-machine.com The following excerpt comes from the book Practical
More informationC09: Process Synchronization
CISC 7310X C09: Process Synchronization Hui Chen Department of Computer & Information Science CUNY Brooklyn College 3/29/2018 CUNY Brooklyn College 1 Outline Race condition and critical regions The bounded
More informationENGR 3950U / CSCI 3020U UOIT, Fall 2012 Quiz on Process Synchronization SOLUTIONS
Name: Student Number: SOLUTIONS ENGR 3950U / CSCI 3020U (Operating Systems) Quiz on Process Synchronization November 13, 2012, Duration: 40 Minutes (10 questions and 8 pages, 45 Marks) Instructor: Dr.
More informationUNIT -3 PROCESS AND OPERATING SYSTEMS 2marks 1. Define Process? Process is a computational unit that processes on a CPU under the control of a scheduling kernel of an OS. It has a process structure, called
More informationChapter 6: Process Synchronization. Operating System Concepts 9 th Edit9on
Chapter 6: Process Synchronization Operating System Concepts 9 th Edit9on Silberschatz, Galvin and Gagne 2013 Objectives To present the concept of process synchronization. To introduce the critical-section
More informationRT3 - FreeRTOS Real Time Programming
Formation FreeRTOS Real Time Programming: Real-time programming applied to the FreeRTOS operating system - Systèmes d'exploitation: RTOS RT3 - FreeRTOS Real Time Programming Real-time programming applied
More informationSubject: Operating System (BTCOC403) Class: S.Y.B.Tech. (Computer Engineering)
A. Multiple Choice Questions (60 questions) Subject: Operating System (BTCOC403) Class: S.Y.B.Tech. (Computer Engineering) Unit-I 1. What is operating system? a) collection of programs that manages hardware
More information2. Introduction to Software for Embedded Systems
2. Introduction to Software for Embedded Systems Lothar Thiele ETH Zurich, Switzerland 2-1 Contents of Lectures (Lothar Thiele) 1. Introduction to Embedded System Design 2. Software for Embedded Systems
More informationChapter 5: Process Synchronization. Operating System Concepts Essentials 2 nd Edition
Chapter 5: Process Synchronization Silberschatz, Galvin and Gagne 2013 Chapter 5: Process Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Mutex Locks
More informationMultiprocessor and Real-Time Scheduling. Chapter 10
Multiprocessor and Real-Time Scheduling Chapter 10 1 Roadmap Multiprocessor Scheduling Real-Time Scheduling Linux Scheduling Unix SVR4 Scheduling Windows Scheduling Classifications of Multiprocessor Systems
More informationCSI3131 Final Exam Review
CSI3131 Final Exam Review Final Exam: When: April 24, 2015 2:00 PM Where: SMD 425 File Systems I/O Hard Drive Virtual Memory Swap Memory Storage and I/O Introduction CSI3131 Topics Process Computing Systems
More informationTaming Dava Threads. Apress ALLEN HOLUB. HLuHB Darmstadt
Taming Dava Threads ALLEN HOLUB HLuHB Darmstadt Apress TM Chapter l The Architecture of Threads l The Problems with Threads l All Nontrivial Java Programs Are Multithreaded 2 Java's Thread Support Is Not
More informationEE458 - Embedded Systems Lecture 8 Semaphores
EE458 - Embedded Systems Lecture 8 Semaphores Outline Introduction to Semaphores Binary and Counting Semaphores Mutexes Typical Applications RTEMS Semaphores References RTC: Chapter 6 CUG: Chapter 9 1
More informationMultiprocessor and Real- Time Scheduling. Chapter 10
Multiprocessor and Real- Time Scheduling Chapter 10 Classifications of Multiprocessor Loosely coupled multiprocessor each processor has its own memory and I/O channels Functionally specialized processors
More informationDealing with Issues for Interprocess Communication
Dealing with Issues for Interprocess Communication Ref Section 2.3 Tanenbaum 7.1 Overview Processes frequently need to communicate with other processes. In a shell pipe the o/p of one process is passed
More informationChapter 6: Process Synchronization
Module 6: Process Synchronization Chapter 6: Process Synchronization Background! The Critical-Section Problem! Peterson s Solution! Synchronization Hardware! Semaphores! Classic Problems of Synchronization!
More informationIntroduction to Real-Time Systems and Multitasking. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff
Introduction to Real-Time Systems and Multitasking Real-time systems Real-time system: A system that must respond to signals within explicit and bounded time requirements Categories Soft real-time system:
More informationHigh Performance Computing Course Notes Shared Memory Parallel Programming
High Performance Computing Course Notes 2009-2010 2010 Shared Memory Parallel Programming Techniques Multiprocessing User space multithreading Operating system-supported (or kernel) multithreading Distributed
More informationCS 153 Design of Operating Systems Winter 2016
CS 153 Design of Operating Systems Winter 2016 Lecture 12: Scheduling & Deadlock Priority Scheduling Priority Scheduling Choose next job based on priority» Airline checkin for first class passengers Can
More informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Spring 1018 L10 Synchronization Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ Development project: You
More informationChapter 6: Process Synchronization
Chapter 6: Process Synchronization Objectives Introduce Concept of Critical-Section Problem Hardware and Software Solutions of Critical-Section Problem Concept of Atomic Transaction Operating Systems CS
More informationZilog Real-Time Kernel
An Company Configurable Compilation RZK allows you to specify system parameters at compile time. For example, the number of objects, such as threads and semaphores required, are specez80acclaim! Family
More informationUNIT:2. Process Management
1 UNIT:2 Process Management SYLLABUS 2.1 Process and Process management i. Process model overview ii. Programmers view of process iii. Process states 2.2 Process and Processor Scheduling i Scheduling Criteria
More informationW4118 Operating Systems. Junfeng Yang
W4118 Operating Systems Junfeng Yang What is a process? Outline Process dispatching Common process operations Inter-process Communication What is a process Program in execution virtual CPU Process: an
More informationCSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008.
CSC 4103 - Operating Systems Spring 2008 Lecture - XII Midterm Review Tevfik Ko!ar Louisiana State University March 4 th, 2008 1 I/O Structure After I/O starts, control returns to user program only upon
More informationAdministration. Matteo Corti RZ H
Administration Matteo Corti RZ H11 27944 corti@inf.ethz.ch Today: IFW A36, 16:15 D-INFK Colloquium Automated, compositional and iterative deadlock detection Natasha Sharygina, Carnegie Mellon University
More informationReal-Time Systems / Real-Time Operating Systems EE445M/EE380L.6, Spring 2016
The University of Texas at Austin Department of Electrical and Computer Engineering Real-Time Systems / Real-Time Operating Systems EE445M/EE380L.6, Spring 2016 Midterm Solutions Date: March 24, 2016 UT
More informationDeadlock and Monitors. CS439: Principles of Computer Systems September 24, 2018
Deadlock and Monitors CS439: Principles of Computer Systems September 24, 2018 Bringing It All Together Processes Abstraction for protection Define address space Threads Share (and communicate) through
More informationReal-Time Programming
Real-Time Programming Week 7: Real-Time Operating Systems Instructors Tony Montiel & Ken Arnold rtp@hte.com 4/1/2003 Co Montiel 1 Objectives o Introduction to RTOS o Event Driven Systems o Synchronization
More informationCS3733: Operating Systems
Outline CS3733: Operating Systems Topics: Synchronization, Critical Sections and Semaphores (SGG Chapter 6) Instructor: Dr. Tongping Liu 1 Memory Model of Multithreaded Programs Synchronization for coordinated
More informationProcess Synchronization
CSC 4103 - Operating Systems Spring 2007 Lecture - VI Process Synchronization Tevfik Koşar Louisiana State University February 6 th, 2007 1 Roadmap Process Synchronization The Critical-Section Problem
More informationResource management. Real-Time Systems. Resource management. Resource management
Real-Time Systems Specification Implementation Verification Mutual exclusion is a general problem that exists at several levels in a real-time system. Shared resources internal to the the run-time system:
More informationEmbedded Systems: OS. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University
Embedded Systems: OS Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Standalone Applications Often no OS involved One large loop Microcontroller-based
More informationFreeRTOS. A Brief Overview. Christopher Kenna. October 1, Avionics. FreeRTOS 1 / 34
A Brief Overview Christopher Kenna Avionics October 1, 2010 1 / 34 Introduction Outline 1 Introduction About Kernel Overview 2 Tasks Tasks versus Co-Routines Task Details 3 IPC and Synchronization Queues
More informationChapter 5: Process Synchronization
Chapter 5: Process Synchronization Silberschatz, Galvin and Gagne 2013 Operating System Concepts 9th Edition Chapter 5: Process Synchronization Background The Critical-Section Problem Peterson s Solution
More informationChapter 5: Process Synchronization. Operating System Concepts 9 th Edition
Chapter 5: Process Synchronization Silberschatz, Galvin and Gagne 2013 Chapter 5: Process Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Mutex Locks
More informationReal-Time Systems Hermann Härtig Real-Time Operating Systems Brief Overview
Real-Time Systems Hermann Härtig Real-Time Operating Systems Brief Overview 02/02/12 Outline Introduction Basic variants of RTOSes Real-Time paradigms Common requirements for all RTOSes High level resources
More informationWhat is the Race Condition? And what is its solution? What is a critical section? And what is the critical section problem?
What is the Race Condition? And what is its solution? Race Condition: Where several processes access and manipulate the same data concurrently and the outcome of the execution depends on the particular
More informationOperating Systems Comprehensive Exam. Spring Student ID # 3/16/2006
Operating Systems Comprehensive Exam Spring 2006 Student ID # 3/16/2006 You must complete all of part I (60%) You must complete two of the three sections in part II (20% each) In Part I, circle or select
More informationCS 5523 Operating Systems: Midterm II - reivew Instructor: Dr. Tongping Liu Department Computer Science The University of Texas at San Antonio
CS 5523 Operating Systems: Midterm II - reivew Instructor: Dr. Tongping Liu Department Computer Science The University of Texas at San Antonio Fall 2017 1 Outline Inter-Process Communication (20) Threads
More informationMicriμm. Getting Started with Micriμm s. Matt Gordon, Sr. Applications Engineer. 9L05I Renesas Electronics America Inc.
Getting Started with Micriμm s μc/os-iii Kernel Matt Gordon, Sr. Applications Engineer Micriμm Class ID: 9L05I Renesas Electronics America Inc. 2012 Renesas Electronics America Inc. All rights reserved.
More informationThreading and Synchronization. Fahd Albinali
Threading and Synchronization Fahd Albinali Parallelism Parallelism and Pseudoparallelism Why parallelize? Finding parallelism Advantages: better load balancing, better scalability Disadvantages: process/thread
More information