E81 CSE 532S: Advanced Multi-Paradigm Software Development Chris Gill Department of Computer Science Washington University, St. Louis

Slides:



Advertisements
Similar presentations
E81 CSE 532S: Advanced Multi-Paradigm Software Development Chris Gill Department of Computer Science and Engineering Washington University in St. Louis.
Advertisements

©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
E81 CSE 532S: Advanced Multi-Paradigm Software Development Chris Gill Department of Computer Science and Engineering Washington University in St. Louis.
Java How to Program, 9/e CET 3640 Professor: Dr. José M. Reyes Álamo © Copyright by Pearson Education, Inc. All Rights Reserved.
Revisiting a slide from the syllabus: CS 525 will cover Parallel and distributed computing architectures – Shared memory processors – Distributed memory.
Introduction To System Analysis and Design
1 Concurrent and Distributed Systems Introduction 8 lectures on concurrency control in centralised systems - interaction of components in main memory -
Principles of Object-Oriented Software Development The language Java.
Demystifying Architectural Styles Nikunj Mehta 3/11/02Demystifying Architectural Styles2 Agenda Architectural Styles The Alfa Project Architectural framework.
Threads 1 CS502 Spring 2006 Threads CS-502 Spring 2006.
Demystifying Architectural Styles Nikunj Mehta 3/11/02Demystifying Architectural Styles2 Architectural Styles Characterize –Structure, i.e. external.
Software Issues Derived from Dr. Fawcett’s Slides Phil Pratt-Szeliga Fall 2009.
CS 3013 & CS 502 Summer 2006 Threads1 CS-3013 & CS-502 Summer 2006.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
Chapter 2 Architectural Models. Keywords Middleware Interface vs. implementation Client-server models OOP.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 18 Slide 1 Software Reuse.
E81 CSE 532S: Advanced Multi-Paradigm Software Development Chris Gill Department of Computer Science and Engineering Washington University, St. Louis
The Design Discipline.
OpenMP in a Heterogeneous World Ayodunni Aribuki Advisor: Dr. Barbara Chapman HPCTools Group University of Houston.
Introduction to Object-oriented programming and software development Lecture 1.
German National Research Center for Information Technology Research Institute for Computer Architecture and Software Technology German National Research.
Chapter 4: Threads. 4.2CSCI 380 Operating Systems Chapter 4: Threads Overview Multithreading Models Threading Issues Pthreads Windows XP Threads Linux.
An Introduction to Software Architecture
1 Problems & Potential Solutions ProblemsPotential Solutions Documenting patterns & pattern languages for DRE systems is hard because We’re not accustomed.
CSE 332: Design Patterns (Part I) Introduction to Design Patterns Design patterns were mentioned several times so far –And the Singleton Pattern was discussed.
Introduction to Threads CS240 Programming in C. Introduction to Threads A thread is a path execution By default, a C/C++ program has one thread called.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
Chapter 26 GoF Design Patterns. The Adapter Design Pattern.
Patterns in programming 1. What are patterns? “A design pattern is a general, reusable solution to a commonly occurring problem in software. A design.
Design Patterns. Patterns “Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution.
E81 CSE 532S: Advanced Multi-Paradigm Software Development Venkita Subramonian, Christopher Gill, Guandong Wang, Zhenning Hu, Zhenghui Xie Department of.
Proactor Pattern Venkita Subramonian & Christopher Gill
1 Confidential Enterprise Solutions Group Process and Threads.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Chapter 7 Software Engineering Introduction to CS 1 st Semester, 2015 Sanghyun Park.
E81 CSE 532S: Advanced Multi-Paradigm Software Development Chris Gill Department of Computer Science and Engineering Washington University in St. Louis.
Software Design Patterns (1) Introduction. patterns do … & do not … Patterns do... provide common vocabulary provide “shorthand” for effectively communicating.
CSE 432: Design Patterns Introduction What’s a Pattern? What’s an Idiom? According to Alexander, a pattern: –Describes a recurring problem –Describes the.
Information System Design (IT60105) Lecture 26 Object-Oriented System Testing.
University of Toronto at Scarborough © Kersti Wain-Bantin CSCC40 system architecture 1 after designing to meet functional requirements, design the system.
Behavioral Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
CSE 332: Design Patterns Review: Design Pattern Structure A design pattern has a name –So when someone says “Adapter” you know what they mean –So you can.
Architecture View Models A model is a complete, simplified description of a system from a particular perspective or viewpoint. There is no single view.
Testing OO software. State Based Testing State machine: implementation-independent specification (model) of the dynamic behaviour of the system State:
13-1 Chapter 13 Concurrency Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads C# Threads.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles Synchronization Emery Berger and Mark Corner University.
E81 CSE 532S: Advanced Multi-Paradigm Software Development Venkita Subramonian, Christopher Gill, Ying Huang, Marc Sentany Department of Computer Science.
What’s Ahead for Embedded Software? (Wed) Gilsoo Kim
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
OOD OO Design. OOD-2 OO Development Requirements Use case analysis OO Analysis –Models from the domain and application OO Design –Mapping of model.
E81 CSE 532S: Advanced Multi-Paradigm Software Development Venkita Subramonian, Christopher Gill, Huang-Ming Huang, Shih-Ling Chen, Sajeeva Pallemulle.
From Use Cases to Implementation 1. Structural and Behavioral Aspects of Collaborations  Two aspects of Collaborations Structural – specifies the static.
Duke CPS Programming Heuristics l Identify the aspects of your application that vary and separate them from what stays the same ä Take what varies.
E81 CSE 532S: Advanced Multi-Paradigm Software Development Chris Gill Department of Computer Science and Engineering Washington University in St. Louis.
Interrupts and Interrupt Handling David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO
A Vision for Integration of Embedded System Properties Via a Model-Component-Aspect System Architecture Christopher D. Gill Department.
From Use Cases to Implementation 1. Mapping Requirements Directly to Design and Code  For many, if not most, of our requirements it is relatively easy.
Benefits & Limitations of Patterns & Frameworks: Part 1 Douglas C. Schmidt Professor of Computer.
Chapter 4 – Thread Concepts
Threads Some of these slides were originally made by Dr. Roger deBry. They include text, figures, and information from this class’s textbook, Operating.
Introduction to Generic Programming in C++
Event Handling Patterns Asynchronous Completion Token
Wrapper Façade Pattern
Chapter 4 – Thread Concepts
The Active Object Pattern
Half-Sync/Half-Async (HSHA) and Leader/Followers (LF) Patterns
An Introduction to Software Architecture
From Use Cases to Implementation
Presentation transcript:

