Real-Time Programming
|
|
- Diana Greer
- 5 years ago
- Views:
Transcription
1 Real-Time Programming Week 7: Real-Time Operating Systems Instructors Tony Montiel & Ken Arnold 4/1/2003 Co Montiel 1 Objectives o Introduction to RTOS o Event Driven Systems o Synchronization and Communication o Task Scheduling o Common RTOS Problems 4/1/2003 Co Montiel 2
2 Intro to RTOS o Operating System o Share/Allocate Resources: CPU Time Memory I/O o Real Time OS o Event Driven Tasks 4/1/2003 Co Montiel 3 Event Driven Systems o Processing Required When Events Occur o Asynchronous With Respect to Program o System Must Respond to Events o Multiple Events Can Occur Simultaneously o RTOS Attempts to Allocate CPU Time 4/1/2003 Co Montiel 4
3 Event Driven Systems o The hardware and software together take action as a direct result of the occurrence of an event. o When an event occurs: Other processing is suspended The event is processed Other processing is resumed o Usually these are also Real Time systems 4/1/2003 Co Montiel 5 Polling Events o The simplest, but least efficient method of determining if an event has occurred o Processor waits in a loop for the event o Often used in simple I/O handlers: Wait: Input buffer full? No: jump to Wait Yes: read input data buffer and continue Processor does nothing else... 4/1/2003 Co Montiel 6
4 Embedded RTOS Concepts o Resource Allocation: CPU Time Round Robin vs. Priority, Preemptive vs. Non-preemptive Memory I/O o Inter-Task Communication o Tasks Scheduling, States o Hiding Hardware Details 4/1/2003 Co Montiel 7 Tasks States, Scheduling o Context Preservation & Restoration Issues: Co-processors, Limited Stack Size... o Task Control Data Structures o Limited Embedded Resources: R/W Volatile Memory Non-volatile Memory Register Banks Timers, Counters, Peripherals 4/1/2003 Co Montiel 8
5 Differences: Embedded OS o Harvard Architecture is Common o Code in ROM, Data in RAM o Limited Memory Resource Allocation o File System is Limited or Non-Existent o Different Storage Media: Magnetic Media is Rare Solid State Media Common Flash Memory is NOT Like Disk 4/1/2003 Co Montiel 9 RTOS Alternatives o >70% of Embedded Developers Don t Use an RTOS Why? o Disadvantages of Commercial RTOS: Cost, Complexity, Efficiency Issues Customization Req d, Latency, Overhead o Embedded Environment Differences Memory Sizes, Types Cost, Volume, Risks 4/1/2003 Co Montiel 10
6 RTOS Task State Diagram 4/1/2003 Co Montiel 11 uc/os State Diagram 4/1/2003 Co Montiel 12
7 Synchronization & Communication o Synchronizing Tasks Semaphores Waiting for Event or Time o Inter-Task Communication Mailbox (Pointer) Circular Queue or Buffer 4/1/2003 Co Montiel 13 What is IPC? o IPC: Inter-Process Communications o Also works for Inter-Task Communications. o A safe method for passing data, messages, and/or events between tasks. o Multiple Processor IPC is a special case. 4/1/2003 Co Montiel 14
8 Why IPC? o Embedded systems are event driven. o IPC supports this model by allowing tasks to block on the IPC method. o Tasks can be independently developed. Higher reliability by reducing dependencies. 4/1/2003 Co Montiel 15 Why not IPC? o 1 task. o Very simple architecture. o Performance requirements. 4/1/2003 Co Montiel 16
9 Methods of IPC o Queues o Mailboxes o Signals/Events/Semaphores o Shared Memory 4/1/2003 Co Montiel 17 Queues o Typically implemented as a ring buffer. o Message is copied into and out of the queue buffer. o Disadvantages: Moving the data twice. May consume more memory than other methods. o Advantages: Data is protected. 4/1/2003 Co Montiel 18
10 Queues o Implementation Dependant Features: Writer may block if queue is full. Reader may block if queue is empty. There can be multiple readers/writers. Messages may be fixed or variable length. FIFO, maybe with priority. 4/1/2003 Co Montiel 19 Queues o Sample APIs: CreateQueue( QControlBlock, Name, StartAddress, Size, <Fixed/Var>, <MsgLen> ); WriteQueue( QControlBlock, Msg, Size, Suspend ); ReadQueue( QControlBlock, Msg, Size, ActualSize, Suspend ); 4/1/2003 Co Montiel 20
11 Mailboxes o Essentially a fixed size queue with element size equal to size of pointer. o Disadvantages: Data is not protected. Data must remain in scope. Not clear when data has been consumed. o Advantages: Faster than queues. More efficient than queues. If data fits in place of pointer, then this is a queue. 4/1/2003 Co Montiel 21 Mailboxes o Implementation Dependant Features: Subset of queues features. o Sample APIs: CreateMBox( MBoxControl, Name ); WriteMBox( MBoxControl, Msg, Suspend ); ReadMBox( MBoxControl, Msg, Suspend ); 4/1/2003 Co Montiel 22
12 Signals/Events/Semaphores o Used as an IPC mechanism, semaphores: Allow for synchronization between tasks. Allow ISR and task to communicate. HEY! Data is ready! o Disadvantages: Minimal amount of data (1 bit). Overhead slower than shared variable. o Advantages: Task can block on semaphore. Controlled IPC mechanism (vs. shared variable). 4/1/2003 Co Montiel 23 Signals/Events/Semaphores o Implementation Dependant Features: Event groups: collection of semaphores which can be logically combined to form truth table : Resume task when Ev1 && Ev3 &&!Ev4. 4/1/2003 Co Montiel 24
13 Semaphores o MUST have Indivisible Test and Set One atomic operation Test & Set o May Also Be Multi-Valued Useful for Multiple Shared Resources -63 to for uc/os o Mutually Exclusive Access to a Shared Resource: a.k.a. Mutex 4/1/2003 Co Montiel 25 Semaphore vs. Mutex o Mutex: Binary Semaphore Two states: available or busy o Semaphore: Binary (Mutex) or > 2 states (counting): counting semaphore -- increment or decrement example: sharing "n" resources or devices sempaphore = number of available resources 4/1/2003 Co Montiel 26
14 Example: getsemaphore() bit getsemaphore( uint8 *semaphore ) { bit result = 0; // Assume failure. bit oldea = EA; // Save current state. EA = 0; // Disable interrupts. if ( *semaphore > 0 ) // Any resources avail? { *semaphore = *semaphore - 1; // Grab one. result = 1; // Good to go. } EA = oldea; // Restore interrupts. // NOTE: Could give up processor if we didn t // get the semaphore. return result; } 4/1/2003 Co Montiel 27 Example in Assembly Acquire_Semaphore: ; Acquire semaphore ; Returns with A=1 if success, ; A=0 if failure to acquire semaphore. mov a,#1 ; Assume we got it. jbc sema4_bit, got_sema ; Atomic Test & Clr. clr a ; Failed to acquire. got_sema: ret Release_Sempahore: ; Release semaphore. setb sema4_bit ; Restore flag. ret 4/1/2003 Co Montiel 28
15 Shared Memory o Can always use shared memory for all the previously mentioned IPC mechanisms. o Disadvantages: Not thread-safe, unless hardware lock available. No controls to prevent misunderstandings. o Advantages: Fast. No RTOS overhead. Ring Buffer can be thread safe with one producer and one consumer. 4/1/2003 Co Montiel 29 Task Scheduling o Scheduler Allocates CPU Time o Determines Which Task to Run Next Context Switch uc/os uses: Priority Based, number 0-63 High Priority (0) Supercedes Low Priority (63) High Priority Tasks can Interrupt Low Ones o Overhead: Time Wasted, Not Spent on Task 4/1/2003 Co Montiel 30
16 Schedulers o There are basically two types of scheduling schemes in use today: Priority Round-robin o This is not to be confused with preemption (a.k.a time-slicing) and non-preemption (or cooperative) multi-tasking. o Schedulers can implement multiple combinations of the above methods. 4/1/2003 Co Montiel 31 uc/os Priorities o 64 Priorities o One Unique priority for each task o Lower number = higher priority o Example priorities used by sample firmware for a TCP/IP stack and server applications: MAIN_PRIO 50 HTTP 45 PPP 44 TCP 40 IP 39 Ethernet Send 38 4/1/2003 Co Montiel 32
17 Task Priorities and Blocking o Task priorities must be chosen carefully o If you create a high priority task that never blocks, lower priority tasks will never run o For example, task A has a priority of 50 and constantly polls an peripheral status register. Task B is assigned a priority of 51 and is used for a serial command interface. In this case, Task B will never run. 4/1/2003 Co Montiel 33 Kernels o The Kernel is responsible for task management and communication between tasks. o Kernels can be Preemptive or Nonpreemptive o The Scheduler is a part of the Kernel. 4/1/2003 Co Montiel 34
18 Round-Robin Scheduling o Basically, tasks run in a pre-defined order. o For example: Say you have 3 tasks (T1, T2, T3). Their execution order is T1, T2, then T3. Whenever T1 releases the CPU (a different story), if T2 is ready to run it will be allowed to run. After T2 is done, T3 will run (assuming it is ready). After T3 is done, T1 will get to run again. 4/1/2003 Co Montiel 35 Priority Scheduling o Each task is given a priority. o Higher priority tasks run before lower priority tasks. o For example: Say T1 has highest priority and T3 lowest. T2 is running. T1 and T3 are ready at the same time. T1 will be allowed to run. 4/1/2003 Co Montiel 36
19 Non-Preemptive Kernel o Each task must specifically do something to give up control of the CPU o Also called cooperative-multitasking o ISR s interrupt tasks, but do not immediately determine which task will run upon completion o Simpler to implement than pre-emptive. o Critical section easier to design away. 4/1/2003 Co Montiel 37 Non-Preemptive Example From uc/os-ii page 43 4/1/2003 Co Montiel 38
20 Preemptive Kernel o Used for Real-Time applications o Highest priority task always runs o A task switch will occur when: A task makes a higher priority task ready to run. An ISR completes o More complicated to implement o Critical section issue more pronounced. 4/1/2003 Co Montiel 39 Preemptive Example From uc/os-ii page 44 4/1/2003 Co Montiel 40
21 Re-entrant Code o Code that can be interrupted, and called again one or more times, before completing execution. Must use only local resources (i.e.variables) Cannot modify global resources Compiler libraries are often non re-entrant Most OS functions are non re-entrant Code that uses dedicated hardware is not 4/1/2003 Co Montiel 41 Common RTOS Problems o Task Stack Size o Stack Overflow o Scheduling Issues o Preemptive Task Priority o Getting Stuck... 4/1/2003 Co Montiel 42
22 Deadlock o Circular dependency between tasks and resources o Task1 takes MutexA, waits on MutexB o Task2 takes MutexB, waits on MutexA o DEADLOCK: Waiting for an event which will never occur. o Only way to end is reboot. 4/1/2003 Co Montiel 43 Deadlock Example Task A Resource1 Task B Resource2 = Has Acquired = Is Requesting 4/1/2003 Co Montiel 44
23 Determinism o A system is guaranteed to behave in a predictable way. o Priority inversion can make the system unpredictable: A low priority tasks behaves like a high priority task. 4/1/2003 Co Montiel 45 Priority Inversion o Higher priority task blocks, waiting for a lower priority task. o OK thus the reason for mutexes. o 3 rd task comes along and can run. o This affects determinism. o Very bad for hard real-time systems. 4/1/2003 Co Montiel 46
24 Priority Inversion Example High Priority Med Priority Low Priority t0 t1 t2 t3 t4 t5 t6 t7 = task blocked = priority inversion 4/1/2003 Co Montiel 47 Priority Inheritance task + PI High Priority Med Priority Low Priority t0 t1 t2 t3 t4 t5 t6 = task blocked = Priority inheritance active 4/1/2003 Co Montiel 48
25 Additional Reading o This is the discussion of the Mars Pathfinder mission. Very interesting reading. 4/1/2003 Co Montiel 49 A Critical View o Commercial RTOS: any co-operative? o May not be due to technical reasons: Co-operative schedulers easier to make. Co-operative schedulers are portable. Pre-emptive RTOS much larger and more complex (uc/os: ~3000 vs. Pont: ~300) This may make them unsuitable for inhouse development. 4/1/2003 Co Montiel 50
26 RTOS Strategic Issues o License Fees, Development Costs o Learning Curve is Non-Trivial o Long Term RTOS Vendor Stability o Lack of Visibility and Control o Availability of Source Code o Upgrades, Support, Obsolescence o Development of Internal RTOS 4/1/2003 Co Montiel 51 Summary o OS Concepts o Resource Sharing / Allocation o Use only the elements needed. o For simplest situations, shared memory may be best approach. o Variety of IPC mechanisms exist: Queues, Mailboxes, Signals/Events/Semaphores 4/1/2003 Co Montiel 52
Tasks. 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 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 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 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 informationOperating Systems. Lecture 4 - Concurrency and Synchronization. Master of Computer Science PUF - Hồ Chí Minh 2016/2017
Operating Systems Lecture 4 - Concurrency and Synchronization Adrien Krähenbühl Master of Computer Science PUF - Hồ Chí Minh 2016/2017 Mutual exclusion Hardware solutions Semaphores IPC: Message passing
More informationMicrium µc/os II RTOS Introduction EE J. E. Lumpp
Micrium µc/os II RTOS Introduction (by Jean Labrosse) EE599 001 Fall 2012 J. E. Lumpp μc/os II μc/os II is a highly portable, ROMable, very scalable, preemptive real time, deterministic, multitasking kernel
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 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 informationConcurrency: Deadlock and Starvation
Concurrency: Deadlock and Starvation Chapter 6 E&CE 354: Processes 1 Deadlock Deadlock = situation in which every process from a set is permanently blocked, i.e. cannot proceed with execution Common cause:
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 informationModule 1. Introduction:
Module 1 Introduction: Operating system is the most fundamental of all the system programs. It is a layer of software on top of the hardware which constitutes the system and manages all parts of the system.
More informationIntroduction to Embedded Systems. Lab Logistics
Introduction to Embedded Systems CS/ECE 6780/5780 Al Davis Today s topics: lab logistics interrupt synchronization reentrant code 1 CS 5780 Lab Logistics Lab2 Status Wed: 3/11 teams have completed their
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 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 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 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 informationPreemptive Scheduling
Preemptive Scheduling Lecture 18 18-1 Big Picture Methods learned so far We ve been using a foreground/background system Interrupt service routines run in foreground Task code runs in background Limitations
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 informationInterprocess Communication By: Kaushik Vaghani
Interprocess Communication By: Kaushik Vaghani Background Race Condition: A situation where several processes access and manipulate the same data concurrently and the outcome of execution depends on the
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 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 informationProcess Coordination and Shared Data
Process Coordination and Shared Data Lecture 19 In These Notes... Sharing data safely When multiple threads/processes interact in a system, new species of bugs arise 1. Compiler tries to save time by not
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 informationCommercial Real-time Operating Systems An Introduction. Swaminathan Sivasubramanian Dependable Computing & Networking Laboratory
Commercial Real-time Operating Systems An Introduction Swaminathan Sivasubramanian Dependable Computing & Networking Laboratory swamis@iastate.edu Outline Introduction RTOS Issues and functionalities LynxOS
More informationR13 SET - 1 2. Answering the question in Part-A is compulsory 1 a) Define Operating System. List out the objectives of an operating system. [3M] b) Describe different attributes of the process. [4M] c)
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 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 informationProcess Synchronization: Semaphores. CSSE 332 Operating Systems Rose-Hulman Institute of Technology
Process Synchronization: Semaphores CSSE 332 Operating Systems Rose-Hulman Institute of Technology Critical-section problem solution 1. Mutual Exclusion - If process Pi is executing in its critical section,
More informationVirtual Machine Design
Virtual Machine Design Lecture 4: Multithreading and Synchronization Antero Taivalsaari September 2003 Session #2026: J2MEPlatform, Connected Limited Device Configuration (CLDC) Lecture Goals Give an overview
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 informationOperating Systems Design Fall 2010 Exam 1 Review. Paul Krzyzanowski
Operating Systems Design Fall 2010 Exam 1 Review Paul Krzyzanowski pxk@cs.rutgers.edu 1 Question 1 To a programmer, a system call looks just like a function call. Explain the difference in the underlying
More informationThe components in the middle are core and the components on the outside are optional.
CHAPTER 2 ucosiii Page 1 ENGG4420 CHAPTER 3 LECTURE 8 October 31 12 9:43 AM MQX BASICS MQX Real Time Operating System has been designed for uni processor, multi processor, and distributedprocessor embedded
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 informationSystemy RT i embedded Wykład 11 Systemy RTOS
Systemy RT i embedded Wykład 11 Systemy RTOS Wrocław 2013 Plan Introduction Tasks Queues Interrupts Resources Memory management Multiprocessor operation Introduction What s an Operating System? Provides
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 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 informationMultitasking / Multithreading system Supports multiple tasks
Tasks and Intertask Communication Introduction Multitasking / Multithreading system Supports multiple tasks As we ve noted Important job in multitasking system Exchanging data between tasks Synchronizing
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 informationReal-time Support in Operating Systems
Real-time Support in Operating Systems Colin Perkins teaching/2003-2004/rtes4/lecture11.pdf Lecture Outline Overview of the rest of the module Real-time support in operating systems Overview of concepts
More informationEfficiency and memory footprint of Xilkernel for the Microblaze soft processor
Efficiency and memory footprint of Xilkernel for the Microblaze soft processor Dariusz Caban, Institute of Informatics, Gliwice, Poland - June 18, 2014 The use of a real-time multitasking kernel simplifies
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 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 informationCSE 153 Design of Operating Systems
CSE 153 Design of Operating Systems Winter 2018 Midterm Review Midterm in class on Monday Covers material through scheduling and deadlock Based upon lecture material and modules of the book indicated on
More informationImplementing Scheduling Algorithms. Real-Time and Embedded Systems (M) Lecture 9
Implementing Scheduling Algorithms Real-Time and Embedded Systems (M) Lecture 9 Lecture Outline Implementing real time systems Key concepts and constraints System architectures: Cyclic executive Microkernel
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 informationSYNCHRONIZATION M O D E R N O P E R A T I N G S Y S T E M S R E A D 2. 3 E X C E P T A N D S P R I N G 2018
SYNCHRONIZATION M O D E R N O P E R A T I N G S Y S T E M S R E A D 2. 3 E X C E P T 2. 3. 8 A N D 2. 3. 1 0 S P R I N G 2018 INTER-PROCESS COMMUNICATION 1. How a process pass information to another process
More informationBack to RTOS. CSE466 Autumn 00-1
Back to RTOS Scheduling Deadline Laxity Rate Monotonic Shared Code in Multiprocessing Share Resources: Deadlock avoidance Process Synchronization and Communication Memory Management CSE466 Autumn 00-1
More informationIn examining performance Interested in several things Exact times if computable Bounded times if exact not computable Can be measured
System Performance Analysis Introduction Performance Means many things to many people Important in any design Critical in real time systems 1 ns can mean the difference between system Doing job expected
More informationProcess & Thread Management II. Queues. Sleep() and Sleep Queues CIS 657
Process & Thread Management II CIS 657 Queues Run queues: hold threads ready to execute Not a single ready queue; 64 queues All threads in same queue are treated as same priority Sleep queues: hold threads
More informationProcess & Thread Management II CIS 657
Process & Thread Management II CIS 657 Queues Run queues: hold threads ready to execute Not a single ready queue; 64 queues All threads in same queue are treated as same priority Sleep queues: hold threads
More informatione-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Interrupt Handling Module No: CS/ES/13 Quadrant 1 e-text
e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Interrupt Handling Module No: CS/ES/13 Quadrant 1 e-text 1. Interrupt An interrupt is the occurrence of a condition--an event --
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 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 informationOperating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst
Operating Systems CMPSCI 377 Spring 2017 Mark Corner University of Massachusetts Amherst Last Class: Intro to OS An operating system is the interface between the user and the architecture. User-level Applications
More informationOperating Systems Antonio Vivace revision 4 Licensed under GPLv3
Operating Systems Antonio Vivace - 2016 revision 4 Licensed under GPLv3 Process Synchronization Background A cooperating process can share directly a logical address space (code, data) or share data through
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 informationDeadlock. Concurrency: Deadlock and Starvation. Reusable Resources
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 No efficient solution Involve conflicting
More informationMaximum CPU utilization obtained with multiprogramming. CPU I/O Burst Cycle Process execution consists of a cycle of CPU execution and I/O wait
Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Thread Scheduling Operating Systems Examples Java Thread Scheduling Algorithm Evaluation CPU
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 informationReal Time Operating System: Inter-Process Communication (IPC)
ECE3411 Fall 2015 Lecture 6c. Real Time Operating System: Inter-Process Communication (IPC) Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut
More informationChapter 6 Concurrency: Deadlock and Starvation
Operating Systems: Internals and Design Principles Chapter 6 Concurrency: Deadlock and Starvation Seventh Edition By William Stallings Operating Systems: Internals and Design Principles When two trains
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 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 informationModule 6: Process Synchronization. Operating System Concepts with Java 8 th Edition
Module 6: Process Synchronization 6.1 Silberschatz, Galvin and Gagne 2009 Module 6: Process Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Semaphores
More informationGLOSSARY. VisualDSP++ Kernel (VDK) User s Guide B-1
B GLOSSARY Application Programming Interface (API) A library of C/C++ functions and assembly macros that define VDK services. These services are essential for kernel-based application programs. The services
More informationCS-537: Midterm Exam (Spring 2001)
CS-537: Midterm Exam (Spring 2001) Please Read All Questions Carefully! There are seven (7) total numbered pages Name: 1 Grading Page Points Total Possible Part I: Short Answers (12 5) 60 Part II: Long
More informationREAL TIME OPERATING SYSTEM PROGRAMMING-I: VxWorks
REAL TIME OPERATING SYSTEM PROGRAMMING-I: I: µc/os-ii and VxWorks Lesson-1: RTOSes 1 1. Kernel of an RTOS 2 Kernel of an RTOS Used for real-time programming features to meet hard and soft real time constraints,
More informationTechno India Batanagar Department of Computer Science & Engineering. Model Questions. Multiple Choice Questions:
Techno India Batanagar Department of Computer Science & Engineering Model Questions Subject Name: Operating System Multiple Choice Questions: Subject Code: CS603 1) Shell is the exclusive feature of a)
More informationIntroduction to OS Synchronization MOS 2.3
Introduction to OS Synchronization MOS 2.3 Mahmoud El-Gayyar elgayyar@ci.suez.edu.eg Mahmoud El-Gayyar / Introduction to OS 1 Challenge How can we help processes synchronize with each other? E.g., how
More informationREAL TIME OPERATING SYSTEMS: A COMPLETE OVERVIEW
REAL TIME OPERATING SYSTEMS: A COMPLETE OVERVIEW Mrinal Parikshit Chandane Former Assistant Professor, Dept. of E&TC, KJSCE, (India) ABSTRACT Telecommunication applications such as telephony, navigation
More informationCS 31: Intro to Systems Misc. Threading. Kevin Webb Swarthmore College December 6, 2018
CS 31: Intro to Systems Misc. Threading Kevin Webb Swarthmore College December 6, 2018 Classic thread patterns Agenda Pthreads primitives and examples of other forms of synchronization: Condition variables
More informationEmbedded System Curriculum
Embedded System Curriculum ADVANCED C PROGRAMMING AND DATA STRUCTURE (Duration: 25 hrs) Introduction to 'C' Objectives of C, Applications of C, Relational and logical operators, Bit wise operators, The
More informationProcesses. CS 475, Spring 2018 Concurrent & Distributed Systems
Processes CS 475, Spring 2018 Concurrent & Distributed Systems Review: Abstractions 2 Review: Concurrency & Parallelism 4 different things: T1 T2 T3 T4 Concurrency: (1 processor) Time T1 T2 T3 T4 T1 T1
More informationEmbedded Operating Systems
Embedded Operating Systems Embedded Software Design 熊博安國立中正大學資訊工程研究所 pahsiung@cs.ccu.edu.tw Textbook: Programming Embedded Systems in C and C++, Michael Barr, O Reilly 1 Contents History and Purpose A
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 informationNuttX Realtime Programming
NuttX RTOS NuttX Realtime Programming Gregory Nutt Overview Interrupts Cooperative Scheduling Tasks Work Queues Realtime Schedulers Real Time == == Deterministic Response Latency Stimulus Response Deadline
More informationThe Kernel Abstraction
The Kernel Abstraction Debugging as Engineering Much of your time in this course will be spent debugging In industry, 50% of software dev is debugging Even more for kernel development How do you reduce
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 informationOPERATING SYSTEM CONCEPTS UNDERSTAND!!! IMPLEMENT!!! ANALYZE!!!
OPERATING SYSTEM CONCEPTS UNDERSTAND!!! IMPLEMENT!!! Processor Management Memory Management IO Management File Management Multiprogramming Protection and Security Network Management UNDERSTAND!!! IMPLEMENT!!!
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 informationCSE 120. Fall Lecture 8: Scheduling and Deadlock. Keith Marzullo
CSE 120 Principles of Operating Systems Fall 2007 Lecture 8: Scheduling and Deadlock Keith Marzullo Aministrivia Homework 2 due now Next lecture: midterm review Next Tuesday: midterm 2 Scheduling Overview
More informationProcess- Concept &Process Scheduling OPERATING SYSTEMS
OPERATING SYSTEMS Prescribed Text Book Operating System Principles, Seventh Edition By Abraham Silberschatz, Peter Baer Galvin and Greg Gagne PROCESS MANAGEMENT Current day computer systems allow multiple
More informationPlease do not handin a.doc file, a.zip file, a.tar file, or anything else
Please do not handin a.doc file, a.zip file, a.tar file, or anything else Hand in the files that are requested and only the files that are requested No executables! Lecture on Thurs is canceled Shuying
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 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 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 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 informationREAL-TIME MULTITASKING KERNEL FOR IBM-BASED MICROCOMPUTERS
Malaysian Journal of Computer Science, Vol. 9 No. 1, June 1996, pp. 12-17 REAL-TIME MULTITASKING KERNEL FOR IBM-BASED MICROCOMPUTERS Mohammed Samaka School of Computer Science Universiti Sains Malaysia
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 informationMicrokernel/OS and Real-Time Scheduling
Chapter 12 Microkernel/OS and Real-Time Scheduling Hongwei Zhang http://www.cs.wayne.edu/~hzhang/ Ack.: this lecture is prepared in part based on slides of Lee, Sangiovanni-Vincentelli, Seshia. Outline
More informationProcess Management And Synchronization
Process Management And Synchronization In a single processor multiprogramming system the processor switches between the various jobs until to finish the execution of all jobs. These jobs will share the
More informationInterrupts Peter Rounce - room 6.18
Interrupts Peter Rounce - room 6.18 P.Rounce@cs.ucl.ac.uk 20/11/2006 1001 Interrupts 1 INTERRUPTS An interrupt is a signal to the CPU from hardware external to the CPU that indicates than some event has
More informationSMD149 - Operating Systems
SMD149 - Operating Systems Roland Parviainen November 3, 2005 1 / 45 Outline Overview 2 / 45 Process (tasks) are necessary for concurrency Instance of a program in execution Next invocation of the program
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 informationLast 2 Classes: Introduction to Operating Systems & C++ tutorial. Today: OS and Computer Architecture
Last 2 Classes: Introduction to Operating Systems & C++ tutorial User apps OS Virtual machine interface hardware physical machine interface An operating system is the interface between the user and the
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 5 Concurrency: Mutual Exclusion and Synchronization
Operating Systems: Internals and Design Principles Chapter 5 Concurrency: Mutual Exclusion and Synchronization Seventh Edition By William Stallings Designing correct routines for controlling concurrent
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 informationSample Questions. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic)
Sample Questions Amir H. Payberah amir@sics.se Amirkabir University of Technology (Tehran Polytechnic) Amir H. Payberah (Tehran Polytechnic) Sample Questions 1393/8/10 1 / 29 Question 1 Suppose a thread
More information