Introduction to Medical Computing

Similar documents
Real-Time Systems 1. Basic Concepts

Syllabus Instructors:

EMBEDDED SYSTEMS INTRODUCTION

An Annotated Language

Outline. Introduction. 2 Proof of Correctness. 3 Final Notes. Precondition P 1 : Inputs include

CS 161 Computer Security

Hardware versus software

Reasoning about programs

Last time. Reasoning about programs. Coming up. Project Final Presentations. This Thursday, Nov 30: 4 th in-class exercise

Embedded Software Engineering

Embedded Systems. Octav Chipara. Thursday, September 13, 12

Local Verification of Global Invariants in

(Refer Slide Time: 00:18)

CS158 Section B Exam 1 Key

HARDWARE SOFTWARE CO-DESIGN

Program Verification. Aarti Gupta

Foundations, Reasoning About Algorithms, and Design By Contract CMPSC 122

Lecture 1 Contracts : Principles of Imperative Computation (Fall 2018) Frank Pfenning

Data & Procedure Reasoning about correctness

IN4343 Real-Time Systems

AXIOMS OF AN IMPERATIVE LANGUAGE PARTIAL CORRECTNESS WEAK AND STRONG CONDITIONS. THE AXIOM FOR nop

CITS5501 Software Testing and Quality Assurance Formal methods

Real-Time Garbage Collection Panel JTRES 2007

Lecture 1 Contracts. 1 A Mysterious Program : Principles of Imperative Computation (Spring 2018) Frank Pfenning

Real-time Support in Operating Systems

ECE 1161/2161 Embedded Computer System Design 2. Introduction. Wei Gao. Spring

Writing better code Loop invariants Correctness. John Edgar 2

ICS 180 Spring Embedded Systems. Introduction: What are Embedded Systems and what is so interesting about them?

Introduction to Real-time Systems. Advanced Operating Systems (M) Lecture 2

Algorithms in Systems Engineering ISE 172. Lecture 3. Dr. Ted Ralphs

Lesson 13: The Graph of a Linear Equation in Two Variables

Lectures 20, 21: Axiomatic Semantics

Specifications and Modeling

6. Hoare Logic and Weakest Preconditions

Correctness of specifications. Correctness. Correctness of specifications (2) Example of a Correctness Proof. Testing versus Correctness Proofs

CHAPTER 1: REAL TIME COMPUTER CONTROL

Classification of RTS. RTS Definitions. RTS Definitions

Chapter 3 (part 3) Describing Syntax and Semantics

Complexity, Induction, and Recurrence Relations. CSE 373 Help Session 4/7/2016

Operating Systems. Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000) alphapeeler.sf.net/pubkeys/pkey.htm

Verification of Parameterized Concurrent Programs By Modular Reasoning about Data and Control

More Complicated Recursion CMPSC 122

Spark verification features

