1 Programming Languages and the Software Production Process Informal Cardelli’s metrics of programming languages fitness to real-time applications: Economy.

Slides:



Advertisements
Similar presentations
Programming Languages and Paradigms
Advertisements

Ch 7 B.
Concurrency Important and difficult (Ada slides copied from Ed Schonberg)
1 Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Abstract Data Types Data abstraction, or abstract data types, is a programming methodology where one defines not only the data structure to be used, but.
Monitors Chapter 7. The semaphore is a low-level primitive because it is unstructured. If we were to build a large system using semaphores alone, the.
Model for Supporting High Integrity and Fault Tolerance Brian Dobbing, Aonix Europe Ltd Chief Technical Consultant.
Informationsteknologi Wednesday, September 26, 2007 Computer Systems/Operating Systems - Class 91 Today’s class Mutual exclusion and synchronization 
ADA Langage Report Ligia Nitu. Introduction Ada is the most extensive and expensive computer language ever developed. Ada is the most extensive and expensive.
1 Concurrency: Mutual Exclusion and Synchronization Chapter 5.
DISTRIBUTED AND HIGH-PERFORMANCE COMPUTING CHAPTER 7: SHARED MEMORY PARALLEL PROGRAMMING.
Programming Language Paradigms: summary. Object-oriented programming Objects are the fundamental building blocks of a program. Interaction is structured.
Concurrency in Ada Programming Languages 1 Robert Dewar.
Concurrency in Ada What concurrency is all about Relation to operating systems Language facilities vs library packages POSIX threads Ada concurrency Real.
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
Java for High Performance Computing Jordi Garcia Almiñana 14 de Octubre de 1998 de la era post-internet.
Run-Time Storage Organization
Run time vs. Compile time
1 Run time vs. Compile time The compiler must generate code to handle issues that arise at run time Representation of various data types Procedure linkage.
Guide To UNIX Using Linux Third Edition
Concurrency - 1 Tasking Concurrent Programming Declaration, creation, activation, termination Synchronization and communication Time and delays conditional.
The Mana Project Lars Asplund Kristina Lundqvist Uppsala University, Information Technology, Dept of Computer Systems.
Scope.
Comparison of OO Programming Languages © Jason Voegele, 2003.
Programming Languages and Paradigms Object-Oriented Programming.
1 Chapter 5: Names, Bindings and Scopes Lionel Williams Jr. and Victoria Yan CSci 210, Advanced Software Paradigms September 26, 2010.
Comparative Programming Languages hussein suleman uct csc304s 2003.
Real-Time Software Design Yonsei University 2 nd Semester, 2014 Sanghyun Park.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings 1.
Experience with Processes and Monitors in Mesa
EE4E. C++ Programming Lecture 1 From C to C++. Contents Introduction Introduction Variables Variables Pointers and references Pointers and references.
Adapted from Prof. Necula UCB CS 1641 Overview of COOL ICOM 4029 Lecture 2 ICOM 4029 Fall 2008.
12/1/98 COP 4020 Programming Languages Parallel Programming in Ada and Java Gregory A. Riccardi Department of Computer Science Florida State University.
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
(12.1) COEN Concurrency and Exceptions  Coroutines  Physical and logical concurrency  Synchronization – semaphores – monitors – message passing.
Chapter 13 Concurrency. Copyright © 2012 Addison-Wesley. All rights reserved.1-2 Introduction Concurrency can occur at four levels: –Machine instruction.
Reference: Ian Sommerville, Chap 15  Systems which monitor and control their environment.  Sometimes associated with hardware devices ◦ Sensors: Collect.
Basic Semantics Associating meaning with language entities.
1 Copyright © 1998 by Addison Wesley Longman, Inc. Chapter 12 Concurrency can occur at four levels: 1. Machine instruction level 2. High-level language.
1 Concurrency Architecture Types Tasks Synchronization –Semaphores –Monitors –Message Passing Concurrency in Ada Java Threads.
Internet Software Development Controlling Threads Paul J Krause.
OOPLs /FEN March 2004 Object-Oriented Languages1 Object-Oriented Languages - Design and Implementation Java: Behind the Scenes Finn E. Nordbjerg,
Chapter 15 Introduction to PL/SQL. Chapter Objectives  Explain the benefits of using PL/SQL blocks versus several SQL statements  Identify the sections.
CSC321 Concurrent Programming: §5 Monitors 1 Section 5 Monitors.
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
1 Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
1 Concurrency: Mutual Exclusion and Synchronization Chapter 5.
ICS 313: Programming Language Theory Chapter 13: Concurrency.
Synchronization Methods in Message Passing Model.
Types in programming languages1 What are types, and why do we need them?
Real Time Programming Language. Intro A programming language represents the nexus of design and structure. But misuse of the programming language can.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
Object-Oriented Programming Chapter Chapter
System Components ● There are three main protected modules of the System  The Hardware Abstraction Layer ● A virtual machine to configure all devices.
Concepts of programming languages Chapter 5 Names, Bindings, and Scopes Lec. 12 Lecturer: Dr. Emad Nabil 1-1.
13-1 Chapter 13 Concurrency Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads C# Threads.
Ada Constructs Revisited 21 Oct Constructs to be Expanded Generics Tasking Elaboration.
3/12/2013Computer Engg, IIT(BHU)1 OpenMP-1. OpenMP is a portable, multiprocessing API for shared memory computers OpenMP is not a “language” Instead,
Synchronicity II Introduction to Operating Systems: Module 6.
Ada, Scheme, R Emory Wingard. Ada History Department of Defense in search of high level language around Requirements drafted for the language.
ISBN Chapter 12 Support for Object-Oriented Programming.
A Single Intermediate Language That Supports Multiple Implemtntation of Exceptions Delvin Defoe Washington University in Saint Louis Department of Computer.
CS 326 Programming Languages, Concepts and Implementation
“Language Mechanism for Synchronization”
Real-time Software Design
Concurrency: Mutual Exclusion and Synchronization
Shared Memory Programming
Subject : T0152 – Programming Language Concept
Monitors Chapter 7.
Presentation transcript:

