אביב תשס"ה JCTתיכון תוכנה: ד"ר ראובן גלנט1 פרק 9 נקודות חשובות בתרגיל 10 Guarded Operation.

Slides:



Advertisements
Similar presentations

Advertisements

Operating Systems Mehdi Naghavi Winter 1385.
Global Environment Model. MUTUAL EXCLUSION PROBLEM The operations used by processes to access to common resources (critical sections) must be mutually.
תוכנה 1 סמסטר א ' תשע " ב תרגול מס ' 7 * מנשקים, דיאגרמות וביטים * לא בהכרח בסדר הזה.
PIC16F bit 8-channel Analog-to-Digital Converter.
Rhapsody in C++ Tool Training "Essential" © I-Logix v3.0 1/29/2001 Adv-1 Section 4 Advanced Mutexes.
אביב תשס " ה JCT תיכון תוכנה ד " ר ר ' גלנט / י ' לויאןכל הזכויות שמורות 1 פרק 10 Packages.
5.6 Semaphores Semaphores –Software construct that can be used to enforce mutual exclusion –Contains a protected variable Can be accessed only via wait.
אביב תשס"ה JCTתיכון תוכנה: ד"ר ראובן גלנט1 פרק 8 נקודות חשובות בתרגילים 7-9.
אביב תשס " ה JCT תיכון תוכנה ד " ר ר ' גלנט / י ' לויאןכל הזכויות שמורות 1 תיכון מערכות תוכנה להנדסה ופיתוח פרוייקט אישי Software Design.
The Rhapsody in C++ Tool Training "Essential" © I-Logix v2.3 25/9/2000 Adv-1 Essential Rhapsody in C++ Section 4 Advanced Level Modified.
Rhapsody in C++ Tool Training "Essential" © I-Logix v3.0 1/29/2001 Adv-1 Section 4 Advanced Level Concurrency.
אביב תשס " ה JCT תיכון תוכנה ד " ר ר ' גלנט / י ' לויאןכל הזכויות שמורות 1 פרק 13 Case Study: Weather Station.
5.6.2 Thread Synchronization with Semaphores Semaphores can be used to notify other threads that events have occurred –Producer-consumer relationship Producer.
אביב תשס " ה JCT תיכון תוכנה ד " ר ר ' גלנט / י ' לויאןכל הזכויות שמורות 1 פרק 6 DIP דוגמאות נוספות.
אביב תשס " ה JCT תיכון תוכנה ד " ר ר ' גלנט / י ' לויאןכל הזכויות שמורות 1 פרק 4 LSP.
CS 3013 & CS 502 Summer 2006 Week 1 Review and Class Discussion 1 Review (last week) Three important terms Abstraction Concurrency Resource Critical Sections.
Rhapsody in C++ Tool Training "Essential" © I-Logix v3.0 1/29/2001 Int-1 Section 3 Intermediate Inherited Sensor.
אביב תשס " ה JCT תיכון תוכנה ד " ר ר ' גלנט / י ' לויאןכל הזכויות שמורות 1 פרק 11 Statecharts תכונות מתקדמות.
אביב תשס " ה JCT תיכון תוכנה ד " ר ר ' גלנט / י ' לויאןכל הזכויות שמורות 1 פרק 12 אינטרקציה בין statecharts של אובייקטים שונים דוגמא : Dishwasher.
Molly, Gwyn, Sam, and Eric.  Configure DACs to have their digital input set to zero (2.5V) when they receive power  Ramp up to higher voltage at a “user.
ALL TERRAIN ROBOT 1 Wilmer Arellano © The Client’s Need Lecture is licensed under a Creative Commons Attribution 2.0 License.
© I-Logix Rhapsody C++ V /01/2004 E1-1 Exercise 3 : Dishwasher.
Rhapsody in C++ Tool Training "Essential" © I-Logix v3.0 1/29/2001 Adv-1 Essential Rhapsody in C++ Section 4 Advanced Level.
אביב תשס " ה JCT תיכון תוכנה ד " ר ר ' גלנט / י ' לויאןכל הזכורות שמורות 1 פרק 3 OCP.
Concurrency - 1 Tasking Concurrent Programming Declaration, creation, activation, termination Synchronization and communication Time and delays conditional.
1 Chapter 5 Concurrency. 2 Concurrency 3 4 Mutual Exclusion: Hardware Support Test and Set Instruction boolean testset (int *i) { if (*i == 0) { *i.
אביב תשס " ה JCT תיכון תוכנה ד " ר ר ' גלנט / י ' לויאןכל הזכויות שמורות 1 פרק 7 ISP דוגמא נוספת.
More Multithreaded Programming in Java David Meredith Aalborg University.
10/04/2011CS4961 CS4961 Parallel Programming Lecture 12: Advanced Synchronization (Pthreads) Mary Hall October 4, 2011.
Monitor  Giving credit where it is due:  The lecture notes are borrowed from Dr. I-Ling Yen at University of Texas at Dallas  I have modified them and.
Object Oriented Analysis & Design SDL Threads. Contents 2  Processes  Thread Concepts  Creating threads  Critical sections  Synchronizing threads.
Atomic Operations David Monismith cs550 Operating Systems.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Mutual Exclusion.
The Rhapsody in C++ Tool Training "Essential" © I-Logix v2.3 25/9/2000 Adv-1 Essential Rhapsody in C++ Section 4 Advanced Level.
Semaphores, Locks and Monitors By Samah Ibrahim And Dena Missak.
ICS 145B -- L. Bic1 Project: Process/Thread Synchronization Textbook: pages ICS 145B L. Bic.
CS345 Operating Systems Threads Assignment 3. Process vs. Thread process: an address space with 1 or more threads executing within that address space,
EEE527 Embedded Systems Lecture 10B:Chapter 11 Analogue to Digital Convertors (ADCs) (version 2: 25/11/13, see after slide 20 Ian McCrumRoom 5B18, Tel:
® 7-2 Semaphores 7.1Overview Binary Semaphores and Synchronization Mutual Exclusion.
Lecture 8 Page 1 CS 111 Online Other Important Synchronization Primitives Semaphores Mutexes Monitors.
IT 325 Operating systems Chapter6.  Threads can greatly simplify writing elegant and efficient programs.  However, there are problems when multiple.
Today’s Agenda  HW #2 Out  Replay Semaphore and Lock  Advanced Locking Advanced Topics in Software Engineering 1.
ROBOTIC ARM 2 Wilmer Arellano © Hardware  Next slide shows sensor connection to analog pin 0 and Motor 1 connection. Lecture is licensed under.
Analog to Digital Converter (ADC). Analog to Digital Converters  Microcontroller understands only digital language.  To convert the analog output from.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles Synchronization Emery Berger and Mark Corner University.
Concurrency in Shared Memory Systems Synchronization and Mutual Exclusion.
System Level Block Diagram P16318 Lianna Dicke. P16318: Gaseous Mass Flow Rate Controller Level 1 Functional Block Diagram 1.0 System Processing 2.0 Mechanical.
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
Vex Robotics program three: using motors and sensors together.
Working with Pthreads. Operations on Threads int pthread_create (pthread_t *thread, const pthread_attr_t *attr, void * (*routine)(void*), void* arg) Creates.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Mutual Exclusion Mutexes, Semaphores.
1 Introduction to Engineering Spring 2007 Lecture 19: Digital Tools 3.
אביב תשס " ה JCT תיכון תוכנה ד " ר ר ' גלנט / י ' לויאןכל הזכויות שמורות 1 פרק 5 תרשימי מצבים Statecharts למחלקות תגובתיות Reactive Classes הקדמה ודוגמא.
Auburn University COMP 3500 Introduction to Operating Systems Project 3 – Synchronization Cats and Mice: Implementation.
C++ Lesson 1.
Outline Other synchronization primitives
COEN346 Tutorial Monitor Objects.
Other Important Synchronization Primitives
Atomicity CS 2110 – Fall 2017.
Indexer AKEEL AHMED.
Atomicity in Multithreaded Software
Stack Memory 2 (also called Call Stack)
searching Concept: Linear search Binary search
Topics: Programming Constructs: loops & conditionals Digital Input
UNIVERSITY of WISCONSIN-MADISON Computer Sciences Department
Global Environment Model
Assignment 6 Recitation
CSE 153 Design of Operating Systems Winter 19
Pipes One-way channel joining two processes
Presentation transcript:

אביב תשס"ה JCTתיכון תוכנה: ד"ר ראובן גלנט1 פרק 9 נקודות חשובות בתרגיל 10 Guarded Operation

אביב תשס"ה JCTתיכון תוכנה: ד"ר ראובן גלנט2 מבנה הפרויקט

אביב תשס"ה JCTתיכון תוכנה: ד"ר ראובן גלנט3 הבטים שונים (OMD1) ארכיטקטורה של המערכת-מחלקות

אביב תשס"ה JCTתיכון תוכנה: ד"ר ראובן גלנט4 הבטים שונים (OMD 2) מבנה של Composite חשוב

אביב תשס"ה JCTתיכון תוכנה: ד"ר ראובן גלנט5 הבטים שונים (OMD 3) בניית המערכת

אביב תשס"ה JCTתיכון תוכנה: ד"ר ראובן גלנט6 הבטים שונים (OMD 4) מבנה Packages בלי מחלקות

אביב תשס"ה JCTתיכון תוכנה: ד"ר ראובן גלנט7 הבטים שונים (OMD 5) מבנה Packages עם מחלקות

אביב תשס"ה JCTתיכון תוכנה: ד"ר ראובן גלנט8 בניית מערכת (1): >

אביב תשס"ה JCTתיכון תוכנה: ד"ר ראובן גלנט9 בניית מערכת (2): Sys מחלקה המיועדת רק לבנות יתר המופעים Sys::Sys() { Adc::getInstance();}

אביב תשס"ה JCTתיכון תוכנה: ד"ר ראובן גלנט10 בניית מערכת (3): Sensor שילוב בין singleton ל association Sensor::Sensor() {itsAdc = Adc::getInstance();}

אביב תשס"ה JCTתיכון תוכנה: ד"ר ראובן גלנט11 התנהגות של המערכת: Statecharts

אביב תשס"ה JCTתיכון תוכנה: ד"ר ראובן גלנט12 פעולות read() של מחלקות Sensor enum eChannel { VOLTAGE, TEMPERATURE, PRESSURE, CALIBRATION }; int TemperatureSensor::read() { int n; n = itsAdc->read ( TEMPERATURE ); n *= 5; return n; } int PressureSensor::read() {return( 10 * itsAdc->read( PRESSURE ));} int VoltageSensor::read() { int n = itsAdc->read( VOLTAGE ); n *= 3; n /= 2; return n; }

אביב תשס"ה JCTתיכון תוכנה: ד"ר ראובן גלנט13 פעולות read() של מחלקת Adc (1)

אביב תשס"ה JCTתיכון תוכנה: ד"ר ראובן גלנט14 פעולות read() של מחלקת Adc (2) //file Adc.h class Adc { public: int value;... //etc. } //file Adc.cpp int Adc::read(echannel aChannel) { int i,n; itsMux.select( aChannel ); for ( i=0,n=0; i<8; i++ ) { if ( itsDataIn.isHigh() ) n = ( n << 1 ) + 1; else n = ( n << 1 ) ; } value = n; return n; } //file Mux.h class Mux { private: eChannel channel;... //etc. } //file Mux.cpp void Mux::select (eChannel aChannel) {channel=aChannel;} //file DataIn.cpp bool DataIn::isHigh() { return ( rand() % 2 == 0{;( bool DataIn::isLow() { return (!isHigh());}

אביב תשס"ה JCTתיכון תוכנה: ד"ר ראובן גלנט15 Guarded Operation- Mutexs Rhapsody provides OMProtected which is a mutex (or binary semaphore) for protecting consecutive access to devices. OMProtected can be used as follows: –attribute OMProtected myMutex; –free myMutex.free(); –lock myMutex.lock();

אביב תשס"ה JCTתיכון תוכנה: ד"ר ראובן גלנט16 Unguarded Access to Adc::read() In the following example, each Sensor calls the Adc::read() operation to measure Voltage / Temperature or Pressure. The read operation selects the appropriate multiplexor input and does eight serial reads on DataIn.

אביב תשס"ה JCTתיכון תוכנה: ד"ר ראובן גלנט17 Unguarded Behavior Current read() operation is interrupted by another.

אביב תשס"ה JCTתיכון תוכנה: ד"ר ראובן גלנט18 Guarding Operations Rhapsody can use the mutex OMProtected to guard access to a particular operation to stop concurrent access. This can be done by setting the property concurrency from sequential to guarded. All operations in a same class, that are guarded will be guarded by the same mutex.

אביב תשס"ה JCTתיכון תוכנה: ד"ר ראובן גלנט19 Guarded Behavior Concurrent read() operation is blocked by mutex and is executed when current read() ends.

אביב תשס"ה JCTתיכון תוכנה: ד"ר ראובן גלנט20 Guarded Operation : Code