E81 CSE 532S: Advanced Multi-Paradigm Software Development Chris Gill Department of Computer Science Washington University, St. Louis Introduction to Concurrent and Networked Objects

Why Study Concurrency and Patterns? Concurrent/networked systems increasingly important –Significant focus on (multicore) hardware, location independence, scalability, performance, timing etc. Concurrent/networked Systems are highly challenging to design and implement well –Accidental complexities must be constrained Limitations with tools, techniques and processes Reinvention and rediscovery (NIH, “C++ considered harmful”) –Inherent complexities must be accommodated Network partitions, partial failures, deadlock, race conditions –Patterns and pattern languages help to codify what works Generative techniques adaptable to new contexts

Categories of Patterns Service Access and Configuration –Appropriate programming interfaces/abstractions Concurrency –Exploiting physical and logical parallelism Synchronization –Managing safety and liveness in concurrent systems Event Handling –Inescapable in networked systems

Aggregating Paradigms Single Paradigms –Procedural –Object-Oriented –Generics –Aspect-Oriented –Idioms, Design and Strategic Patterns A “Multi-Paradigm” Paradigm –i.e., a Multi-Paradigm –i.e., Generative Programming static OS threads, queues, timers OS services OS scheduling strategies portability composition end-to-end aspects

Procedural Systems Programming Common-off-the-shelf (COTS) Operating Systems –E.g., Linux, Windows, VxWorks, LynxOS, … Standardized APIs –Threads, sockets, … –POSIX, etc. Portability layer is useful In C/C++, pre-compilers can do a lot for you From ACE_INLINE ACE_thread_t ACE_OS::thr_self (void) { // ACE_OS_TRACE ("ACE_OS::thr_self"); #if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_PTHREADS) // Note, don't use "::" here since the // following call is often a macro. ACE_OSCALL_RETURN (pthread_self (), int, -1); # elif defined (ACE_HAS_STHREADS) ACE_OSCALL_RETURN (::thr_self (), int, -1); # elif defined (ACE_HAS_WTHREADS) return ::GetCurrentThreadId (); # elif defined (ACE_PSOS) // there does not appear to be a way to get // a task's name other than at creation return 0; # elif defined (VXWORKS) return ::taskName (::taskIdSelf ()); # endif /* ACE_HAS_STHREADS */ #else return 1; // Might as well make it the first thread ;-) #endif /* ACE_HAS_THREADS */ }

Procedural Programming, Continued Inherent complexity –Part of the problem itself –Won’t go away –E.g., network latency Accidental Complexity –Artifact of the solution –Can reduce with better tools and techniques How many times would you want to (re-)write this code? See also size_t i; for (i = 0; i < n; i++) { ACE_thread_t t_id; ACE_hthread_t t_handle; int result = ACE_OS:: thr_create (func, arg, flags, &t_id, &t_handle, priority, stack == 0 ? 0 : stack[i], stack_size == 0 ? 0 : stack_size[i], thread_adapter); if (result == 0) { if (thread_ids != 0) thread_ids[i] = t_id; if (thread_handles != 0) thread_handles[i] = t_handle; } else // Bail out if error occurs. break; } return i;

Object-Oriented Programming Reduction in Accidental Complexity –Less tedious and error- prone to develop, port, maintain, extend Inheritance Polymorphism –Allows substitution Encapsulation –Hides details –Controlled violations may help E.g., socket handle ACE_IPC_SAP ACE_SOCKACE_SPIPE ACE_SOCK_StreamACE_SOCK_Dgram

Object-Oriented Programming, Continued The OO paradigm helps But, leaves key questions open –When should we create objects? –What are their relationships? –How do they interact? We still need tactical guidance class Synchronized_Processor { public: int critical_section (); private: Processor p_; Mutex m_; } int Synchronized_Processor:: critical_section () { m_.lock (); int result = p_.do_processing (); m_.unlock (); return result; }

Design Patterns Each pattern has a name –Part of a higher-level design vocabulary It applies to a context It documents a solution It captures experience We also need key idioms –E.g., guard, copy-on-write, etc. Container Iterator * make_iterator()=0; Array Iterator * make_iterator(); Linked_List Iterator * make_iterator(); Application of the GoF Factory Method Pattern template class Guard { public: Guard (T & t); ~Guard (); private: T & t_; };

Towards Strategic Patterns Procedures + OO + Patterns –We’ve made progress on accidental complexity –But still have more to do And, solutions must respect inherent complexity –Resource access –Communication –Asynchrony Need strategic guidance to demystify the art Sockets? Pipes? Event Multiplexing? Reuse? Portability?

Strategic Patterns –Service Access & Configuration –Synchronization –Concurrency –Events Small pattern-languages –E.g., ACT, Active Object –E.g., Acceptor, Connector, Reactor reactor thread director Active Objects posts to queues