Quiz questions - PowerPoint PPT Presentation

1 / 27
About This Presentation
Title:

Quiz questions

Description:

PLC Boot Server. 1. Boots from BootCD (Linux loaded) 2. Hardware initialized ... 12. Verify node key, change state to 'boot' 5. Send boot manager ... – PowerPoint PPT presentation

Number of Views:22
Avg rating:3.0/5.0
Slides: 28
Provided by: steve1811
Category:
Tags: boot | questions | quiz

less

Transcript and Presenter's Notes

Title: Quiz questions


1
Lecture 9
  • Quiz questions
  • Epidemic communication protocols
  • Naming services

2
Quiz sample question
  • Discuss the advantages and drawbacks of a server
    design using non-blocking I/O, a state machine
    and a single thread with a design using blocking
    I/O multi-threading.

3
Quiz sample question
  • The C language has a construct called union in
    which a field of a record can hold one of several
    alternatives.
  • For example the following piece of code declares
    a new union type union_def. Variables of this
    type can hold either one of an integer, a float
    or a character.
  • union union_def int a float b char c //
    define the type
  • union union_def union_var // define the
    variable
  • union_var.b99.99 or // initialize the
    variable
  • union_var.a34
  • At runtime there is no clear cut way for the
    runtime system to tell what datatype is stored in
    a variable declared as an union.
  • Does this language feature have any implication
    for remote procedure calls? Explain your answer.

4
Q10
  • Protocol clients sends 16 bytes code. Server
    answers 0/1 encoded in one byte.
  • Question Is the following code correct?
  • public class ccServer
  • private static final int BUFSIZE 16
    // Size of receive buffer
  • public static void main(String args) throws
    IOException
  • int servPort Integer.parseInt(args0)
  • // Create a server socket and buffer to
    accept client connections
  • ServerSocket servSock new
    ServerSocket(servPort)
  • byte byteBuffer new byteBUFSIZE
    // Receive buffer
  • for () // Run forever, accepting and
    servicing connections
  • Socket clntSock servSock.accept()
    // Get client connection
  • InputStream in clntSock.getInputStr
    eam()
  • OutputStream out clntSock.getOutputS
    tream()
  • // Receive until client closes connection,
    indicated by -1 return
  • in.read(byteBuffer))

5
  • What are the pros and cons of using epidemic
    protocols for disseminating information?

6
Last time Anti-Entropy Protocols
  • A node P selects another node Q from the system
    at random.
  • Push P only sends its updates to Q
  • Pull P only retrieves updates from Q
  • Push-Pull P and Q exchange mutual updates (after
    which they hold the same information).
  • Observation for push-pull it takes O(log(N))
    rounds
  • to disseminate updates to all N nodes
  • one round every node as taken the initiative to
    start one exchange.
  • Main properties
  • Reliability a node failures do not impact the
    protocol
  • Dissemination time effort, scales well with the
    number of nodes

7
Last time Gossiping
  • Basic model A node S having an update to report,
    contacts other randomly chosen servers.
  • Termination decision
  • If the contacted node already has the update S
    stops contacting other nodes with probability
    1/k.
  • P the share of nodes that have not been reached
  • P e -(k1)(1-p)

ln(P)
8
Last time Example applications
  • Data dissemination in p2p, wireless sensor
    networks, clusters
  • Spreading updates
  • E.g., disconnected replicated list maintenance
    Demers et al., Epidemic algorithms for
    replicated database maintenance. SOSP87
  • Membership protocols
  • e.g., Amazon Dynamo service DeCandia et. al,
    Dynamo Amazons Highly Available Key-value
    Store, SOSP07
  • Various p2p networks (e.g., Tribler)
  • Data aggregation
  • The problem compute the average value for a
    large set of sensors
  • Let every node i maintain a variable xi. When two
    nodes gossip, they each reset their variable to
  • xi, xk ?(xi xk)/2
  • Result in the end each node will have computed
    the average
  • avg sum(xi))/N.

9
Advantages of epidemic techniques
  • Probabilistic model. Rigorous mathematical
    underpinnings. Good framework for reasoning about
    the spread of information through a system over
    time.
  • A-synchronous communication pattern. Operate in a
    'fire-and -forget' mode, where, even if the
    initial sender fails, surviving nodes will
    receive the update.
  • Autonomous actions. Enable you to take actions
    based on the data you received without the need
    for additional communication to reach agreement
    with your partners you can take decisions
    autonomously.
  • Robust with respect to message loss node
    failures. Once a message has been received by at
    least one of your peers it is almost impossible
    to prevent the spread of the information through
    the system.

