Software Systems Fall 2006 For today, you should have: 0) prepared for a quiz. 1) started Homework 3 (due Thursday 28 September) 2) Read the Cow book, and written a word counter. 3) Read Waldspurger and Weihl. 4) Read the next section of the LBoS. Outline: 1) quiz 2) Homework 3 questions? 3) Waldspurger and Weihl 4) performance evaluation techniques 5) count.c 6) fork.c 7) Two-phase barrier 8) One-minute paper. For next time you should: 1) work on Homework 3 (due Thursday 28 September) 2) Read Chapter 10 of the Cow Book 3) Do the next semaphore problem (exclusive queue) 4) Read Tanenbaum page 202-210 (no reading questions) Performance evaluation techniques --------------------------------- 1) Analysis: only works for very simple strategies/models 2) Simulation: useful for checking out wide range of possibilities. depends on workload model or traces 3) Implementation: most reliable, but also depends on workload Of the three kinds of performance evaluation (analysis, simulation, implementation) which do Waldspurger and Weihl do? What is their workload or workload model? What are their performance metrics? count.c ------- You can find all the examples in the Cow Book online, or download wb/ss/code/cow_book_examples.tar In general, a good way to program is to start with something similar to what you want and go from there. I started with copy.c on page 211 isspace and other character classifiers are in ctype.h type "man isspace" for more info The results of count.c agree with wc (at least for WarAndPeace.txt), so apparently we are using the same definition of "word" Number of words in WarAndPeace.txt is 566237 fork.c ------ 1) Download fork.c from wb/ss/code 2) Read over the code and make sure you understand it. 3) Compile and run the program. If you run it without a command-line argument, it creates one child process: ./fork Otherwise you can tell it how many children ./fork 5 4) Confirm that the parent and child processes run in separate address spaces. 5) In the current program, what does the elapsed time measure? How long does it take to create a new process? 6) Copy the time-measurement code into pthread.d and estimate how long it takes to create a new thread. Two-phase barrier ----------------- Download a new copy of Sync.py 1) cd into the directory that contains Sync.py 2) rm Sync.py (get rid of the old one) 3) wget http://wb/ss/code/Sync.py 4) wget http://wb/ss/code/rebar5.py 5) Run python Sync.py rebar5.py rebar5.py contains the solution from page 43 of the book. Try it out and see if you are convinced it is correct. In other news: does the Exclusive Queue puzzle make sense?