YOUR FIRST ISIS2 GROUP Ken Birman 1 Cornell University.

Slides:



Advertisements
Similar presentations
CAN CLOUD COMPUTING SYSTEMS OFFER HIGH ASSURANCE WITHOUT LOSING KEY CLOUD PROPERTIES? Ken Birman, Cornell University CS
Advertisements

Distributed Systems 2006 Group Membership * *With material adapted from Ken Birman.
A. Frank - P. Weisberg Operating Systems Introduction to Cooperating Processes.
GTECH 731 Lab Session 4 Lab 3 Review, Lab 4 Intro 9/28/10 Lab 3 Review Lab 4 Overview.
Delegates and Events Tom Roeder CS fa. Motivation – Function Pointers Treat functions as first-class objects eg. Scheme: (map myfunc somelist)
EEC 693/793 Special Topics in Electrical Engineering Secure and Dependable Computing Lecture 14 Wenbing Zhao Department of Electrical and Computer Engineering.
Processes CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
Google App Engine Danail Alexiev Technical Trainer SoftAcad.bg.
WHAT IS THE Isis2 LIBRARY?
A BRIEF INTRODUCTION TO HIGH ASSURANCE CLOUD COMPUTING WITH ISIS2 Ken Birman 1 Cornell University.
CS 6410: ADVANCED SYSTEMS KEN BIRMAN A PhD-oriented course about research in systems Fall 2012.
C# Tutorial From C++ to C#. Some useful links Msdn C# us/library/kx37x362.aspxhttp://msdn.microsoft.com/en- us/library/kx37x362.aspx.
ISIS 2 PROCESS GROUPS Ken Birman 1 Cornell University.
A BRIEF INTRODUCTION TO HIGH ASSURANCE CLOUD COMPUTING WITH ISIS2 Ken Birman 1 Cornell University.
Lecture 5 What is object-oriented programming OOP techniques How Windows Forms applications rely on OOP.
CS 6410: ADVANCED SYSTEMS KEN BIRMAN A PhD-oriented course about research in systems Fall 2014.
CLOUD COMPUTING Lecture 27: CS 2110 Spring Computing has evolved...  Fifteen years ago: desktop/laptop + clusters  Then  Web sites  Social networking.
SHARDING KEY-VALUE DATA IN ISIS2 Ken Birman 1 Cornell University.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto OS-Related Hardware.
10/16/ Realizing Concurrency using the thread model B. Ramamurthy.
ISIS 2 RUNTIME PARAMETERS Ken Birman 1 Cornell University.
Processes & Threads Bahareh Goodarzi. Single & Multiple Thread of control code files data code files data.
Effective C# 50 Specific Way to Improve Your C# Item 20, 21 Sephiroth.Wang2012/08/01.
Introduction to Building Windows 8.1 & Windows Phone Applications.
Features of Object Oriented Programming:  A class is a collection of things which posses common similarities.  In C#.NET a class is a user defined.
B. RAMAMURTHY 10/24/ Realizing Concurrency using the thread model.
Session 08 Module 14: Generics and Iterator Module 15: Anonymous & partial class & Nullable type.
ILM Proprietary and Confidential -
CAN CLOUD COMPUTING SYSTEMS OFFER HIGH ASSURANCE WITHOUT LOSING KEY CLOUD PROPERTIES? Ken Birman, Cornell University 1 CS6410.
Replication (1). Topics r Why Replication? r System Model r Consistency Models – How do we reason about the consistency of the “global state”? m Data-centric.
Processes CS 6560: Operating Systems Design. 2 Von Neuman Model Both text (program) and data reside in memory Execution cycle Fetch instruction Decode.
REPLICATING FILES AND OTHER BIG OBJECTS “OUT OF BAND” WITH ISIS2 Ken Birman 1 Cornell University.
COORDINATION, SYNCHRONIZATION AND LOCKING WITH ISIS2 Ken Birman 1 Cornell University.
Week 4-5 DBMS Database Design. Database design process can be divided into 6 major steps: 1.Requirements Analysis 2.Conceptual Database Design 3.Logical.
Generics Ashima Wadhwa. What are generics Generics were added by C# 2.0 the term generics means parameterized types. Using generics, you can define a.
Session 07 Module 13 - Collections. Collections / Session 7 / 2 of 32 Review  A delegate in C# is used to refer to a method in a safe manner.  To invoke.
CPSC 481 Fateme Rajabiyazdi #W4. Visual Studio Download Visual Studio 2013 (Ultimate) from – MSDN Academic Alliance Software Center – IT account.
Special Features of C# : Delegates, Events and Attributes.
Effective C# 50 Specific Way to Improve Your C# Item 22, 23.
Project18 Communication Design + Parallelization Camilo A Silva BIOinformatics Summer 2008.
WHAT ARE THE RIGHT ROLES FOR FORMAL METHODS IN HIGH ASSURANCE CLOUD COMPUTING? Ken Birman, Cornell University Princeton Nov
Lecture 11: Generics. The Generic List loading data from a file using System.IO; : namespace EmpListDemo { static class Program { static void Main(string[]
Arrays & Enum & Events. Arrays Arrays are data structures consisting of related data items of the same type. Arrays are fixed-length entities—they remain.
ORDERING AND DURABILITY IN ISIS 2 Ken Birman 1 Cornell University.
METADATA IN.NET Presented By Sukumar Manduva. INTRODUCTION  What is Metadata ? Metadata is a binary information which contains the complete description.
Coming up Implementation vs. Interface The Truth about variables Comparing strings HashMaps.
CS5412: VIRTUAL SYNCHRONY Ken Birman 1 CS5412 Spring 2016 (Cloud Computing: Birman) Lecture XIV.
B. RAMAMURTHY 5/10/2013 Amrita-UB-MSES Realizing Concurrency using the thread model.
7/9/ Realizing Concurrency using Posix Threads (pthreads) B. Ramamurthy.
Realizing Concurrency using the thread model
CS5412: Virtual Synchrony Lecture XIV Ken Birman
התוכנית: using System; using System.Collections.Generic;
Realizing Concurrency using the thread model
CS360 Windows Programming
Realizing Concurrency using Posix Threads (pthreads)
COP 4600 Operating Systems Spring 2011
Realizing Concurrency using the thread model
Classes & Objects: Examples
عرض اجمالي المهام الشرطية في سي شارب (الأمر if)
Realizing Concurrency using the thread model
CS5412: Virtual Synchrony Lecture XIV Ken Birman
class PrintOnetoTen { public static void main(String args[]) {
Realizing Concurrency using the thread model
Realizing Concurrency using Posix Threads (pthreads)
Realizing Concurrency using the thread model
Realizing Concurrency using Posix Threads (pthreads)
Foundations and Definitions
Chengyu Sun California State University, Los Angeles
Threads CSE 2431: Introduction to Operating Systems
Presentation transcript:

YOUR FIRST ISIS2 GROUP Ken Birman 1 Cornell University

Let’s implement “Hello World” 2  We can start with the example from the “Intro” module you saw previously  Let’s look at it first, and then we’ll modify it into a real application

Isis2 System 3  A library to which your application is linked  Core functionality: groups of objects  … fault-tolerance, speed (parallelism), coordination  Intended for use in very large-scale settings  The local object instance functions as a gateway  Read-only operations performed on local state  Update operations update all the replicas myGroup state transfer “join myGroup” updateupdate TRIOS 2013

Isis 2 fragment from the Intro module Group g = new Group(“myGroup”); Dictionary Values = new Dictionary (); g.ViewHandlers += delegate(View v) { Console.Title = “myGroup members: “+v.members; }; g.Handlers[UPDATE] += delegate(string s, double v) { Values[s] = v; }; g.Handlers[LOOKUP] += delegate(string s) { g.Reply(Values[s]); }; g.Join(); g.OrderedSend(UPDATE, “Harry”, 20.75); List resultlist = new List (); nr = g.OrderedQuery(ALL, LOOKUP, “Harry”, EOL, resultlist);  First sets up group  Join makes this entity a member. State transfer isn’t shown  Then can multicast, query. Runtime callbacks to the “delegates” as events arrive  Easy to request security (g.SetSecure), persistence  “Consistency” model dictates the ordering aseen for event upcalls and the assumptions user can make 4

Concept: A “multi-query”  Our lookup is  Multicast to the group  All members respond  The chance for parallelism  Each can do part of the job: e.g. search 1/n th of a database  Reduces response delays 5 I forgot that guy’s name but I need to find him! He lives in Ithaca and has Harry in his name. I think. Front end With n replicas we get an n times speedup! Names with Harry in them:....

Code for full program using System; using System.Collections.Generic; using System.Linq; using System.Text; using Isis; using System.Threading; namespace ConsoleApplication3 { public class tuple { public int rank; public int value; public tuple(int r, int v) { rank = r; value = v; } class Program { static List database = new List (); public const int UPDATE = 0; public const int LOOKUP = 1; static Semaphore go = new Semaphore(0, 1), dbFull = new Semaphore(0, 1); static void Main(string[] args) { IsisSystem.Start(); Group g = new Group("foo"); int myRank = 0; bool go = false, dbfull = false; ; g.ViewHandlers += (ViewHandler)delegate(View v) { Console.WriteLine("New View: " + v); myRank = v.GetMyRank(); if (v.members.Length == 3) go.Release(1); }; g.Handlers[UPDATE] += (Action )delegate(int rank, int n) { database.Add(new tuple(n, rank)); Console.WriteLine("New tuple: " + rank + "/" + n); if (database.Count() == 15) dbfull.Release(1); }; g.Handlers[LOOKUP] += (Action )delegate(int arg) { Console.WriteLine("=== Query for arg=" + arg); List answer = new List (); int index = 0; foreach (tuple tp in database) if (index++ % 3 == myRank) { Console.WriteLine("Looking at " + tp.rank + "/" + tp.value); if (tp.rank == arg) { Console.WriteLine("Including " + tp.rank + "/" + tp.value); answer.Add(tp.value); } g.Reply(answer); }; g.Join(); go.WaitOne(); for (int n = 0; n < 5; n++) g.OrderedSend(UPDATE, myRank, n); dbFull.WaitOne(); if(myRank == 1) for (int n = 0; n < 3; n++) { List > results = new List >(); g.OrderedQuery(Group.ALL, LOOKUP, n, new Isis.EOLMarker(), results); Console.WriteLine("\r\nAnswers for Query rank=" + n); foreach (List list in results) foreach (int value in list) Console.Write(value + " "); } IsisSystem.WaitForever(); }

State Transfer: Initialize new member 7  By registering a checkpoint creation and loading method, we enable state transfer in our group  The state is in the Values Dictionary object.  Isis 2 doesn’t automatically marshal the Dictionary type, so we’ll send it as a List of KeyValuePair objects g.MakeChkpt += (Isis.ChkptMaker)delegate(View nv) { g.SendChkpt(Values.ToList >()); // Send the Values Dictionary as a list g.EndOfChkpt(); // Finished making the checkpoint }; g.LoadChkpt += (Action >>)delegate(List > incoming) { foreach(KeyValuePair item in incoming) Values[item.Key] = item.Value; }; g.Join(); // This new code goes BEFORE the g.Join() call!

What happens when it finishes? 8  Our programs linger doing nothing, but with the main threads all in IsisSystem.WaitForever();  You will need to kill them one by one.  Challenge: Add code so that the rank 0 member will “terminate” the group after 30 seconds  It will need to call g.terminate()  The new view handlers would call IsisSystem.Shutdown();  IsisSystem.WaitForever() will return! (And then your main thread can simply exit).

Summary 9  We created a group. Members join it and state is transferred to them. All have identical state. Updates are applied in order.  We saw how to use the group for a parallel search of the key-value list. Homework: Modify the program to store phone-book data. Have the Query look up every person in Ithaca with Harry somewhere in their name, and form a list of names and numbers. myGroup state transfer “join myGroup” updateupdate