Goal: hack ssh to add back door #1 add backdoor into ssh source #2 change the C compiler #3 change the C compiler to change itself and future versions Reaching Consensus group of processes and machines, they want to reach consensus. Lot of problems. Examples of consensus: electing a leader, primary replica vs. secondary replica. counter, assign a unique id to every request Lot of problems can be represented as a consensus problem. 'Reach a consensus in the face of network failures (network may drop, delay, or corrupt messages)' Implement consensus even when network is faulty. Also, have consensus if some fraction of processes are faulty. A bunch of processes running on multiple machines Handle some fraction of faulty processes, (may have died, have bugs or even have been taking over by an attack) could be malicious. Try to screw up the consensus protocol. Is a certain maximal percentage of faulty processes that we can still reach consensus. Less than a third of processes are faulty in order to reach consensus. Byzantine generals problem. Step 1 Assume all processes fail cleanly. * Simply stops responding to messages and won't turn malicious, just dies * How to handle unreliable network? How to detect if machine is down? * Use a timeout and resend message. (Still not guaranteed to work w/ faulty network) * Assume that if we keep trying to send a message eventually it will be let through * Exponential backoff (exponentially decay the wait time). Impose a maximal time. Step 2 Process can fail arbitrarily * Assume we have n processes, m of them are faulty (how high can m be before we fail consensus?) * Set of processes {P1, P2, ...,Pn} Each have private value vi. Try to share your vote, Goal: every process has same global view every process creates a vector xi = (V1i, V2i ...Vni) of what they think everyone elses vote is At the end, we want vectors to match. That everyone has the same global view. iff Pi and Pj are non faulty at the end of protocol Xi = Xj * Any correct algorithm must have n >= 3m + 1. No way protocol will succeed if more than 1/3 are faulty m=1, n=4 : 2 rounds of messages in round 1, every process broadcasts Vi. malicious programs won't follow protocol (send wrong things etc.) in round 2, everybody sends Xi to everyone. X1 = (V1i, V2i,V3i, V4i) Compare all four, for each value take majority In all non faulty processes they arrive at the same value. If process doesn't agree, they are faulty. Most distributed systems are implemented in client server style. (Web server, mail server etc.) Server has unfair share of the load. Problems: * Single point of failure, if the server goes down the whole service goes down. * Scalability, must move beyond one machine or one set of machines * Single point of attack. (DDoS) Decentralized system = Peer to peer system When Napster's server was shutdown it no longer worked. Model: * Each node is both a client and a server * Communicate with other nodes * View network as a graph. Peers can connect to arbitrarily connect to each other (removing one node doesn't affect the system How do you find the peer with the content you are looking for ? * Have to flood the network (not scalable) * Scoped flood (can't look beyond a certain number of hops) * kazaa, gnutella -> unstructured overlay * build a structured overlay Structured overlay * Consistent hashing: Define a keyspace, key is some 160-bit value assign key to objects assign key to nodes * Nearest node to a piece of content stores that content * If one node leaves, only the content close to that node gets affected * who is the closest node to an arbitrary key? * Each node knows exponentially more about its local neighbor * Take network and divide it into regions (the keyspace, not the underlying network) * Regions are based on prefixes (000,001 ...) * Want to find closest node to arbitrary key * Need routing table, Row 0: pointer to a person in each region (except our own) Row 1: pointer to subdivision (41,42,43...) (except our own) If we're looking for a 0, we send a message to the person in our column for 0 who knows exponentially more about region 0, he then sends it to the closest person in his row 1, and this continues until we find the closest. Example Systems: Pastry, Chord Final Exam: Next week in class, same length as midterm. Only on material since the midterm. Storage systems (hard drives etc.) file systems Security (access control) Distributed System Pintos projects 2 and 3 Open book (either problem solving, or what are advantages/disadvantages)