SlideShare a Scribd company logo
Distributed Computing Seminar


Lecture 1: Introduction to Distributed
Computing & Systems Background


  Christophe Bisciglia, Aaron Kimball, & Sierra Michels-Slettvet
                          Summer 2007
      Except where otherwise noted, the contents of this presentation are
      © Copyright 2007 University of Washington and are licensed under
      the Creative Commons Attribution 2.5 License.
Course Overview
   5 lectures
    1  Introduction
     2 Technical Side: MapReduce & GFS
     2 Theoretical: Algorithms for distributed
      computing
   Readings + Questions nightly
       Readings: http://code.google.com/edu/content/submissions/mapreduce-minilecture/listing.html
       Questions: http://code.google.com/edu/content/submissions/mapreduce-
        minilecture/MapReduceMiniSeriesReadingQuestions.doc
Outline
   Introduction to Distributed Computing
   Parallel vs. Distributed Computing
   History of Distributed Computing
   Parallelization and Synchronization
   Networking Basics
Computer Speedup




Moore’s Law: “The density of transistors on a chip doubles every 18
months, for the same cost” (1965)
                                   Image: Tom’s Hardware and not subject to the Creative
                                     Commons license applicable to the rest of this work.
Scope of problems
 What can you do with 1 computer?
 What can you do with 100 computers?
 What can you do with an entire data
  center?
Distributed problems
   Rendering multiple frames of high-quality
    animation




Image: DreamWorks Animation and not subject to the Creative Commons license applicable to the rest of this work.
Distributed problems
    Simulating several
     hundred or thousand
     characters




    Happy Feet © Kingdom Feature Productions;
    Lord of the Rings © New Line Cinema, neither image is subject to the Creative
    Commons license applicable to the rest of the work.
Distributed problems
   Indexing the web (Google)
   Simulating an Internet-sized network for
    networking experiments (PlanetLab)
   Speeding up content delivery (Akamai)




What is the key attribute that all these examples have in common?
Parallel vs. Distributed
   Parallel computing can mean:
     Vector processing of data
     Multiple CPUs in a single computer
   Distributed computing is multiple CPUs
    across many computers over the network
A Brief History… 1975-85
   Parallel computing was
    favored in the early
    years
   Primarily vector-based
    at first
   Gradually more thread-
    based parallelism was
    introduced

Image: Computer Pictures Database and Cray Research Corp and is not subject to the Creative Commons license
applicable to the rest of this work.
A Brief History… 1985-95
 “Massively parallel architectures” start
  rising in prominence
 Message Passing Interface (MPI) and
  other libraries developed
 Bandwidth was a big problem
A Brief History… 1995-Today
 Cluster/grid architecture increasingly
  dominant
 Special node machines eschewed in favor
  of COTS technologies
 Web-wide cluster software
 Companies like Google take this to the
  extreme
Parallelization &
Synchronization
Parallelization Idea
   Parallelization is “easy” if processing can be
    cleanly split into n units:

                   work

                                      Partition
                                      problem


            w1     w2     w3
Parallelization Idea (2)


              w1         w2        w3

                    Spawn worker threads:

           thread         thread        thread




  In a parallel computation, we would like to have as
  many threads as we have processors. e.g., a four-
  processor computer would be able to run four threads
  at the same time.
Parallelization Idea (3)


                Workers process data:

       thread         thread            thread
         w1              w2               w3
Parallelization Idea (4)


      thread   thread    thread
        w1        w2       w3

                                  Report
                                  results



               results
Parallelization Pitfalls
But this model is too simple!

   How do we assign work units to worker threads?
   What if we have more work units than threads?
   How do we aggregate the results at the end?
   How do we know all the workers have finished?
   What if the work cannot be divided into
    completely separate tasks?

    What is the common theme of all of these problems?
Parallelization Pitfalls (2)
   Each of these problems represents a point
    at which multiple threads must
    communicate with one another, or access
    a shared resource.

   Golden rule: Any memory that can be used
    by multiple threads must have an
    associated synchronization system!
What is Wrong With This?
    Thread 1:                          Thread 2:
    void foo() {                       void bar() {
      x++;                               y++;
      y = x;                             x+=3;
    }                                  }

