Open source implementation 68 bittorrent exercises 1

Info icon This preview shows pages 40–43. Sign up to view the full content.

Open Source Implementation 6.8: BitTorrent Exercises 1. Explore the locality by considering the round trip delay and changing the random selection code in the getNextOptimisticPeer() function accordingly. For example, you may give preference to peers with lower round trip delay. 2. Discuss why it is important to consider locality in choosing optimistic unchoked peers. Note that optimistic unchoke plays an initiation role in finding potential tit-for-tat peers. Answer (1.5 hour) : 1. The random selection code in the getNextOptimisticPeer() function is listed as
Image of page 40

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Computer Networks: An Open Source Approach 41 follows : for (int i=0;i<num_needed && optimistics.size() > 0;i++ ){ int rand_pos = new Random().nextInt( optimistics.size() ); result.add( optimistics.remove( rand_pos )); } Replacing the original code with following instructions allows us to give preference to peers with lower round trip delay : //The method getRTT() implemented in DHTSpeedTesterImpl.java allows us to //get the RTT of a neighbor peer’s RTT. The ping function is called by getRTT() to //measure the RTT of a neighbor peer. import com.aelitis.azureus.core.dht.speed.impl.DHTSpeedTesterImpl; long[] RTT = new long[ optimistics.size() ]; ArrayList<PEPeer> RTTpeer = new ArrayList<PEPeer>( optimistics.size() ); //For each peer in the list of optimistic peers, get its RTT and sort the list //based on RTT, put the result to RTTpeer for (int i=0;i< optimistics.size();i++ ){ PEPeer peer = all_peers.get( i ); potentialPing pp = (potentialPing) optimistic.get(i); int newRTT = pp.getRTT() updateLargestValueFirstSort( newRTT, RTT, peer, RTTpeer, 0 ); } //Sequentially output RTTpeer to the list of optimistic peers for (int i=RTTpeer.size();i=RTTpeer.size()-num_needed;i-- ){ result.add( RTTpeer.remove( i )); } 2. Two peers having shorter RTT implies that they are physically near to each other. When selecting an optimistic peer, we actually give the peer a chance to receive data from us. Since tit-for-tat is based on the amount of upload data from a neghbor peer, we in turn get a better chance to become a tit-for-tat peer of the selected optimistic peer. With goodwill, the selected optimistic peer will become our tit-for-tat peer later. Therefore, considering locality in choosing optimistic unchoked peer also results in better locality of tit-for-tat peers. Open Source Implementation 7.1: Traffic Control Elements in Linux
Image of page 41
Computer Networks: An Open Source Approach 42 Exercises Could you re-configure your Linux kernel to install the TC modules and then figure out how to setup these modules? In the following open source implementations in this chapter, we shall detail several TC elements related to the text. Thus, it is a good time here to prepare yourself with this exercise. You can find useful references in Further Readings of this chapter. Answer (1 hour): Using make menuconfig->Code maturity level options->Prompt for development and /or incomplete code/drivers Open Source Implementation 7.2: Traffic Estimator Exercises 1. Could you explain how Line 6 or 10 performs the EWMA operation? What is the value of the historical parameter w used in the operation?
Image of page 42

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Image of page 43
This is the end of the preview. Sign up to access the rest of the document.
  • Winter '15
  • MAhmoudali
  • IP address, Transmission Control Protocol

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern