SlideShare una empresa de Scribd logo
1 de 54
Real-time Software Design
Objectives ,[object Object],[object Object],[object Object],[object Object]
Topics covered ,[object Object],[object Object],[object Object],[object Object]
Real-time systems ,[object Object],[object Object],[object Object],[object Object],[object Object]
Definition ,[object Object],[object Object],[object Object]
Stimulus/Response Systems ,[object Object],[object Object],[object Object],[object Object],[object Object]
Architectural considerations ,[object Object],[object Object],[object Object]
A real-time system model
Sensor/actuator processes
System elements ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Real-time programming
Real-time programming ,[object Object],[object Object]
Java as a real-time language ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
System design ,[object Object],[object Object],[object Object]
R-T systems design process ,[object Object],[object Object],[object Object]
R-T systems design process ,[object Object],[object Object],[object Object]
Timing constraints ,[object Object],[object Object],[object Object]
Real-time system modelling ,[object Object],[object Object],[object Object],[object Object],[object Object]
Petrol pump state model
Real-time operating systems ,[object Object],[object Object],[object Object],[object Object],14
Operating system components ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Non-stop system components ,[object Object],[object Object],[object Object],[object Object]
Real-time OS components
Process priority ,[object Object],[object Object],[object Object],[object Object]
Interrupt servicing ,[object Object],[object Object],[object Object],[object Object]
Periodic process servicing ,[object Object],[object Object],[object Object]
Process management ,[object Object],[object Object],[object Object],[object Object],[object Object]
RTE process management
Process switching ,[object Object],[object Object],[object Object]
Scheduling strategies ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Monitoring and control systems ,[object Object],[object Object],[object Object],[object Object]
Generic architecture
Burglar alarm system ,[object Object],[object Object],[object Object]
Burglar alarm system ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The R-T system design process ,[object Object],[object Object],[object Object],[object Object],[object Object]
Stimuli to be processed ,[object Object],[object Object],[object Object],[object Object]
Timing requirements
Burglar alarm system processes
Building_monitor process 1  class BuildingMonitor extends Thread { BuildingSensor win, door, move ; Siren  siren = new Siren () ; Lights  lights = new Lights () ; Synthesizer synthesizer = new Synthesizer () ; DoorSensors doors = new DoorSensors (30) ; WindowSensors  windows = new WindowSensors (50) ; MovementSensors movements = new MovementSensors (200) ; PowerMonitor pm = new PowerMonitor () ; BuildingMonitor()  { // initialise all the sensors and start the processes siren.start () ; lights.start () ; synthesizer.start () ; windows.start () ; doors.start () ; movements.start () ; pm.start () ; }
Building monitor process 2 public void run ()  { int room = 0 ; while (true) { // poll the movement sensors at least twice per second (400 Hz) move = movements.getVal () ; // poll the window sensors at least twice/second (100 Hz) win = windows.getVal () ; // poll the door sensors at least twice per second (60 Hz) door = doors.getVal () ; if (move.sensorVal == 1 | door.sensorVal == 1 | win.sensorVal == 1) { // a sensor has indicated an intruder  if (move.sensorVal == 1)  room = move.room ; if (door.sensorVal == 1)  room = door.room ; if (win.sensorVal == 1 )  room = win.room ; lights.on (room) ; siren.on () ; synthesizer.on (room) ; break ; } }
Building_monitor process 3  lights.shutdown () ; siren.shutdown () ; synthesizer.shutdown () ; windows.shutdown () ; doors.shutdown () ; movements.shutdown () ; } // run } //BuildingMonitor
Control systems ,[object Object],[object Object],[object Object]
A temperature control system
Data acquisition systems ,[object Object],[object Object],[object Object],[object Object]
Data acquisition architecture
Reactor data collection ,[object Object],[object Object],[object Object]
Reactor flux monitoring
A ring buffer
Mutual exclusion ,[object Object],[object Object],[object Object]
Ring buffer implementation 1 class CircularBuffer  { int bufsize ; SensorRecord [] store ; int numberOfEntries = 0 ; int front = 0, back = 0 ; CircularBuffer (int n) { bufsize = n ; store = new SensorRecord [bufsize] ; } // CircularBuffer
Ring buffer implementation 2 synchronized void put (SensorRecord rec )  throws InterruptedException  { if ( numberOfEntries == bufsize) wait () ; store [back] = new SensorRecord (rec.sensorId, rec.sensorVal) ; back = back + 1 ; if (back == bufsize) back = 0 ; numberOfEntries = numberOfEntries + 1 ; notify () ; } // put
Ring buffer implementation 3 synchronized SensorRecord get () throws InterruptedException  { SensorRecord result = new SensorRecord (-1, -1) ; if (numberOfEntries == 0) wait () ; result = store [front] ; front = front + 1 ; if (front == bufsize) front = 0 ; numberOfEntries = numberOfEntries - 1 ; notify () ; return result ; } // get } // CircularBuffer
Key points ,[object Object],[object Object],[object Object]
Key points ,[object Object],[object Object],[object Object]

Más contenido relacionado

La actualidad más candente

REAL TIME OPERATING SYSTEM
REAL TIME OPERATING SYSTEMREAL TIME OPERATING SYSTEM
REAL TIME OPERATING SYSTEM
prakrutijsh
 
[White paper] detecting problems in industrial networks though continuous mon...
[White paper] detecting problems in industrial networks though continuous mon...[White paper] detecting problems in industrial networks though continuous mon...
[White paper] detecting problems in industrial networks though continuous mon...
TI Safe
 
Fault tolerant real-time scheduling
Fault tolerant real-time schedulingFault tolerant real-time scheduling
Fault tolerant real-time scheduling
Reza Ramezani
 

La actualidad más candente (20)

Rtos By Avanish Agarwal
Rtos By Avanish AgarwalRtos By Avanish Agarwal
Rtos By Avanish Agarwal
 
Process scheduling
Process schedulingProcess scheduling
Process scheduling
 
Operating System Scheduling
Operating System SchedulingOperating System Scheduling
Operating System Scheduling
 
Realtime systems chapter 1
Realtime systems chapter 1Realtime systems chapter 1
Realtime systems chapter 1
 
Real Time Systems
Real Time SystemsReal Time Systems
Real Time Systems
 
Unit 4 Real Time Operating System
Unit 4 Real Time Operating SystemUnit 4 Real Time Operating System
Unit 4 Real Time Operating System
 
Process scheduling
Process schedulingProcess scheduling
Process scheduling
 
Computer System Scheduling
Computer System SchedulingComputer System Scheduling
Computer System Scheduling
 
REAL TIME OPERATING SYSTEM
REAL TIME OPERATING SYSTEMREAL TIME OPERATING SYSTEM
REAL TIME OPERATING SYSTEM
 
Fault tolerance techniques for real time operating system
Fault tolerance techniques for real time operating systemFault tolerance techniques for real time operating system
Fault tolerance techniques for real time operating system
 
Concurrent process
Concurrent processConcurrent process
Concurrent process
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.
 
[White paper] detecting problems in industrial networks though continuous mon...
[White paper] detecting problems in industrial networks though continuous mon...[White paper] detecting problems in industrial networks though continuous mon...
[White paper] detecting problems in industrial networks though continuous mon...
 
Architectural patterns for real-time systems
Architectural patterns for real-time systemsArchitectural patterns for real-time systems
Architectural patterns for real-time systems
 
Operating System
Operating SystemOperating System
Operating System
 
Real time operating systems (rtos) concepts 1
Real time operating systems (rtos) concepts 1Real time operating systems (rtos) concepts 1
Real time operating systems (rtos) concepts 1
 
Fault tolerant real-time scheduling
Fault tolerant real-time schedulingFault tolerant real-time scheduling
Fault tolerant real-time scheduling
 
Embedded Intro India05
Embedded Intro India05Embedded Intro India05
Embedded Intro India05
 
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT V Real Time Operating System (RTOS)
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT V  Real Time Operating System (RTOS)SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT V  Real Time Operating System (RTOS)
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT V Real Time Operating System (RTOS)
 
Reliability and clock synchronization
Reliability and clock synchronizationReliability and clock synchronization
Reliability and clock synchronization
 

Similar a Ch15

Real Time Software Design in Software Engineering SE13
Real Time Software Design in Software Engineering SE13Real Time Software Design in Software Engineering SE13
Real Time Software Design in Software Engineering SE13
koolkampus
 
Ch20-Software Engineering 9
Ch20-Software Engineering 9Ch20-Software Engineering 9
Ch20-Software Engineering 9
Ian Sommerville
 
Real time os(suga)
Real time os(suga) Real time os(suga)
Real time os(suga)
Nagarajan
 
There are many operating systemsReal-Time Operating SystemReal-t.pdf
There are many operating systemsReal-Time Operating SystemReal-t.pdfThere are many operating systemsReal-Time Operating SystemReal-t.pdf
There are many operating systemsReal-Time Operating SystemReal-t.pdf
ankitmobileshop235
 
EMBEDDED SYSTEMS 1
EMBEDDED SYSTEMS 1EMBEDDED SYSTEMS 1
EMBEDDED SYSTEMS 1
PRADEEP
 
What is operating system
What is operating systemWhat is operating system
What is operating system
vmahesmca
 

Similar a Ch15 (20)

Real Time Software Design in Software Engineering SE13
Real Time Software Design in Software Engineering SE13Real Time Software Design in Software Engineering SE13
Real Time Software Design in Software Engineering SE13
 
Ch20-Software Engineering 9
Ch20-Software Engineering 9Ch20-Software Engineering 9
Ch20-Software Engineering 9
 
Real time os(suga)
Real time os(suga) Real time os(suga)
Real time os(suga)
 
There are many operating systemsReal-Time Operating SystemReal-t.pdf
There are many operating systemsReal-Time Operating SystemReal-t.pdfThere are many operating systemsReal-Time Operating SystemReal-t.pdf
There are many operating systemsReal-Time Operating SystemReal-t.pdf
 
EMBEDDED SYSTEMS 1
EMBEDDED SYSTEMS 1EMBEDDED SYSTEMS 1
EMBEDDED SYSTEMS 1
 
Embedded system software
Embedded system softwareEmbedded system software
Embedded system software
 
Real time operating system Concept
Real time operating system ConceptReal time operating system Concept
Real time operating system Concept
 
Operating system
Operating systemOperating system
Operating system
 
Survey of Real Time Scheduling Algorithms
Survey of Real Time Scheduling AlgorithmsSurvey of Real Time Scheduling Algorithms
Survey of Real Time Scheduling Algorithms
 
Operating system Concepts
Operating system Concepts Operating system Concepts
Operating system Concepts
 
What is operating system
What is operating systemWhat is operating system
What is operating system
 
What is operating system
What is operating systemWhat is operating system
What is operating system
 
Ch24 system administration
Ch24 system administration Ch24 system administration
Ch24 system administration
 
Ch24
Ch24Ch24
Ch24
 
Operating System.pptx
Operating System.pptxOperating System.pptx
Operating System.pptx
 
Rtos Concepts
Rtos ConceptsRtos Concepts
Rtos Concepts
 
Real timedata
Real timedataReal timedata
Real timedata
 
Real time operating system
Real time operating systemReal time operating system
Real time operating system
 
Real Time Operating Systems for Embedded Systems
Real Time Operating Systems for Embedded SystemsReal Time Operating Systems for Embedded Systems
Real Time Operating Systems for Embedded Systems
 
Understanding Basics of OS
Understanding Basics of OSUnderstanding Basics of OS
Understanding Basics of OS
 

Más de phanleson

Lecture 1 - Getting to know XML
Lecture 1 - Getting to know XMLLecture 1 - Getting to know XML
Lecture 1 - Getting to know XML
phanleson
 

Más de phanleson (20)

Learning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with SparkLearning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with Spark
 
Firewall - Network Defense in Depth Firewalls
Firewall - Network Defense in Depth FirewallsFirewall - Network Defense in Depth Firewalls
Firewall - Network Defense in Depth Firewalls
 
Mobile Security - Wireless hacking
Mobile Security - Wireless hackingMobile Security - Wireless hacking
Mobile Security - Wireless hacking
 
Authentication in wireless - Security in Wireless Protocols
Authentication in wireless - Security in Wireless ProtocolsAuthentication in wireless - Security in Wireless Protocols
Authentication in wireless - Security in Wireless Protocols
 
E-Commerce Security - Application attacks - Server Attacks
E-Commerce Security - Application attacks - Server AttacksE-Commerce Security - Application attacks - Server Attacks
E-Commerce Security - Application attacks - Server Attacks
 
Hacking web applications
Hacking web applicationsHacking web applications
Hacking web applications
 
HBase In Action - Chapter 04: HBase table design
HBase In Action - Chapter 04: HBase table designHBase In Action - Chapter 04: HBase table design
HBase In Action - Chapter 04: HBase table design
 
HBase In Action - Chapter 10 - Operations
HBase In Action - Chapter 10 - OperationsHBase In Action - Chapter 10 - Operations
HBase In Action - Chapter 10 - Operations
 
Hbase in action - Chapter 09: Deploying HBase
Hbase in action - Chapter 09: Deploying HBaseHbase in action - Chapter 09: Deploying HBase
Hbase in action - Chapter 09: Deploying HBase
 
Learning spark ch11 - Machine Learning with MLlib
Learning spark ch11 - Machine Learning with MLlibLearning spark ch11 - Machine Learning with MLlib
Learning spark ch11 - Machine Learning with MLlib
 
Learning spark ch10 - Spark Streaming
Learning spark ch10 - Spark StreamingLearning spark ch10 - Spark Streaming
Learning spark ch10 - Spark Streaming
 
Learning spark ch09 - Spark SQL
Learning spark ch09 - Spark SQLLearning spark ch09 - Spark SQL
Learning spark ch09 - Spark SQL
 
Learning spark ch07 - Running on a Cluster
Learning spark ch07 - Running on a ClusterLearning spark ch07 - Running on a Cluster
Learning spark ch07 - Running on a Cluster
 
Learning spark ch06 - Advanced Spark Programming
Learning spark ch06 - Advanced Spark ProgrammingLearning spark ch06 - Advanced Spark Programming
Learning spark ch06 - Advanced Spark Programming
 
Learning spark ch05 - Loading and Saving Your Data
Learning spark ch05 - Loading and Saving Your DataLearning spark ch05 - Loading and Saving Your Data
Learning spark ch05 - Loading and Saving Your Data
 
Learning spark ch04 - Working with Key/Value Pairs
Learning spark ch04 - Working with Key/Value PairsLearning spark ch04 - Working with Key/Value Pairs
Learning spark ch04 - Working with Key/Value Pairs
 
Learning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with SparkLearning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with Spark
 
Hướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about Libertagia
Hướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about LibertagiaHướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about Libertagia
Hướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about Libertagia
 
Lecture 1 - Getting to know XML
Lecture 1 - Getting to know XMLLecture 1 - Getting to know XML
Lecture 1 - Getting to know XML
 
Lecture 4 - Adding XTHML for the Web
Lecture  4 - Adding XTHML for the WebLecture  4 - Adding XTHML for the Web
Lecture 4 - Adding XTHML for the Web
 

Último

Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
amitlee9823
 
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Anamikakaur10
 
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
amitlee9823
 
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Sheetaleventcompany
 
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
daisycvs
 

Último (20)

Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
Uneak White's Personal Brand Exploration Presentation
Uneak White's Personal Brand Exploration PresentationUneak White's Personal Brand Exploration Presentation
Uneak White's Personal Brand Exploration Presentation
 
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
 
Malegaon Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort Service
Malegaon Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort ServiceMalegaon Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort Service
Malegaon Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort Service
 
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesMysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
 
SEO Case Study: How I Increased SEO Traffic & Ranking by 50-60% in 6 Months
SEO Case Study: How I Increased SEO Traffic & Ranking by 50-60%  in 6 MonthsSEO Case Study: How I Increased SEO Traffic & Ranking by 50-60%  in 6 Months
SEO Case Study: How I Increased SEO Traffic & Ranking by 50-60% in 6 Months
 
Cracking the Cultural Competence Code.pptx
Cracking the Cultural Competence Code.pptxCracking the Cultural Competence Code.pptx
Cracking the Cultural Competence Code.pptx
 
Marel Q1 2024 Investor Presentation from May 8, 2024
Marel Q1 2024 Investor Presentation from May 8, 2024Marel Q1 2024 Investor Presentation from May 8, 2024
Marel Q1 2024 Investor Presentation from May 8, 2024
 
Business Model Canvas (BMC)- A new venture concept
Business Model Canvas (BMC)-  A new venture conceptBusiness Model Canvas (BMC)-  A new venture concept
Business Model Canvas (BMC)- A new venture concept
 
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
 
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
 
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdfDr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
 
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
 
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
 
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
 
Falcon Invoice Discounting platform in india
Falcon Invoice Discounting platform in indiaFalcon Invoice Discounting platform in india
Falcon Invoice Discounting platform in india
 
(Anamika) VIP Call Girls Napur Call Now 8617697112 Napur Escorts 24x7
(Anamika) VIP Call Girls Napur Call Now 8617697112 Napur Escorts 24x7(Anamika) VIP Call Girls Napur Call Now 8617697112 Napur Escorts 24x7
(Anamika) VIP Call Girls Napur Call Now 8617697112 Napur Escorts 24x7
 
Falcon's Invoice Discounting: Your Path to Prosperity
Falcon's Invoice Discounting: Your Path to ProsperityFalcon's Invoice Discounting: Your Path to Prosperity
Falcon's Invoice Discounting: Your Path to Prosperity
 
Organizational Transformation Lead with Culture
Organizational Transformation Lead with CultureOrganizational Transformation Lead with Culture
Organizational Transformation Lead with Culture
 
Famous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st CenturyFamous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st Century
 

Ch15

  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 10.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 20.
  • 21.
  • 22.
  • 24.
  • 25.
  • 26.
  • 27.
  • 29.
  • 30.
  • 31.
  • 33.
  • 34.
  • 35.
  • 36.
  • 38. Burglar alarm system processes
  • 39. Building_monitor process 1 class BuildingMonitor extends Thread { BuildingSensor win, door, move ; Siren siren = new Siren () ; Lights lights = new Lights () ; Synthesizer synthesizer = new Synthesizer () ; DoorSensors doors = new DoorSensors (30) ; WindowSensors windows = new WindowSensors (50) ; MovementSensors movements = new MovementSensors (200) ; PowerMonitor pm = new PowerMonitor () ; BuildingMonitor() { // initialise all the sensors and start the processes siren.start () ; lights.start () ; synthesizer.start () ; windows.start () ; doors.start () ; movements.start () ; pm.start () ; }
  • 40. Building monitor process 2 public void run () { int room = 0 ; while (true) { // poll the movement sensors at least twice per second (400 Hz) move = movements.getVal () ; // poll the window sensors at least twice/second (100 Hz) win = windows.getVal () ; // poll the door sensors at least twice per second (60 Hz) door = doors.getVal () ; if (move.sensorVal == 1 | door.sensorVal == 1 | win.sensorVal == 1) { // a sensor has indicated an intruder if (move.sensorVal == 1) room = move.room ; if (door.sensorVal == 1) room = door.room ; if (win.sensorVal == 1 ) room = win.room ; lights.on (room) ; siren.on () ; synthesizer.on (room) ; break ; } }
  • 41. Building_monitor process 3 lights.shutdown () ; siren.shutdown () ; synthesizer.shutdown () ; windows.shutdown () ; doors.shutdown () ; movements.shutdown () ; } // run } //BuildingMonitor
  • 42.
  • 44.
  • 46.
  • 49.
  • 50. Ring buffer implementation 1 class CircularBuffer { int bufsize ; SensorRecord [] store ; int numberOfEntries = 0 ; int front = 0, back = 0 ; CircularBuffer (int n) { bufsize = n ; store = new SensorRecord [bufsize] ; } // CircularBuffer
  • 51. Ring buffer implementation 2 synchronized void put (SensorRecord rec ) throws InterruptedException { if ( numberOfEntries == bufsize) wait () ; store [back] = new SensorRecord (rec.sensorId, rec.sensorVal) ; back = back + 1 ; if (back == bufsize) back = 0 ; numberOfEntries = numberOfEntries + 1 ; notify () ; } // put
  • 52. Ring buffer implementation 3 synchronized SensorRecord get () throws InterruptedException { SensorRecord result = new SensorRecord (-1, -1) ; if (numberOfEntries == 0) wait () ; result = store [front] ; front = front + 1 ; if (front == bufsize) front = 0 ; numberOfEntries = numberOfEntries - 1 ; notify () ; return result ; } // get } // CircularBuffer
  • 53.
  • 54.