If the initial state is y = 0, x = 6, what happens
after these threads finish running?
Multithreaded = Unpredictability
 Many things that look like “one step” operations
  actually take several steps under the hood:
      Thread 1:          Thread 2:
      void foo() {       void bar() {
        eax = mem[x];      eax = mem[y];
        inc eax;           inc eax;
        mem[x] = eax;      mem[y] = eax;
        ebx = mem[x];      eax = mem[x];
        mem[y] = ebx;      add eax, 3;
      }                    mem[x] = eax;
                         }


   When we run a multithreaded program, we don’t
    know what order threads run in, nor do we know
    when they will interrupt one another.
Multithreaded = Unpredictability
This applies to more than just integers:

 Pulling work units from a queue
 Reporting work back to master unit
 Telling another thread that it can begin the
  “next phase” of processing

… All require synchronization!
Synchronization Primitives
   A synchronization primitive is a special
    shared variable that guarantees that it can
    only be accessed atomically.

   Hardware support guarantees that
    operations on synchronization primitives
    only ever take one step
Semaphores
   A semaphore is a flag               Set:           Reset:

    that can be raised or
    lowered in one step
   Semaphores were
    flags that railroad
    engineers would use
    when entering a
    shared track


    Only one side of the semaphore can ever be red! (Can both be
    green?)
Semaphores
 set() and reset() can be thought of as
  lock() and unlock()
 Calls to lock() when the semaphore is
  already locked cause the thread to block.

   Pitfalls: Must “bind” semaphores to
    particular objects; must remember to
    unlock correctly
The “corrected” example
Thread 1:                      Thread 2:

void foo() {                   void bar() {
  sem.lock();                    sem.lock();
  x++;                           y++;
  y = x;                         x+=3;
  sem.unlock();                  sem.unlock();
}                              }

Global var “Semaphore sem = new Semaphore();” guards access to
x&y
Condition Variables
   A condition variable notifies threads that a
    particular condition has been met

   Inform another thread that a queue now
    contains elements to pull from (or that it’s
    empty – request more elements!)

   Pitfall: What if nobody’s listening?
The final example
Thread 1:                       Thread 2:

void foo() {                    void bar() {
  sem.lock();                     sem.lock();
  x++;                            if(!fooDone)
  y = x;                            fooFinishedCV.wait(sem);
  fooDone = true;                 y++;
  sem.unlock();                   x+=3;
  fooFinishedCV.notify();         sem.unlock();
}                               }

 Global vars: Semaphore sem = new Semaphore(); ConditionVar
 fooFinishedCV = new ConditionVar(); boolean fooDone = false;
Too Much Synchronization?
Deadlock
Synchronization becomes even
more complicated when multiple
locks can be used


Can cause entire system to “get
stuck”
Thread A:                                        Thread B:
semaphore1.lock();                               semaphore2.lock();
semaphore2.lock();                               semaphore1.lock();
/* use data guarded by                           /* use data guarded by
     semaphores */                                    semaphores */
semaphore1.unlock();                             semaphore1.unlock();
semaphore2.unlock();                             semaphore2.unlock();
(Image: RPI CSCI.4210 Operating Systems notes)
The Moral: Be Careful!
   Synchronization is hard
     Need  to consider all possible shared state
     Must keep locks organized and use them
      consistently and correctly
 Knowing there are bugs may be tricky;
  fixing them can be even worse!
 Keeping shared state to a minimum
  reduces total system complexity
Fundamentals of
Networking
Sockets: The Internet = tubes?
 A socket is the basic network interface
 Provides a two-way “pipe” abstraction
  between two applications
 Client creates a socket, and connects to
  the server, who receives a socket
  representing the other side
Ports
   Within an IP address, a port is a sub-address
    identifying a listening program
   Allows multiple clients to connect to a server at
    once
What makes this work?
   Underneath the socket layer are several more
    protocols
   Most important are TCP and IP (which are used
    hand-in-hand so often, they’re often spoken of as
    one protocol: TCP/IP)


                             TCP
               IP header                   Your data
                            header




    Even more low-level protocols handle how data is sent over
    Ethernet wires, or how bits are sent through the air using 802.11
    wireless…
Why is This Necessary?
   Not actually tube-like “underneath the hood”
   Unlike phone system (circuit switched), the
    packet switched Internet uses many routes at
    once


          you                      www.google.com