10
Naming Systems Distributed Hash Tables
11
Naming systems
  • Functionality
  • Map names ? access points (addresses)
  • Names are used to denote entities in a
    distributed system.
  • To operate on an entity, we need to access it at
    an access point (address).
  • Note A location-independent name for an entity
    E, is independent from the addresses of the
    access points offered by E.

12
Names are valuable!
  • NYT, August00

13
Naming systems
  • Functionality
  • Map names ? access points (addresses)
  • Main challenge scaling
  • of names, clients
  • geographical distribution,
  • management

14
Terminology
  • Names
  • Human friendly vs. arbitrary (random strings)
  • Names vs. identifiers
  • Identifiers have three properties
  • refer to at most one entry
  • each entity is referred by at most one identifier
  • always refers to the same entity
  • Name space
  • Flat vs. hierarchical

15
Next
  • Naming system implementations
  • Flat namespace
  • Distributed Hash Tables
  • Hierarchical Namespace
  • DNS

16
Strawman (1)
  • Why not centralize?

17
Strawman (1)
  • Why not centralize?
  • Single point of failure
  • High latency
  • Distant centralized database
  • Scalability bottleneck
  • Traffic volume
  • Management Single point of update

18
Strawman (2)
  • Why not use /etc/hosts?

19
Strawman (2)
  • Why not use /etc/hosts?
  • Original Name to Address Mapping
  • Flat namespace
  • /etc/hosts
  • SRI kept main copy
  • Downloaded regularly
  • Count of hosts was increasing machine per domain
    ? machine per user
  • Many more downloads
  • Many more updates
  • Still a scalability bottleneck

20
Implementation options Flat namespace
  • Problem Given an essentially unstructured name
    how can we locate its associated address?
  • Possible designs
  • Simple solutions (broadcasting, forwarding
    pointers)
  • Home-based approaches
  • Distributed Hash Tables (structured P2P)

21
Flat namespaces simple solutions
  • Broadcasting Simply broadcast the ID, requesting
    the entity to return its current address.
  • Can never scale beyond local-area networks (think
    of ARP/RARP)
  • Requires all processes to listen to incoming
    location requests
  • Forwarding pointers Each time an entity moves,
    it leaves behind a pointer telling where it has
    gone to.
  • Update a clients reference as soon as present
    location has been found
  • Geographical scalability problems
  • Long chains are not fault tolerant
  • Increased network latency at dereferencing

22
  • Functionality to implement
  • Map names ? access points (addresses)
  • Similar to a hash-table
  • Manage (huge) list of (name, access point) pairs
  • Put (key, value)
  • Lookup (key) ? value
  • Key idea partitioning.
  • Allocate parts of the list to different nodes

23
Partition Solution Consistent hashing
  • Consistent hashing
  • the output range of a hash function is treated as
    a fixed circular space or ring.

0
128
Circular ID Space
24
Partition Solution Consistent hashing
  • Mapping keys to nodes
  • Advantages incremental scalability, load
    balancing

N10
Key ID Node ID
K5, K10
N100
K99
Circular ID Space
N32
K11, K30
N80
K65, K70
N60
K33, K40, K52
25
Consistent hashing
  • How do store lookup work?

N10
Key ID Node ID
K5, K10
N100
K99
N32
K11, K30
N80
K65, K70
N60
K33, K40, K52
26
Consistent Hashing -- Summary
  • Mechanism
  • Nodes get an identity by hashing their IP
    address, keys are also hashed into same space
  • A key with id (hashed into) k, is assigned to
    first node whose hashed id is equal or follows k,
    in circular space successor(k)
  • Advantage
  • Incremental scalability, Balanced Distribution,
  • Theoretical results
  • N number of nodes, K number of keys in the
    system
  • With high probability Each node is responsible
    for at most (1?)K/N keys
  • With high probability Joining or leaving of a
    node relocates O(K/N) keys (and only to or from
    the responsible node)

27
Extra consistent hashing tricks
  • Virtual Nodes Each physical node can be
    responsible for multiple virtual nodes.
  • Advantage load balancing
  • Dealing with heterogeneity The number of virtual
    nodes that a node is responsible for can decided
    based on its capacity, accounting for
    heterogeneity in the physical infrastructure.
  • If a node becomes unavailable the load handled by
    this node is evenly dispersed across the
    remaining available nodes.
  • When a node becomes available again, the newly
    available node accepts a roughly equivalent
    amount of load from each of the other available
    nodes.
Write a Comment
User Comments (0)
About PowerShow.com