1 Programming Languages and the Software Production Process Informal Cardelli’s metrics of programming languages fitness to real-time applications: Economy of execution – how fast does a program run? Economy of compilation – How long does it take to get executables? Economy of small-scale development – how hard must an individual programmer work? Economy of large-scale development – how hard must a team of programmers work? Economy of language features – how hard is to learn or use a programming language?

2 Assembly Language Difficult to learn, tedious, error prone Nonportable Unstructured, have limited abstraction Assembly language programming should be used in very tight timing constraints or in controlling hardware feature that are not supported by the compiler Optimizing compilers produce a code that is not less effective than programmed manually

3 Procedural Languages Programming language features that are of interest in real-time systems Versatile parameter passing mechanisms (parameters, global variables; call by value and by reference) Dynamic memory allocation facilities Strong typing Abstract data typing Exception handling Modularity

4 Object-Oriented Languages Provide information hiding Garbage collection (e.g.,in Java, once the garbage-collector thread determines that an object is unreachable, the object’s memory is returned to the system Garbage collection policies: Mark and sweep - void mark (Object p) if (!p.marked) p.marked = true; for each Object q referenced by p mark (q); void sweep () for each Object p in the heap if (p.marked) p.marked = false else heap.release (p);

5 Object-Oriented Versus Procedural Languages There is still no agreement what is better for real-time applications OO languages may result in unpredictable and inefficient systems (due to garbage collection, late binding – resolving of reference at run-time) C++ is more suitable for Real-Time systems because it does not have built-in garbage collection and by default does not use “dynamic binding”

6 Brief Survey of ADA 95 Ada 83 was the first standard intended to be a mandatory language for development of real-time systems for US department of Defense. Second version was issued in Specification of task SEMAPHORE simulating semaphore entries P and V without parameters follows: TASKSEMAPHORE IS ENTRY P; ENTRY V; END; TASKBODY SEMAPHORE IS BEGIN LOOP ACCEPT P; ACCEPT V; END LOOP END Such task emulates semaphore variable, operations P() and V() on which are implemented as calls: Semaphore.P, Semaphore.V. ADA allows to specify separately definition (specification) part and implementation part (body).

7 ADA Rendezvous When some task calls entry, this call may be served immediately only if no other process is served at this moment (as in monitors). If process is suspended, it is placed in queue to respective task’s entry. If task comes to operator of accepting call to entry, and there is no any call of this entry, then task is suspended until call will appear. When call appears, and task executes operator of accepting of entry’s call, then information exchange or just synchronization of processes is performed. Until termination of the critical section operators defined in operator accept, calling task is passive, then both tasks proceed in parallel. Such scheme of interaction is called rendezvous. Type MESSAGE is integer; TASKMailBox IS ENTRY SEND(INMAIL: IN MES); ENTRY RECEIVE(OUTMAIL: OUT MES); END TASK;

8 MailBox Task in ADA TASKBODY MailBox IS SIZE: CONSTANT INTEGER:=20; BUFFER: ARRAY [1..SIZE] OF MESSAGE; COUNT: INTEGER:=0 NEXTIN, NEXTOUT: INTEGER:=1; BEGIN LOOP SELECT WHEN COUNT ACCEPT: SEND (INMAIL: INMESSAGE); DO BUFFER[NEXTIN]:=INMAIL; END; NEXTIN:=NEXTIN MOD SIZE+1; COUNT:=COUNT+1; OR WHEN COUNT>0=> ACCEPT RECEIVE (OUTMAIL: OUTMESSAGE); DO OUTMAIL:=BUFFER[NEXTOUT]; END; NEXTOUT:=NEXTOUT MOD SIZE+1 COUNT:=COUNT-1; END SELECT END LOOP END;

9 ADA Pragmas ICPP is defined in ADA as pragma Locking_Policy(Ceiling_Locking); Pragma Priority and Interrupt_Priority are used for tasks (processes) and interruption handlers, for example: task Controller is pragma Priority(10); end Controller; If task-type definition contains such a pragma, then all tasks of that type will have the same priority: task type Servers(Task_Priority:System.Priority) is entry Service1(..); entry Service2(..); pragma Priority(Task_Priority); end Servers; Pragma Task_Dispatching_Policy allows to select dispatching policy, for example FIFO_Within_Priority means that tasks are queued in FIFO order. Hence, as tasks become runnable, they are placed at the back of the notional run queue for that priority level. One exception to this case is when task is preempted; here the task is placed at the front of the notional run queue for that priority level.

10

11 Know the Compiler and Rules of Thumb Compare case vs nested if Parameters are passes by bytes or by words Needless Complexity - The System contains infrastructure that has no direct benefit (overengineering and/or "gold plating").

12 Coding Standards