Networking Issues
 If a party to a socket disconnects, how
  much data did they receive?
 … Did they crash? Or did a machine in the
  middle?
 Can someone in the middle
  intercept/modify our data?
 Traffic congestion makes switch/router
  topology important for efficient throughput
Conclusions
 Processing more data means using more
  machines at the same time
 Cooperation between processes requires
  synchronization
 Designing real distributed systems requires
  consideration of networking topology

   Next time: How MapReduce works

More Related Content

What's hot

Distributed operating system
Distributed operating systemDistributed operating system
Distributed operating system
udaya khanal
 
Chapter 1-distribute Computing
Chapter 1-distribute ComputingChapter 1-distribute Computing
Chapter 1-distribute Computing
nakomuri
 
Applications of Distributed Systems
Applications of Distributed SystemsApplications of Distributed Systems
Applications of Distributed Systems
sandra sukarieh
 
Centralized vs distrbution system
Centralized vs distrbution systemCentralized vs distrbution system
Centralized vs distrbution systemzirram
 
Chapter 1 -_characterization_of_distributed_systems
Chapter 1 -_characterization_of_distributed_systemsChapter 1 -_characterization_of_distributed_systems
Chapter 1 -_characterization_of_distributed_systemsFrancelyno Murela
 
16.Distributed System Structure
16.Distributed System Structure16.Distributed System Structure
16.Distributed System Structure
Senthil Kanth
 
Distributed Systems
Distributed SystemsDistributed Systems
Distributed Systems
naveedchak
 
Lecture 1 introduction to parallel and distributed computing
Lecture 1   introduction to parallel and distributed computingLecture 1   introduction to parallel and distributed computing
Lecture 1 introduction to parallel and distributed computing
Vajira Thambawita
 
Lecture 1 (distributed systems)
Lecture 1 (distributed systems)Lecture 1 (distributed systems)
Lecture 1 (distributed systems)
Fazli Amin
 
Distributed system architecture
Distributed system architectureDistributed system architecture
Distributed system architecture
Yisal Khan
 
Distributed operating system(os)
Distributed operating system(os)Distributed operating system(os)
Distributed operating system(os)
Dinesh Modak
 
Design issues of dos
Design issues of dosDesign issues of dos
Design issues of dos
vanamali_vanu
 
Fundamentals
FundamentalsFundamentals
Fundamentals
Divya Srinivasan
 
chapter 2 architecture
chapter 2 architecturechapter 2 architecture
chapter 2 architecture
Sharda University Greater Noida
 
Distributed OS - An Introduction
Distributed OS - An IntroductionDistributed OS - An Introduction
Distributed OS - An Introduction
Suhit Kulkarni
 
Distributed & parallel system
Distributed & parallel systemDistributed & parallel system
Distributed & parallel systemManish Singh
 
Introduction to Parallel Computing
Introduction to Parallel ComputingIntroduction to Parallel Computing
Introduction to Parallel Computing
Roshan Karunarathna
 
Distributed Shared Memory Systems
Distributed Shared Memory SystemsDistributed Shared Memory Systems
Distributed Shared Memory Systems
Arush Nagpal
 
Distributed operating system
Distributed operating systemDistributed operating system
Distributed operating system
Prankit Mishra
 
Distributed Operating System,Network OS and Middle-ware.??
Distributed Operating System,Network OS and Middle-ware.??Distributed Operating System,Network OS and Middle-ware.??
Distributed Operating System,Network OS and Middle-ware.??
Abdul Aslam
 

What's hot (20)

Distributed operating system
Distributed operating systemDistributed operating system
Distributed operating system
 
Chapter 1-distribute Computing
Chapter 1-distribute ComputingChapter 1-distribute Computing
Chapter 1-distribute Computing
 
Applications of Distributed Systems
Applications of Distributed SystemsApplications of Distributed Systems
Applications of Distributed Systems
 
Centralized vs distrbution system
Centralized vs distrbution systemCentralized vs distrbution system
Centralized vs distrbution system
 
Chapter 1 -_characterization_of_distributed_systems
Chapter 1 -_characterization_of_distributed_systemsChapter 1 -_characterization_of_distributed_systems
Chapter 1 -_characterization_of_distributed_systems
 
16.Distributed System Structure
16.Distributed System Structure16.Distributed System Structure
16.Distributed System Structure
 
Distributed Systems
Distributed SystemsDistributed Systems
Distributed Systems
 
Lecture 1 introduction to parallel and distributed computing
Lecture 1   introduction to parallel and distributed computingLecture 1   introduction to parallel and distributed computing
Lecture 1 introduction to parallel and distributed computing
 
Lecture 1 (distributed systems)
Lecture 1 (distributed systems)Lecture 1 (distributed systems)
Lecture 1 (distributed systems)
 
Distributed system architecture
Distributed system architectureDistributed system architecture
Distributed system architecture
 
Distributed operating system(os)
Distributed operating system(os)Distributed operating system(os)
Distributed operating system(os)
 
Design issues of dos
Design issues of dosDesign issues of dos
Design issues of dos
 
Fundamentals
FundamentalsFundamentals
Fundamentals
 
chapter 2 architecture
chapter 2 architecturechapter 2 architecture
chapter 2 architecture
 
Distributed OS - An Introduction
Distributed OS - An IntroductionDistributed OS - An Introduction
Distributed OS - An Introduction
 
Distributed & parallel system
Distributed & parallel systemDistributed & parallel system
Distributed & parallel system
 
Introduction to Parallel Computing
Introduction to Parallel ComputingIntroduction to Parallel Computing
Introduction to Parallel Computing
 
Distributed Shared Memory Systems
Distributed Shared Memory SystemsDistributed Shared Memory Systems
Distributed Shared Memory Systems
 
Distributed operating system
Distributed operating systemDistributed operating system
Distributed operating system
 
Distributed Operating System,Network OS and Middle-ware.??
Distributed Operating System,Network OS and Middle-ware.??Distributed Operating System,Network OS and Middle-ware.??
Distributed Operating System,Network OS and Middle-ware.??
 

Viewers also liked

Distributed Computing Seminar - Lecture 2: MapReduce Theory and Implementation
Distributed Computing Seminar - Lecture 2: MapReduce Theory and ImplementationDistributed Computing Seminar - Lecture 2: MapReduce Theory and Implementation
Distributed Computing Seminar - Lecture 2: MapReduce Theory and Implementationtugrulh
 
Distributed computing seminar lecture 3 - distributed file systems
Distributed computing seminar   lecture 3 - distributed file systemsDistributed computing seminar   lecture 3 - distributed file systems
Distributed computing seminar lecture 3 - distributed file systemstugrulh
 
distributed Computing system model
distributed Computing system modeldistributed Computing system model
distributed Computing system model
Harshad Umredkar
 
Client Server Model and Distributed Computing
Client Server Model and Distributed ComputingClient Server Model and Distributed Computing
Client Server Model and Distributed Computing
Abhishek Jaisingh
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
Hassan Dar
 
A short introduction to Spark and its benefits
A short introduction to Spark and its benefitsA short introduction to Spark and its benefits
A short introduction to Spark and its benefits
Johan Picard
 
Distributed computing the Google way
Distributed computing the Google wayDistributed computing the Google way
Distributed computing the Google wayEduard Hildebrandt
 
OpenMP Tutorial for Beginners
OpenMP Tutorial for BeginnersOpenMP Tutorial for Beginners
OpenMP Tutorial for Beginners
Dhanashree Prasad
 
Aos distibutted system
Aos distibutted systemAos distibutted system
Aos distibutted system
Vijay Kumar Verma
 
Optimizing Hive Queries
Optimizing Hive QueriesOptimizing Hive Queries
Optimizing Hive Queries
DataWorks Summit
 
Distributed computing environment
Distributed computing environmentDistributed computing environment
Distributed computing environment
Ravi Bhushan
 
Distributed computing
Distributed computingDistributed computing
Distributed computingKeshab Nath
 
Distributed computing
Distributed computingDistributed computing
Distributed computing
Alokeparna Choudhury
 
Google cluster architecture
Google cluster architecture Google cluster architecture
Google cluster architecture
Abhijeet Desai
 
Distributed computing ).ppt him
Distributed computing ).ppt himDistributed computing ).ppt him
Distributed computing ).ppt him
Himanshu Saini
 
Reservation Presentation
Reservation PresentationReservation Presentation
Reservation PresentationAmrish Jhaveri
 
Distributed computing
Distributed computingDistributed computing
Distributed computingshivli0769
 
