Homework 3

Please draw upon the material in Lectures 6 through 9 as well as the textbook chapters that they cover to answer the questions below.

  1. One of the major differences between traditional software life cycles and agile life cycles is the practice of developing software in short, incremental iterations with the results of an iteration shown to the customer for feedback. What problem with traditional life cycles does this practice address and what benefits does it provide? (6 points)
  2. In the design of concurrent software systems there are two key elements that need to be addressed: task decomposition and thread allocation. Why must these two elements be separted? Why not just treat tasks and threads as equivalent? (4 points)
  3. To perform thread allocation, we use the equation
    Number of Threads = Number of Cores / (1 - Blocking Coefficient)
    What does the blocking coefficient mean in this context and why does it demand that we allocate more threads the closer it approaches the value of 1? Why can we be confident that the blocking coefficient's value will never reach 1? (6 points)
  4. There are three styles of concurrent design: shared mutability, isolated mutability, and pure immutability. When considered in this order (shared, isolated, pure), the key theme is to encourage the use of &ldquot;variables&rdquot; that point to immutable values and never point to anything else over the life of the program (hence actually playing the role of constants). Why is the use of mutable variables being discouraged? What benefits does reducing the number of mutable variables in your concurrent programs provide? (4 points)
  5. Using the template for concurrency in IO-intensive applications provided by the book in section 2.2 (AbstractNAV, SequentialNAV, ConcurrencyNAV), create a program that gathers tweets for twitter users as described on slides 3 and 4 of Lecture 10. Create the sequentail version of the program first and then move on to creating a concurrent version. Note: when accessing Twitter in this way, Twitter restricts your program to making 150 requests per hour. This means that trying to collect all 3200 tweets for just 9 users will nearly consume the number of API hits that you can use in one hour (9*16=144). To monitor, how many requests you have left in a given hour, you can enter the following URL in a web browser:

    http://api.twitter.com/1/account/rate_limit_status.json

    Look for the field labelled “remaining_hits” to see how many requests you have left. You will need to limit your debugging such that you honor the remaining hits that Twitter has allocated to your IP address. If you do not, you risk having Twitter ban your IP for several hours!

    For this question, you will submit the sequential version of the program (10 points), the output of a typical run of the sequential program to collect the tweets for 9 users showing how long it took in seconds (2 points), the concurrent version of the program (10 points) and its output (2 points), and a README file that describes the approach you took to implementing each program (6 points). (30 points total)

    Note: your program should be implemented as a batch program, just like the one shown in section 2.2 of the concurrency textbook. You do not have to create a logic that has the program monitor its hit rates on twitter and adjusts its behavior accordingly. That type of behavior is out-of-scope. Simply ensure that your input to the program (a list of twitter user names) ensures that you will keep your requests under the 150 per hour limit. In addition, you can pick your twitter user names to ensure that each account has more than 3200 tweets. In other words, you do not need to deal with users who have less than 3200 tweets and thus do not have a full 16 pages of tweets to return to your requets.

This assignment is worth 50 points.

In-Class Students: Please upload an archive containing your answers (PDF document, README document, source code, and input files) for this assignment to the moodle before the start of Lecture 14 on Thursday, March 1st, and bring a hardcopy of your assignment and source code to Lecture 14.

CAETE Students: Please upload an archive containing your answers (PDF document, README document, source code, and input files) for this assignment to the moodle by 9:30 AM on Thursday, March 1st.


© University of Colorado, Boulder 2011