4/6/2011. Informally, scheduling is. Informally, scheduling is. More precisely, Periodic and Aperiodic. Periodic Task. Periodic Task (Contd.

Lecture 10 Design by Contract

Lecture 5 - Axiomatic semantics

Analyze the obvious algorithm, 5 points Here is the most obvious algorithm for this problem: (LastLargerElement[A[1..n]:

Lecture Notes on Contracts

Overview. Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++ Performance, memory

RE for Embedded Systems - Part 1

introduction to Programming in C Department of Computer Science and Engineering Lecture No. #40 Recursion Linear Recursion

CS Lecture 19: Loop invariants

n Specifying what each method does q Specify it in a comment before method's header n Precondition q Caller obligation n Postcondition

Default arguments, documentation

Safety SPL/2010 SPL/20 1

Memory Safety (cont d) Software Security

Softwaretechnik. Program verification. Albert-Ludwigs-Universität Freiburg. June 28, Softwaretechnik June 28, / 24

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

Softwaretechnik. Program verification. Software Engineering Albert-Ludwigs-University Freiburg. June 30, 2011

CS510 \ Lecture Ariel Stolerman

Lecture Notes on Linear Search

Backward Reasoning: Rule for Assignment. Backward Reasoning: Rule for Sequence. Simple Example. Hoare Logic, continued Reasoning About Loops

Lecture 4 Searching Arrays

Software Security: Vulnerability Analysis

PLC Fundamentals. Module 1: Introduction to PLC. Academic Services Unit PREPARED BY. August 2011

Overview. Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++

Real-Time Systems and their Programming Languages

8051 Microcontroller memory Organization and its Applications

Consumer Vehicle Interface Design and Assessment. Paul Green

Teaching KS3 Computing. Session 7 Theory: How computers work Practical: Building on programming skills

Lecture 1: Overview

Outline. Petri nets. Introduction Examples Properties Analysis techniques. 1 EE249Fall04

Half full or half empty? William Gropp Mathematics and Computer Science

CS 101 Randomness. Lecture 21

Introduction to Concurrency (Processes, Threads, Interrupts, etc.)

Real Time Operating Systems and Middleware

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Microcontrollers and Embedded Processors Module No: CS/ES/2 Quadrant 1 e-text

Hoare Logic and Model Checking

Algorithms 1 / 24. Algorithms Sequential Search

PROGRAMMING IN HASKELL. CS Chapter 6 - Recursive Functions

Review of distracted driving factors. George Yannis, Associate Professor, NTUA

To illustrate what is intended the following are three write ups by students. Diagonalization

P1 Engineering Computation

Learning Outcomes. Scheduling. Is scheduling important? What is Scheduling? Application Behaviour. Is scheduling important?

Hoare Logic and Model Checking. A proof system for Separation logic. Introduction. Separation Logic

Unit #3: Recursion, Induction, and Loop Invariants

Introduction. Definition. What is an embedded system? What are embedded systems? Challenges in embedded computing system design. Design methodologies.

Modules and Representation Invariants

AXIOMS FOR THE INTEGERS

A - 1. CS 494 Object-Oriented Analysis & Design. UML Class Models. Overview. Class Model Perspectives (cont d) Developing Class Models

Supervised Learning with Neural Networks. We now look at how an agent might learn to solve a general problem by seeing examples.

Them Threads, Them Threads, Them Useless Threads

Areas related to SW verif. Trends in Software Validation. Your Expertise. Research Trends High level. Research Trends - Ex 2. Research Trends Ex 1

Programming Language Abstractions for Modularly Verified Distributed Systems. James R. Wilcox Zach Tatlock Ilya Sergey

You should get the following:

"Secure" Coding Practices Nicholas Weaver

Thread Synchronization: Foundations. Properties. Safety properties. Edsger s perspective. Nothing bad happens

Lectures 24 and 25: Scheduling; Introduction to Effects

Design of Embedded Systems

Part II. Hoare Logic and Program Verification. Why specify programs? Specification and Verification. Code Verification. Why verify programs?

Transcription:

CS 2125 Introduction to Medical Computing Stephen M. Watt

Embedded Software Embedded software is computer software that makes a device perform its function without presenting it as a general purpose computer.

Examples o MP3 player o Digital camera o The braking system in a car o GPS navigation device o Flight control o Cable box o DVD player o Printer o Mobile phone o Video game console o Microwave oven o CT imaging device o Blood pressure monitor o Defibrillator o Pacemaker

What is in Common Don t think of it as a computer No screen/keyboard/mouse Take input signals from sensors/buttons/etc Gives output signals/actuators/switches/etc Often controls something Real-time response needed Need to be able to turn on/off/reset Reliability is essential

Some Resources http://en.wikipedia.org/wiki/embedded_system http://en.wikipedia.org/wiki/medical_software http://ptolemy.eecs.berkeley.edu/publications/papers/02/embsoft/ embsoftwre.pdf

Key Ideas Concurrency Real time response Correctness

Concurrency Processors, Processes, Threads. Process state. Context switching. Pre-emptive vs non-pre-emptive scheduling.

Real-Time Response Real-time response does not just mean fast response. It means the response is predictable and guaranteed to be within certain limits. This means that the worst-case execution time can be proven to always be within the required limit. E.g. anti-lock braking system must control the brakes before the car slides off the road.

Consequences of R-T constraints All libraries used in a software system have to have real-time guarantees. Concurrency must be r-t aware, or controllable. Memory management usually done statically.

Hard RT vs Soft RT Property Hart RT Soft RT Response time Required Desired Peak-load performance Predictable Degraded Control of pace Environment Computer Safety Often critical Non-critical Size of data Small/medium Any Redunancy type Active Checkpoint-recovery Data integrity Short term Long term Error detection Autonomous User Assisted *Adapted from Real-Time Systems, Kanaka Juvva

Real-Time Scheduling *Adapted from Real-Time Systems, Kanaka Juvva http://www.ece.cmu.edu/~koopman/des_s99/real_time/

Correctness Want correct software No, really.

Correctness Really want correct software. Cannot have if (! isasexpected(v1)) { } fprintf(stderr, Error: unexpected value %d\n, v1); exit(exit_failure);

How to Achieve Correctness Correctness proofs. Prove: The program computes the right thing. Prove: No variables overflow, no division by zero, etc.

Proving Programs Correct Not just a convincing argument. Mathematical proof of some precise statement about the execution and computed quantities. Typically annotate program with assertions Prove that if the input conditions are met, then the assertions are true. Assertions may be pre-conditions, post-conditions or invariants.

Proving Programs Correct A change-making algorithm Pre-condition Post-condition * From Essays on Algorithm Analysis, F. D. Lewis http://cs.engr.uky.edu/~lewis/essays/analysis.pdf

Proving Programs Correct Pre-condition: what is true before a block Invariant: what is always true at this point (usually a loop invariant) Post-condition: what is true after a block Some programming langauges (e.g. Eiffel) have native support for these.

Inductive Assertions Flow Chart: diagramatic representation of program execution. Basic blocks have predecessors and successors. Assertions can be attached to the arrows. Start with validity of starting precondition as true and all assertions as unknown. Prove assertions based on validity of predecessor assertions.

Proving Programs Correct Break program into sequential parts with assertions inserted between. For loops, write a loop invariant that expresses the purpose of the loop. Write it so Inv(n) is true after n iterations of the loop. Show the pre-condition guarantees Inv(0) is true. (Basis step) Show that if Inv(k) is true and the loop test L is true, then Inv(k+1) is true. (Inductive step) Show that after the loop iterates the required number of times, the post-condition of the loop is guaranteed.

Proving Programs Correct An Introduction to Proving the Correctness of Programs, Sidney L. Hantler and James C. King, Computing Surveys, Vol 9, No 3, Sept 1976. Program correctness: on inductive assertion methods, J.C. King, IEEE Transactions on Software Engineering, Vol SE-6, Issue 5, pp 465-479.