Big Data Developers in Paris presentation : Social Data
Big Data Developers in Paris presentation : Social DataBig Data Developers in Paris presentation : Social Data
Big Data Developers in Paris presentation : Social Data
Abdellah Lamrani Alaoui
 
Introduction To Map Reduce
Introduction To Map ReduceIntroduction To Map Reduce
Introduction To Map Reducerantav
 

Viewers also liked (20)

Distributed Computing Seminar - Lecture 2: MapReduce Theory and Implementation
Distributed Computing Seminar - Lecture 2: MapReduce Theory and ImplementationDistributed Computing Seminar - Lecture 2: MapReduce Theory and Implementation
Distributed Computing Seminar - Lecture 2: MapReduce Theory and Implementation
 
Distributed computing seminar lecture 3 - distributed file systems
Distributed computing seminar   lecture 3 - distributed file systemsDistributed computing seminar   lecture 3 - distributed file systems
Distributed computing seminar lecture 3 - distributed file systems
 
distributed Computing system model
distributed Computing system modeldistributed Computing system model
distributed Computing system model
 
Client Server Model and Distributed Computing
Client Server Model and Distributed ComputingClient Server Model and Distributed Computing
Client Server Model and Distributed Computing
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
A short introduction to Spark and its benefits
A short introduction to Spark and its benefitsA short introduction to Spark and its benefits
A short introduction to Spark and its benefits
 
Distributed computing the Google way
Distributed computing the Google wayDistributed computing the Google way
Distributed computing the Google way
 
OpenMP Tutorial for Beginners
OpenMP Tutorial for BeginnersOpenMP Tutorial for Beginners
OpenMP Tutorial for Beginners
 
Aos distibutted system
Aos distibutted systemAos distibutted system
Aos distibutted system
 
Optimizing Hive Queries
Optimizing Hive QueriesOptimizing Hive Queries
Optimizing Hive Queries
 
Distributed computing environment
Distributed computing environmentDistributed computing environment
Distributed computing environment
 
Distributed computing
Distributed computingDistributed computing
Distributed computing
 
Distributed computing
Distributed computingDistributed computing
Distributed computing
 
Hive tuning
Hive tuningHive tuning
Hive tuning
 
Google cluster architecture
Google cluster architecture Google cluster architecture
Google cluster architecture
 
Distributed computing ).ppt him
Distributed computing ).ppt himDistributed computing ).ppt him
Distributed computing ).ppt him
 
Reservation Presentation
Reservation PresentationReservation Presentation
Reservation Presentation
 
Distributed computing
Distributed computingDistributed computing
Distributed computing
 
Big Data Developers in Paris presentation : Social Data
Big Data Developers in Paris presentation : Social DataBig Data Developers in Paris presentation : Social Data
Big Data Developers in Paris presentation : Social Data
 
Introduction To Map Reduce
Introduction To Map ReduceIntroduction To Map Reduce
Introduction To Map Reduce
 

Similar to Google: Cluster computing and MapReduce: Introduction to Distributed System Design

Introduction & Parellelization on large scale clusters
Introduction & Parellelization on large scale clustersIntroduction & Parellelization on large scale clusters
Introduction & Parellelization on large scale clustersSri Prasanna
 
Lec1 Intro
Lec1 IntroLec1 Intro
Lec1 Intro
mobius.cn
 
Introduction to Cluster Computing and Map Reduce (from Google)
Introduction to Cluster Computing and Map Reduce  (from Google)Introduction to Cluster Computing and Map Reduce  (from Google)
Introduction to Cluster Computing and Map Reduce (from Google)Sri Prasanna
 
Distributed computing presentation
Distributed computing presentationDistributed computing presentation
Distributed computing presentation
Delhi/NCR HUG
 
Multithreading 101
Multithreading 101Multithreading 101
Multithreading 101
Tim Penhey
 
cs2110Concurrency1.ppt
cs2110Concurrency1.pptcs2110Concurrency1.ppt
cs2110Concurrency1.ppt
narendra551069
 
Multi Threading
Multi ThreadingMulti Threading
what every web and app developer should know about multithreading
what every web and app developer should know about multithreadingwhat every web and app developer should know about multithreading
what every web and app developer should know about multithreading
Ilya Haykinson
 
