Software Systems Spring 2008 For today, you should have: 1) started Homework 3 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) Homework 3 questions? 2) Waldspurger and Weihl 3) performance evaluation techniques 4) count.c 5) fork.c 7) One-minute paper. For next time you should: 1) work on Homework 3 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) 5) prepare for a quiz 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 If you know about lex, you could generate a word counter like this: count.lex: int wordcount = 0; %option noyywrap %% [A-Za-z]+[^A-Za-z]+ ++wordcount; %% int main() { yylex(); printf("%d\n", wordcount); return (0); } 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.