Computer Science & Engineering Electrical Engineering

Slides:



Advertisements
Similar presentations
Chapter 7 - Resource Access Protocols (Critical Sections) Protocols: No Preemptions During Critical Sections Once a job enters a critical section, it cannot.
Advertisements

Operating Systems Part III: Process Management (Process Synchronization)
1 Chapter 5 Concurrency: Mutual Exclusion and Synchronization Principals of Concurrency Mutual Exclusion: Hardware Support Semaphores Readers/Writers Problem.
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Resource management and Synchronization Akos Ledeczi EECE 354, Fall 2010 Vanderbilt University.
Chapter 6: Process Synchronization
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 6: Process Synchronization.
Secure Operating Systems Lesson 5: Shared Objects.
Operating Systems CMPSC 473 Mutual Exclusion Lecture 13: October 12, 2010 Instructor: Bhuvan Urgaonkar.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
1 Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Concurrency: Mutual Exclusion, Synchronization, Deadlock, and Starvation in Representative Operating Systems.
CPSC 4650 Operating Systems Chapter 6 Deadlock and Starvation
Chapter 2.3 : Interprocess Communication
Semaphores CSCI 444/544 Operating Systems Fall 2008.
1 Concurrency: Deadlock and Starvation Chapter 6.
Operating Systems CSE 411 CPU Management Oct Lecture 13 Instructor: Bhuvan Urgaonkar.
Concurrency: Deadlock and Starvation Chapter 6. Goal and approach Deadlock and starvation Underlying principles Solutions? –Prevention –Detection –Avoidance.
1 Concurrency: Deadlock and Starvation Chapter 6.
Cosc 4740 Chapter 6, Part 3 Process Synchronization.
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Cpr E 308 Spring 2004 Real-time Scheduling Provide time guarantees Upper bound on response times –Programmer’s job! –Every level of the system Soft versus.
1 Announcements The fixing the bug part of Lab 4’s assignment 2 is now considered extra credit. Comments for the code should be on the parts you wrote.
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
1 Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
Kernel Locking Techniques by Robert Love presented by Scott Price.
Chapter 6 – Process Synchronisation (Pgs 225 – 267)
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
ECE291 Computer Engineering II Lecture 15 Dr. Zbigniew Kalbarczyk University of Illinois at Urbana- Champaign.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
Tasks and Task Management : --Time-critical tasks --Contending tasks --Communicating tasks.
CSE 153 Design of Operating Systems Winter 2015 Midterm Review.
CS 241 Section Week #7 (10/22/09). Topics This Section  Midterm Statistics  MP5 Forward  Classical Synchronization Problems  Problems.
6.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Module 6: Process Synchronization.
1 5-High-Performance Embedded Systems using Concurrent Process (cont.)
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 5: Process Synchronization.
Mutual Exclusion -- Addendum. Mutual Exclusion in Critical Sections.
Transmitter Interrupts Review of Receiver Interrupts How to Handle Transmitter Interrupts? Critical Regions Text: Tanenbaum
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.
6.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles 6.5 Semaphore Less complicated than the hardware-based solutions Semaphore S – integer.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
Deadlock and Starvation
Interprocess Communication Race Conditions
Operating systems Deadlocks.
Topics Covered What is Real Time Operating System (RTOS)
Background on the need for Synchronization
Process Synchronization
Deadlock and Starvation
EEE 6494 Embedded Systems Design
HW1 and Synchronization & Queuing
Inter-Process Communication and Synchronization
Concurrency: Mutual Exclusion and Synchronization
Midterm review: closed book multiple choice chapters 1 to 9
Semaphore Originally called P() and V() wait (S) { while S <= 0
Process Synchronization
COMS Prelim 1 Review Session
Operating systems Deadlocks.
Transmitter Interrupts
Lecture 2 Part 2 Process Synchronization
Realtime System Fundamentals
Computer Science & Engineering Electrical Engineering
Concurrency: Mutual Exclusion and Process Synchronization
EE 472 – Embedded Systems Dr. Shwetak Patel.
Realtime System Fundamentals
Chapter 7: Synchronization Examples
CSE 153 Design of Operating Systems Winter 2019
CSE 153 Design of Operating Systems Winter 2019
CSE 542: Operating Systems
CSE 542: Operating Systems
Presentation transcript:

Computer Science & Engineering Electrical Engineering EE 472 – Embedded Systems Dr. Shwetak Patel Assistant Professor Computer Science & Engineering Electrical Engineering

Agenda Critical regions Semaphores Lab 3 questions Midterms results 2 Shwetak N. Patel - EE 472

Mars Pathfinder 1997

Multitasking Need to share resources Think about the data in Lab 2

Sharing Global variables Shared buffers Producer / Consumer model

Buffers Single buffer Multiple buffers

Intertask Communication Messages Mailbox

Critical Sections Only one task can access a shared resource A short segment of code that cannot be preempted

Critical Sections What are ways to address the concurrency problem?

Critical Sections Ways to address this Don’t use a preemptive scheduler Mask interrupts Use protection code Flags Semaphores

Semaphores A type of flagging scheme Used to protect critical sections Atomic operation Have two operations: Wait(s) or Pend(s) or P(s) Signal(s) or Post(s) or V(s)

Semaphores Also used for synchronization

Semaphores Task can relinquish control until blocking is over Task is put in a waiting queue

Semaphores – Pros/Cons Easy to use and implement One semaphore per resource (reduce blocking) Drawback: Can cause priority inversion

Priority Inversion Hard to debug and detect Prevention techniques Priority inheritance

Deadlock Two or more processes wait indefinitely

Deadlock Prevention Conditions for deadlock (all 4 have to hold) Mutual exclusion No preemption Hold and wait Circular wait

Class Exercise Task1 1 X Task2 2 Task3 3 Task4 4 Task5 5 Task6 6 X Priority Resources R1 R2 R3 Task1 1 X Task2 2 Task3 3 Task4 4 Task5 5 Task6 6 X

Class Exercise How many semaphore are needed? 2 Where do you see priority inversion problems? Tasks 1,2,3 (R2)

Class Exercise Task1 1 X Task2 2 Task3 3 Task4 4 Task5 5 Task6 6 X Priority Resources R1 R2 R3 Task1 1 X Task2 2 Task3 3 Task4 4 Task5 5 Task6 6 X

Class Exercise How many semaphore are needed? 3 Where do you see priority inversion problems? Tasks 1,2,3 (R1) and 1,2,3 (R2) and 1,2,4 (R1) Do you see any other problems? Potential deadlock between Tasks 1 and 3

Class Exercise Task 1 1. Initialize digital I/O port for input 2. Read digital input 3. Count rising edges on each input Task 2 1. Read Data from serial port 1 2. Check for errors in serial data 3. if data buffer is empty {write data payload to buffer} Task 3 1. Initialize digital I/O port to output 2. write data to digital outputs 3. toggle bit 0 of digital I/O port on and off (i.e. make a brief pulse on bit 0). Task 4 1. if data buffer is full {take data from buffer} 2. Write data to serial port 2 Task 5 1. Count number of bytes in data buffer 2. display byte count on LCD

Class Exercise What resources are being shared? Do you see critical sections? Which tasks? Where in each task?

Class Exercise What resources are being shared? IO and the buffer Do you see a critical sections? Yes Which tasks and what resources? 1 - io,2 - buffer,3 - io, 4 – buffer, 5 - buffer Where in each task?

Questions? Shwetak N. Patel - EE 472