Communication API and Language. Communication API Issues –Should there be a common communication API? Generally a good idea –Make network vendors do more.

Slides:



Advertisements
Similar presentations
Objects and Classes David Walker CS 320. Advanced Languages advanced programming features –ML data types, exceptions, modules, objects, concurrency,...
Advertisements

Threads Cannot be Implemented As a Library Andrew Hobbs.
Programming Languages and Paradigms
2003 Michigan Technological University March 19, Steven Seidel Department of Computer Science Michigan Technological University
CSCC69: Operating Systems
Names and Bindings.
The Linux Kernel: Memory Management
CS 326 Programming Languages, Concepts and Implementation Instructor: Mircea Nicolescu Lecture 18.
IBM Software Group © 2004 IBM Corporation Compilation Technology Java Synchronization : Not as bad as it used to be! Mark Stoodley J9 JIT Compiler Team.
Static Analysis of Embedded C Code John Regehr University of Utah Joint work with Nathan Cooprider.
CS 330 Programming Languages 10 / 16 / 2008 Instructor: Michael Eckmann.
DISTRIBUTED AND HIGH-PERFORMANCE COMPUTING CHAPTER 7: SHARED MEMORY PARALLEL PROGRAMMING.
Run time vs. Compile time
Approaches to Typing Programming Languages Robert Dewar.
CS510 Concurrent Systems Class 5 Threads Cannot Be Implemented As a Library.
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.
Threads© Dr. Ayman Abdel-Hamid, CS4254 Spring CS4254 Computer Network Architecture and Programming Dr. Ayman A. Abdel-Hamid Computer Science Department.
Introduction to Classes and Objects CS-2303, C-Term Introduction to Classes and Objects CS-2303 System Programming Concepts (Slides include materials.
. Memory Management. Memory Organization u During run time, variables can be stored in one of three “pools”  Stack  Static heap  Dynamic heap.
C++ fundamentals.
Storage & Linkage: Effects on Scope Rudra Dutta CSC Spring 2007, Section 001.
UPC Runtime Layer Jason Duell. The Big Picture The Runtime layer handles everything that is both: 1) Platform/Environment specific —So compiler can output.
A Behavioral Memory Model for the UPC Language Kathy Yelick Joint work with: Dan Bonachea, Jason Duell, Chuck Wallace.
Parallel Programming in Java with Shared Memory Directives.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 19 Clicker Questions November 3, 2009.
Operator Precedence First the contents of all parentheses are evaluated beginning with the innermost set of parenthesis. Second all multiplications, divisions,
CS 403: Programming Languages Lecture 2 Fall 2003 Department of Computer Science University of Alabama Joel Jones.
Chapter 6: Modularity Using Functions. In this chapter, you will learn about: – Function and parameter declarations – Returning a single value – Returning.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
1 Comp 104: Operating Systems Concepts Java Development and Run-Time Store Organisation.
CS212: Object Oriented Analysis and Design Lecture 6: Friends, Constructor and destructors.
CSSE501 Object-Oriented Development. Chapter 12: Implications of Substitution  In this chapter we will investigate some of the implications of the principle.
June-Hyun, Moon Computer Communications LAB., Kwangwoon University Chapter 26 - Threads.
Internet Software Development Controlling Threads Paul J Krause.
University of Washington Today Finished up virtual memory On to memory allocation Lab 3 grades up HW 4 up later today. Lab 5 out (this afternoon): time.
Data Structures Using C++ 2E Chapter 3 Pointers. Data Structures Using C++ 2E2 Objectives Learn about the pointer data type and pointer variables Explore.
Synchronized and Monitors. synchronized is a Java keyword to denote a block of code which must be executed atomically (uninterrupted). It can be applied.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
CS 376b Introduction to Computer Vision 01 / 23 / 2008 Instructor: Michael Eckmann.
CS536 Semantic Analysis Introduction with Emphasis on Name Analysis 1.
Java Thread and Memory Model
Java Basics Opening Discussion zWhat did we talk about last class? zWhat are the basic constructs in the programming languages you are familiar.
CS533 – Spring Jeanie M. Schwenk Experiences and Processes and Monitors with Mesa What is Mesa? “Mesa is a strongly typed, block structured programming.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles Synchronization Emery Berger and Mark Corner University.
1 Becoming More Effective with C++ … Day Two Stanley B. Lippman
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
How to execute Program structure Variables name, keywords, binding, scope, lifetime Data types – type system – primitives, strings, arrays, hashes – pointers/references.
Quick Review of OOP Constructs Classes:  Data types for structured data and behavior  fields and methods Objects:  Variables whose data type is a class.
CS 330 Programming Languages 10 / 23 / 2007 Instructor: Michael Eckmann.
1 Chapter 15-1 Pointers, Dynamic Data, and Reference Types Dale/Weems.
Defining Data Types in C++ Part 2: classes. Quick review of OOP Object: combination of: –data structures (describe object attributes) –functions (describe.
©2004 Joel Jones 1 CS 403: Programming Languages Lecture 3 Fall 2004 Department of Computer Science University of Alabama Joel Jones.
Java and C# - Some Commonalities Compile into machine-independent, language- independent code which runs in a managed execution environment Garbage Collection.
Chapter 7 Process Environment Chien-Chung Shen CIS/UD
Names and Attributes Names are a key programming language feature
Java Programming Language
Threads Cannot Be Implemented As a Library
COM S 326X Deep C Programming for the 21st Century Prof. Rozier
Chapter 3: Using Methods, Classes, and Objects
Threads and Memory Models Hal Perkins Autumn 2011
COT 5611 Operating Systems Design Principles Spring 2014
COP 4600 Operating Systems Fall 2010
Threads and Memory Models Hal Perkins Autumn 2009
Programming with Shared Memory
CSE 153 Design of Operating Systems Winter 19
Foundations and Definitions
CSE 153 Design of Operating Systems Winter 2019
The Three Attributes of an Identifier
SPL – PS2 C++ Memory Handling.
Presentation transcript:

Communication API and Language

Communication API Issues –Should there be a common communication API? Generally a good idea –Make network vendors do more work –Compiler writers will be able to leverage Vendors will need incentive to use –Performance vs. Portability MTU and LBL efforts are orthogonal Action item: –Mail to see the LBL draft runtime and communication layer spec

Language Issues Language issues (1 hour) –Locks (Dan) –Pragma for shared (Bill) Richard Stallman’s: pragmas vs. upc_strict Language level “strict” or memory barriers –Thread/process issues Calling libraries from UPC Maintain C spec for thread-local things –Freeing result of all_alloc() –Atomicity (Bill and Kathy…) –Signals: no semantics for externally generated signals (Dan) Proposal: undefined (no requirements imposed) –Poll (Kathy) Proposal: overload fence to have this effect on systems that need it

Poll Can we make progress in the following: shared int *x; shared int *y; *y = 1; *x = 1; while(!*x); while (!*y) This example isn’t quite enough, because x and y have to be strict, so there is a fence in the spin loop Proposal: table this discussion and think of the right way to say this

Specification Issues Quick specification issues –upc_phaseof for pointers with indef. block size (Dan and Jim and Brian) Proposal: return 0 –upc_barrier and barrier Proposal: eliminate the macros from the Spec –Spec: change wording to pointer to shared, not shared pointer Proposal: plan to change, but look at spec –Interaction between UPC max block size and array size Proposal: illegal

More Spec Issues –Thread of a[0] Block sizes on scalars (Sid) shared [3] int x; –Aside: more cleanly written as: int shared [3] x; Proposal: leave it as-is –Does phaseof(&a[0]) return 0 for static array a? Proposal: yes Threadof is also thread 0: implied by Section –Freeing all_alloc: Current spec says that all thread call upc_free Not free until all have called it But free says that 2 nd call to free is undefined Proposal: change wording so that first call frees the

More on shared/blocked Shared [3] int x [100]; &(x[10]) is a pointer to shared [3] int What is the type of x[10] ? –Wrong: shared int –Answer: shared [3] int

Atomicity What is the atomic “type” of the language? –I.e., smallest unit of reads/writes –Sig_atomic_t in C –Should we at upc_atomic_t ? Or a size? Two properties: –Cannot “tear” value and see partially-updated results –Cannot “clobber” values outside of the one accessed (e.g., writing to an array Issue: can this be implemented on all systems? –64-bit system with a 32-bit network card

Threads/Process Summary Two problems : –Linkage issue in pthreads If small number of problems, we may add to spec. –Semantics of library objects How many do you get? Are they shared/local? Principles: –Any C program is a valid UPC program –C libraries should work on a per-thread basis Proposal: Leave spec “as-is” but plan to extend the abstract machine model for C to UPC. –Look at pthread spec., CAF, hope the I/O figure this out… –Start by enumerating problems

Action Items Plan pthread implementations –Mahesha will investigate Extend C’s machine model (Sid to lead) –Standard library semantics (stderr,…) –Atomicity Modifications to spec –Send detailed requests to Tarek for integration (Sid, Dan, …) Relaxed/strict –Gary and Bill – continue talking to “gnu” Runtime: –send mail to for LBL upc-run: didn’t talk about this –Identify a group to generate a draft –Implementors: Compaq, LBNL, Cray, HP, …

Schedule Any requests for changes to Bill by April 1 st Circulate it by the 15 th. June 1 st 1.1 draft will become the spec if no one objects

Threads/Process Issues Calling library (sequential) from UPC code in pthread implementations of UPC –Statically declared global variables in libraries, e.g., stdio defined __iobuff as a global variable Address space conflicts –Proposal: May have a standard solution for pthread implementations Including using the following: may come from a different place in UPC than in C Calling C/F functions from UPC –J.5.9 in C: “Fortran” keyword (p. 508) –Leave this undefined Thread safety –This is a known problem

Threads/Process Issues File example: –Cannot take a file descriptor and pass it to another UPC thread and have it work It may, in some implementations, but won’t May be a different limit on # of files in pthread UPC than C –Does the UPC spec say anything about File descriptors (in particular, 3 standard IO channels like stderr, errno) and whether they are local or shared How many of them are there? Principles: –Any C program is a valid UPC program –C libraries should work on a per-thread basis

Locks Spec currently allows statically allocated locks upc_lock_t L; upc_lock_init(&L); // should not be used Prevent users from assigning locks upc_lock_t L, M; L = M; // should not be used Proposal: –make upc_lock_t an “incomplete” type This is an ANSI C notion (a struct with unknown fields) No statically allocated locks (no sizeof) –init function disappears upc_lock_init() // should disappear –Open issue: should upc_lock_t be a pointer to shared or completely opaque. (Greg and Gary) Default is pointer to shared

More on Locks How to free locks? –Proposal: add to the spec upc_lock_free() What is the consistency model for lock operations –Proposal: specify that lock operations are implicitly null strict references upc_lock  acquire null strict reference upc_unlock  null strict reference release Issue: over-synchronizes (relative to Java) –Because it synchronizes movement in two directions –But we decided to go with it anyway

Recursive Locks What happens if you acquire a lock that is already being held. Proposals: 1.Undefined Implementations may include mechanisms to detect these problems 2.Throw a standard C signal 3.OK, but behaves as if only locked once (unlock will release both) 4.OK and recursive –Issue: allow for future recursive lock extensions –Issue: speed of successfully acquiring a lock Allowing undefined behavior is fastest (single bit implementation of locks) –Conclusion: undefined

Strict/Relaxed Language Support Current scenario: #pragma upc_relaxed can appear at file scope or block beginning Issue: pragmas are bad –Cannot be included in macros (except in C99) Proposal #1: add upc_strict/relaxed “statements” –Add a new compound statement type: upc_strict statement upc_relaxed statement –Conclusion: Very nice, but a change to the language Proposal #2: –Depracate use of pragmas in blocks #pragma upc_relaxed (and strict) at file scope only Use C99 solution for macros Proposal #3: status quo

Relaxed/Strict Language Support More on proposal #1 –Use in function scope void foo () { … upc_strict; // hold in following code … upc_relaxed; // until here …} –Use in file scope – upc_strict; // outside of function, e.g., at top of file

Runtime Breakout Topics –Low level communication API –Language issues (1 hour) –Other (? hours) 2 hours of real meeting time today –Runtime (short discussion) –Languages (incomplete) 1.5 hours tomorrow –Remaining language issues