CS 3733 Operating Systems, Fall 2008 Recitation Session 6


Wednesday, Oectober 8.

In this session you will experiment with compiling and running programs that use threads under both Linux and Solaris.

  1. Log on to your Linux Account.
  2. Create a rec06 directory.
  3. Put copies of the following programs in your rec06 directory:
  4. We have discussed these programs in class. Review them and make sure you understand what they do. Compile the programs using make.
  5. In the following parts of the recitation you will be answering questions about the results of the runs you do. Put the answers in a file called answers06.txt in your rec06 directory. Number each answer with the corresponding part of the recitation. For example, the first answer should be labeled with a 6. The first line of this file should contain your name. You will only be graded on having completed answers to these questions, not on the quality of your answers.
  6. Run the getsizeschild program by executing:
         make runchild
    Which of the values were reported correctly? Explain why each of the incorrect ones were incorrect.
  7. How would the answer above change if the parent waited for the child before using the results?
  8. Run the getsizesthread program by executing:
         make runthread
    Which of the values were reported correctly? Explain why each of the incorrect ones were incorrect.
  9. Comment out the four lines in getsizesthread.c that correspond to the pthread_join. Explain the results when you compile and run the program again and explain why the results should or should not be the same as before.
  10. Remove the comments and compile and run the program again. Confirm that the results are what is expected.
  11. Remove the reference to LIBTHREAD in the compile line for getsizesthread in the makefile.
  12. Execute
         make clean
         make
    If the program compiles, run it again. Describe the results.
  13. Put back the reference to LIBTHREAD in the makefile. Compile again and convince yourself that the program is working correctly.
  14. Remotely log into one of the Sun machines in the Sun lab and go into the rec06 directory. (The Sun machines pandora1 and pandor2 are good ones to use.) Compile the programs by executing:
         make clean
         make
  15. Run the two programs again and describe the results. Are they the same on this systems as they were under Linux?
  16. Redo Part 9 on this system and describe the results.
  17. Remove the comments and compile and run the program again. Confirm that the results are what is expected.
  18. Remove the reference to LIBTHREAD in the compile line for getsizesthread in the makefile.
  19. Redo Part 12 on this system and describe the results. Compare the results with those of Part 12 on the Linux system.
  20. Check that your file answers06.txt has answers labeled for parts 6, 7, 8, 9, 12, 15, 16 and 19.
  21. Copy your answers06.txt to somewhere in your web directory and put a link to it on your cs3733 web page.
  22. Show the TA your web page and that you have answered all of the questions.