Rust "Hot or Not" at Sioux
Rust "Hot or Not" at SiouxRust "Hot or Not" at Sioux
Rust "Hot or Not" at Sioux
nikomatsakis
 
Java concurrency
Java concurrencyJava concurrency
Java concurrency
ducquoc_vn
 
Low Level Exploits
Low Level ExploitsLow Level Exploits
Low Level Exploitshughpearse
 
Introto netthreads-090906214344-phpapp01
Introto netthreads-090906214344-phpapp01Introto netthreads-090906214344-phpapp01
Introto netthreads-090906214344-phpapp01Aravindharamanan S
 
slides8 SharedMemory.ppt
slides8 SharedMemory.pptslides8 SharedMemory.ppt
slides8 SharedMemory.ppt
aminnezarat
 
Multithreading Introduction and Lifecyle of thread
Multithreading Introduction and Lifecyle of threadMultithreading Introduction and Lifecyle of thread
Multithreading Introduction and Lifecyle of thread
Kartik Dube
 
04 threads-pbl-2-slots
04 threads-pbl-2-slots04 threads-pbl-2-slots
04 threads-pbl-2-slots
mha4
 
04 threads-pbl-2-slots
04 threads-pbl-2-slots04 threads-pbl-2-slots
04 threads-pbl-2-slots
mha4
 
MultiThreading in Python
MultiThreading in PythonMultiThreading in Python
MultiThreading in Python
SRINIVAS KOLAPARTHI
 
Programming Language Memory Models: What do Shared Variables Mean?
Programming Language Memory Models: What do Shared Variables Mean?Programming Language Memory Models: What do Shared Variables Mean?
Programming Language Memory Models: What do Shared Variables Mean?
greenwop
 
Os
OsOs

Similar to Google: Cluster computing and MapReduce: Introduction to Distributed System Design (20)

Introduction & Parellelization on large scale clusters
Introduction & Parellelization on large scale clustersIntroduction & Parellelization on large scale clusters
Introduction & Parellelization on large scale clusters
 
Lec1 Intro
Lec1 IntroLec1 Intro
Lec1 Intro
 
Introduction to Cluster Computing and Map Reduce (from Google)
Introduction to Cluster Computing and Map Reduce  (from Google)Introduction to Cluster Computing and Map Reduce  (from Google)
Introduction to Cluster Computing and Map Reduce (from Google)
 
Distributed computing presentation
Distributed computing presentationDistributed computing presentation
Distributed computing presentation
 
Multithreading 101
Multithreading 101Multithreading 101
Multithreading 101
 
cs2110Concurrency1.ppt
cs2110Concurrency1.pptcs2110Concurrency1.ppt
cs2110Concurrency1.ppt
 
Multi Threading
Multi ThreadingMulti Threading
Multi Threading
 
what every web and app developer should know about multithreading
what every web and app developer should know about multithreadingwhat every web and app developer should know about multithreading
what every web and app developer should know about multithreading
 
Rust "Hot or Not" at Sioux
Rust "Hot or Not" at SiouxRust "Hot or Not" at Sioux
Rust "Hot or Not" at Sioux
 
Java concurrency
Java concurrencyJava concurrency
Java concurrency
 
Low Level Exploits
Low Level ExploitsLow Level Exploits
Low Level Exploits
 
Introto netthreads-090906214344-phpapp01
Introto netthreads-090906214344-phpapp01Introto netthreads-090906214344-phpapp01
Introto netthreads-090906214344-phpapp01
 
slides8 SharedMemory.ppt
slides8 SharedMemory.pptslides8 SharedMemory.ppt
slides8 SharedMemory.ppt
 
Multithreading Introduction and Lifecyle of thread
Multithreading Introduction and Lifecyle of threadMultithreading Introduction and Lifecyle of thread
Multithreading Introduction and Lifecyle of thread
 
Chapter 6 os
Chapter 6 osChapter 6 os
Chapter 6 os
 
04 threads-pbl-2-slots
04 threads-pbl-2-slots04 threads-pbl-2-slots
04 threads-pbl-2-slots
 
04 threads-pbl-2-slots
04 threads-pbl-2-slots04 threads-pbl-2-slots
04 threads-pbl-2-slots
 
MultiThreading in Python
MultiThreading in PythonMultiThreading in Python
MultiThreading in Python
 
