📝 Pastry applications in P2P (8 MCQs)
Routing Substrate for Distributed Services
Pastry supplies application-level message routing and object location over a peer-to-peer overlay. Applications provide a key, and Pastry delivers the message to the live node whose identifier is numerically closest to that key. It does not prescribe the application's content format, storage policy, or user interface. Prefix matches direct logical progress; physical proximity remains a separate consideration. This supports distributed applications.
Storage, Sharing, Naming, and Group Communication
A distributed storage system can use Pastry to locate metadata or content fragments. A sharing application can route provider queries, while a naming service can associate identifiers with service records. Group communication systems can build membership or message-delivery functions on top of Pastry's routing substrate. Sets organize routing state by prefix, proximity, and identifier order.
Application Request and Overlay Delivery
The application hashes or otherwise assigns a destination key, creates a message, and passes both to the local Pastry layer. Pastry forwards the message through routing-table or leaf-set entries. The destination application then processes the message, returning data or coordinating a separate transfer when required. Every hop must improve the prefix or satisfy the fallback rule.
Locating a Distributed Storage Object
Suppose a storage application maps object name report-17 to key K. A client sends a request through Pastry, which delivers it to the live node closest to K. That node checks its application-level storage or index and responds with metadata or a location for the object's actual content. The selected peer advances the key's shared prefix match at this stage.
Locality and Peer-Failure Considerations
Pastry's locality-aware state can reduce network path costs for routing choices, while its leaf set and routing table support adaptation to membership changes. Applications must still handle replication, data integrity, permissions, and unreachable peers. Successful message routing does not guarantee that an application object remains available. The application remains responsible for stored data and service permissions.
Pastry Does Not Store Every Application Object
'Pastry automatically stores all files' confuses routing with storage. 'The numerically closest peer is always geographically closest' ignores the distinction between identifier order and network proximity. 'A routed message guarantees a successful service operation' overlooks application errors, missing data, and access restrictions. Identifier order and network proximity remain separate routing criteria in Pastry.
Application Flow and Layer Responsibilities
Be prepared to separate application key creation, overlay routing, destination processing, and any subsequent data transfer. Identify what Pastry contributes and what the application implements itself. In scenario questions, explain how locality information may improve route choice without changing the destination key or replacing IP routing. Name the routing table row, fallback candidate, and leaf set decision clearly.
Pastry Application and Service Terms
- Object location - Finding the responsible object peer..
- Routing substrate - Service for overlay message delivery..
- Storage fragment - Object portion stored on a peer..
- Service record - Data describing a service endpoint..
- Locality - Preference for network close peers..
- Membership - Current nodes participating in an overlay..
📝 All Pastry applications in P2P MCQs
Q1. In a set of symbols with frequencies , , , , and , which two symbols are combined first when building the Huffman tree?
📖 Explanation: The Huffman algorithm always merges the two lowest‑frequency nodes. Here the smallest frequencies are and ; merging them yields a new node of weight . No other pair has a combined weight lower than , so the correct pair is C and E.
Q2. Compared to a fixed‑length code of 3 bits per symbol, which statement correctly describes the average bits per symbol for the Huffman code built from the frequencies in the previous question?
📖 Explanation: Because Huffman coding assigns shorter codes to high‑frequency symbols and longer codes to low‑frequency ones, the weighted average length is always lower than the uniform length of a fixed‑length code when symbol frequencies are non‑uniform. Hence the average bits per symbol is less than 3.
Q3. Given symbols , , and constructing a Huffman tree, which binary code is assigned to symbol ?
📖 Explanation: First, combine the two smallest frequencies and to create a node of weight . This node and are then merged at the root. Assigning 0 to the left branch and 1 to the right, the path to is left‑left, yielding the code .}
Q4. During LZW decoding, if the current codeword does not yet exist in the dictionary, what string should the decoder output?
📖 Explanation: When a codeword is absent, the decoder follows the special rule: output the previous string plus its own first character. This constructs the new entry that will later be added to the dictionary, preserving the algorithm’s consistency.
Q5. If the frequency of a symbol in a Huffman tree is increased, what is the most likely effect on the length of its codeword?
📖 Explanation: Increasing a symbol's frequency makes it more likely to be merged earlier with other low‑frequency nodes, moving it closer to the root. Consequently, the path from root to that leaf shortens, reducing the number of bits required to represent the symbol.
Q6. Which of the following sequences correctly describes the steps to construct a Huffman coding table from a set of symbol frequencies?
📖 Explanation: The proper workflow is: first build the Huffman tree by repeatedly merging the two lowest‑frequency nodes; then traverse the completed tree to assign binary digits to each branch, producing the code for each symbol; finally, compile these codes into a coding table.
Q7. Using the Huffman tree where A=00, B=01, C=10, and D=11, what is the encoded bitstring for the message \ABCA\?
📖 Explanation: Encode each character sequentially: A→00, B→01, C→10, A→00. Concatenating yields 00 01 10 00, i.e., the bitstring \00011000\. Any other arrangement would mismatch the defined codes.
Q8. In an LZW compression example, the decoder outputs \ABAB\ instead of the expected \ABBA\. Which step is most likely the source of the error?
📖 Explanation: When the codeword size is not updated at the correct point, later codewords are read with the wrong number of bits, causing misalignment. This typically leads to the decoder interpreting subsequent codes incorrectly, producing a string like \ABAB\ instead of the intended \ABBA\.