Presentation is loading. Please wait.

Presentation is loading. Please wait.

Slide design: Dr. Mark L. Hornick

Similar presentations


Presentation on theme: "Slide design: Dr. Mark L. Hornick"— Presentation transcript:

1 Slide design: Dr. Mark L. Hornick
SE3910 5/7/2019 SE3910 Week 9, Class 1 Week 9 Lab: Individual demos of working sub-modules Modules that will communicate should use those interfaces during the tests Today Quiz TBA ASAP: Reinstall IntelliJ if you still use it Monday: Class time -> Office Hours Full agenda: Return Exam Questions about lab due tomorrow in class? Threads: Locking on null object Threads: invokeLater Threads: The squares example Decorator Class Diagram More on Java IO Class diagrams Design Principles in the patterns we’ve seen so far Compare with alternatives Decorator vs. array approach suggested in class Non-decorator array – decorator can be added on without modifying the original hierarchy Decorator has “before-after” and possibly other combinatorial control that would be hard-coded in array [Show “screenshot” of discussion from class? Or just re-type?] Strategy vs. Decorator class diagrams side-by-side Structural difference (inheritance optional in Strategy pattern?) Decorator vs. “Strategy” array Perhaps next: Coding Starbuzz coffee (?) Add real patterns ArrayList – null-checking Java I/O: Students do coding examples SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder Dr. Josiah Yoder

2 Quiz topics Rate Monotonic Analysis CPU usage
SE3910 5/7/2019 Quiz topics Rate Monotonic Analysis CPU usage Happens-before, caching, reordering, and sequential consistency Short-answer questions Code analysis SE-2811 Dr.Yoder Dr. Josiah Yoder

3 Textbook references This material comes from TBA
SE3910 5/7/2019 Textbook references This material comes from TBA Chapter 4 of our custom text Chapter 3 of Laplante & Ovaska, Real-Time Systems Design and Analysis, 4th ed. Section 3.3: Mailboxes, Semaphores, Deadlocking.. SE-2811 Dr.Yoder Dr. Josiah Yoder

4 Predicting CPU usage τi – task i pi – period i (ms)
SE3910 5/7/2019 Predicting CPU usage τi – task i pi – period i (ms) ei – execution time (ms) ui -- %CPU used for task i SE-2811 Dr.Yoder Dr. Josiah Yoder

5 Predicting CPU usage (2)
SE3910 5/7/2019 Predicting CPU usage (2) ui = ei/pi U = 𝑖 𝑢 𝑖 SE-2811 Dr. Yoder Dr. Josiah Yoder

6 CS2852 5/7/2019 In-Class Exercise Calculation: What is the processor utilization for this problem? Based on RMA, what order will they execute and how will they execute? Hints: Draw release times, break up processing into multiple frames if needed. Skip calculation if time short SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling Dr. Yoder

7 Rate-Monotonic Example
CS2852 5/7/2019 Rate-Monotonic Example See example soln. in text. SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling Dr. Yoder

8 Simplifying Assumptions needed for RMS
SE3910 5/7/2019 Simplifying Assumptions needed for RMS All tasks in the task set considered are strictly periodic. The relative deadline of a task is equal to its period. All tasks are independent; there are no precedence constraints. No task has any nonpreemptible section, and the cost of preemption is negligible. Only processing requirements are significant; memory and I/O requirements are negligible. SE Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling Dr. Josiah Yoder

9 When is Rate Monotonic Guaranteed to work?
SE3910 5/7/2019 When is Rate Monotonic Guaranteed to work? For n tasks, RMA is guaranteed to meet all deadlines if 𝑈≤𝑛( 2 1 𝑛 −1) For a very large number of tasks (n approaching infinity), RMA is guaranteed to meet all deadlines if 𝑈≤ ln 2 ≈0.69 For many practical applications, RMA will work if 𝑈≤0.85 Dr. Josiah Yoder

10 Multithreading terminology
SE3910 5/7/2019 Multithreading terminology Semaphores Signals Monitors Mailboxes SE-2811 Dr.Yoder Dr. Josiah Yoder

11 Semaphores Provides: Acquire – obtain a lock on a resource
5/7/2019 Semaphores Provides: Acquire – obtain a lock on a resource Release – release a lock on a resource Can allow multiple locks up to some fixed amount – e.g. to count how many processes have requested to use a socket SE-2811 Dr.Yoder Dr. Josiah Yoder

12 Monitors A monitor is a section of code protected by a lock.
5/7/2019 Monitors A monitor is a section of code protected by a lock. e.g. the synchronize statement in Java e.g. can implement with semaphore e.g. lock/unlock semantics in C/C++ pthreads, etc. SE-2811 Dr.Yoder Dr. Josiah Yoder

13 Signals Essentially a message between different parts of a program
5/7/2019 Signals Essentially a message between different parts of a program Implemented in Java: notify/wait Can implement with semaphores: Start with semaphore locked To wait, try to lock on the semaphore To release, unlock the semaphore SE-2811 Dr.Yoder Dr. Josiah Yoder

14 Mailboxes A mailbox provides: send: Send a message to another thread
5/7/2019 Mailboxes A mailbox provides: send: Send a message to another thread receive: Get the message. Block until a message is ready Rather like TCP. SE-2811 Dr.Yoder Dr. Josiah Yoder

15 Consider this code: synchronized(this) { im = getImage(); q.put(im); }
synchronized(this) { im = q.get(im); display(im); } SE-2811 Dr.Yoder


Download ppt "Slide design: Dr. Mark L. Hornick"

Similar presentations


Ads by Google