Programming Language Memory Models: What do Shared Variables Mean?
Programming Language Memory Models: What do Shared Variables Mean?Programming Language Memory Models: What do Shared Variables Mean?
Programming Language Memory Models: What do Shared Variables Mean?
 
Os
OsOs
Os
 

Recently uploaded

IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 

Recently uploaded (20)

IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 

Google: Cluster computing and MapReduce: Introduction to Distributed System Design

  • 1. Distributed Computing Seminar Lecture 1: Introduction to Distributed Computing & Systems Background Christophe Bisciglia, Aaron Kimball, & Sierra Michels-Slettvet Summer 2007 Except where otherwise noted, the contents of this presentation are © Copyright 2007 University of Washington and are licensed under the Creative Commons Attribution 2.5 License.
  • 2. Course Overview  5 lectures 1 Introduction  2 Technical Side: MapReduce & GFS  2 Theoretical: Algorithms for distributed computing  Readings + Questions nightly  Readings: http://code.google.com/edu/content/submissions/mapreduce-minilecture/listing.html  Questions: http://code.google.com/edu/content/submissions/mapreduce- minilecture/MapReduceMiniSeriesReadingQuestions.doc
  • 3. Outline  Introduction to Distributed Computing  Parallel vs. Distributed Computing  History of Distributed Computing  Parallelization and Synchronization  Networking Basics
  • 4. Computer Speedup Moore’s Law: “The density of transistors on a chip doubles every 18 months, for the same cost” (1965) Image: Tom’s Hardware and not subject to the Creative Commons license applicable to the rest of this work.
  • 5. Scope of problems  What can you do with 1 computer?  What can you do with 100 computers?  What can you do with an entire data center?
  • 6. Distributed problems  Rendering multiple frames of high-quality animation Image: DreamWorks Animation and not subject to the Creative Commons license applicable to the rest of this work.
  • 7. Distributed problems  Simulating several hundred or thousand characters Happy Feet © Kingdom Feature Productions; Lord of the Rings © New Line Cinema, neither image is subject to the Creative Commons license applicable to the rest of the work.
  • 8. Distributed problems  Indexing the web (Google)  Simulating an Internet-sized network for networking experiments (PlanetLab)  Speeding up content delivery (Akamai) What is the key attribute that all these examples have in common?
  • 9. Parallel vs. Distributed  Parallel computing can mean:  Vector processing of data  Multiple CPUs in a single computer  Distributed computing is multiple CPUs across many computers over the network
  • 10. A Brief History… 1975-85  Parallel computing was favored in the early years  Primarily vector-based at first  Gradually more thread- based parallelism was introduced Image: Computer Pictures Database and Cray Research Corp and is not subject to the Creative Commons license applicable to the rest of this work.
  • 11. A Brief History… 1985-95  “Massively parallel architectures” start rising in prominence  Message Passing Interface (MPI) and other libraries developed  Bandwidth was a big problem
  • 12. A Brief History… 1995-Today  Cluster/grid architecture increasingly dominant  Special node machines eschewed in favor of COTS technologies  Web-wide cluster software  Companies like Google take this to the extreme
  • 14. Parallelization Idea  Parallelization is “easy” if processing can be cleanly split into n units: work Partition problem w1 w2 w3
  • 15. Parallelization Idea (2) w1 w2 w3 Spawn worker threads: thread thread thread In a parallel computation, we would like to have as many threads as we have processors. e.g., a four- processor computer would be able to run four threads at the same time.
  • 16. Parallelization Idea (3) Workers process data: thread thread thread w1 w2 w3
  • 17. Parallelization Idea (4) thread thread thread w1 w2 w3 Report results results
  • 18. Parallelization Pitfalls But this model is too simple!  How do we assign work units to worker threads?  What if we have more work units than threads?  How do we aggregate the results at the end?  How do we know all the workers have finished?  What if the work cannot be divided into completely separate tasks? What is the common theme of all of these problems?
  • 19. Parallelization Pitfalls (2)  Each of these problems represents a point at which multiple threads must communicate with one another, or access a shared resource.  Golden rule: Any memory that can be used by multiple threads must have an associated synchronization system!
  • 20. What is Wrong With This? Thread 1: Thread 2: void foo() { void bar() { x++; y++; y = x; x+=3; } } If the initial state is y = 0, x = 6, what happens after these threads finish running?
  • 21. Multithreaded = Unpredictability  Many things that look like “one step” operations actually take several steps under the hood: Thread 1: Thread 2: void foo() { void bar() { eax = mem[x]; eax = mem[y]; inc eax; inc eax; mem[x] = eax; mem[y] = eax; ebx = mem[x]; eax = mem[x]; mem[y] = ebx; add eax, 3; } mem[x] = eax; }  When we run a multithreaded program, we don’t know what order threads run in, nor do we know when they will interrupt one another.
  • 22. Multithreaded = Unpredictability This applies to more than just integers:  Pulling work units from a queue  Reporting work back to master unit  Telling another thread that it can begin the “next phase” of processing … All require synchronization!
  • 23. Synchronization Primitives  A synchronization primitive is a special shared variable that guarantees that it can only be accessed atomically.  Hardware support guarantees that operations on synchronization primitives only ever take one step
  • 24. Semaphores  A semaphore is a flag Set: Reset: that can be raised or lowered in one step  Semaphores were flags that railroad engineers would use when entering a shared track Only one side of the semaphore can ever be red! (Can both be green?)
  • 25. Semaphores  set() and reset() can be thought of as lock() and unlock()  Calls to lock() when the semaphore is already locked cause the thread to block.  Pitfalls: Must “bind” semaphores to particular objects; must remember to unlock correctly
  • 26. The “corrected” example Thread 1: Thread 2: void foo() { void bar() { sem.lock(); sem.lock(); x++; y++; y = x; x+=3; sem.unlock(); sem.unlock(); } } Global var “Semaphore sem = new Semaphore();” guards access to x&y
  • 27. Condition Variables  A condition variable notifies threads that a particular condition has been met  Inform another thread that a queue now contains elements to pull from (or that it’s empty – request more elements!)  Pitfall: What if nobody’s listening?
  • 28. The final example Thread 1: Thread 2: void foo() { void bar() { sem.lock(); sem.lock(); x++; if(!fooDone) y = x; fooFinishedCV.wait(sem); fooDone = true; y++; sem.unlock(); x+=3; fooFinishedCV.notify(); sem.unlock(); } } Global vars: Semaphore sem = new Semaphore(); ConditionVar fooFinishedCV = new ConditionVar(); boolean fooDone = false;
  • 29. Too Much Synchronization? Deadlock Synchronization becomes even more complicated when multiple locks can be used Can cause entire system to “get stuck” Thread A: Thread B: semaphore1.lock(); semaphore2.lock(); semaphore2.lock(); semaphore1.lock(); /* use data guarded by /* use data guarded by semaphores */ semaphores */ semaphore1.unlock(); semaphore1.unlock(); semaphore2.unlock(); semaphore2.unlock(); (Image: RPI CSCI.4210 Operating Systems notes)
  • 30. The Moral: Be Careful!  Synchronization is hard  Need to consider all possible shared state  Must keep locks organized and use them consistently and correctly  Knowing there are bugs may be tricky; fixing them can be even worse!  Keeping shared state to a minimum reduces total system complexity
  • 32. Sockets: The Internet = tubes?  A socket is the basic network interface  Provides a two-way “pipe” abstraction between two applications  Client creates a socket, and connects to the server, who receives a socket representing the other side
  • 33. Ports  Within an IP address, a port is a sub-address identifying a listening program  Allows multiple clients to connect to a server at once
  • 34. What makes this work?  Underneath the socket layer are several more protocols  Most important are TCP and IP (which are used hand-in-hand so often, they’re often spoken of as one protocol: TCP/IP) TCP IP header Your data header Even more low-level protocols handle how data is sent over Ethernet wires, or how bits are sent through the air using 802.11 wireless…
  • 35. Why is This Necessary?  Not actually tube-like “underneath the hood”  Unlike phone system (circuit switched), the packet switched Internet uses many routes at once you www.google.com
  • 36. Networking Issues  If a party to a socket disconnects, how much data did they receive?  … Did they crash? Or did a machine in the middle?  Can someone in the middle intercept/modify our data?  Traffic congestion makes switch/router topology important for efficient throughput
  • 37. Conclusions  Processing more data means using more machines at the same time  Cooperation between processes requires synchronization  Designing real distributed systems requires consideration of networking topology  Next time: How MapReduce works