CS 3733 Operating Systems, Spring 2007 Assignment 1 Comments

  1. A single staple in the upper left corner will do. The main lab has a variety of staplers that you can use.
  2. You need to learn how to use lint.
    Each run of lint should have one file that contains a main and as many additional files as necessary.
    For Part 1, the appropriate line is:
    lint assign1-1.c labrary1.c
    ssh to one of the Sun machines (pandora is a good one to choose) to run lint.
  3. You should avoid any arbitrary restrictions on the size of buffers that you need to solve the problem.
    Sizes can be determined dynamically.
  4. You do not need to call free before you exit the program.
  5. You must check for and handle errors such as a NULL return from malloc.
  6. Do not print in the library functions.
  7. Do not exit the program from a library function when an error occurs.
    Return an error code and allow the calling program to take the appropriate action.
  8. Declarations must appear at the start of a block, not after executable statements.
  9. Do not ignore lint warnings about methods implicitly declared to return int. This usually indicates a missing include.
  10. What is wrong with the following:
    while(argv[i] != '\0')
  11. Do not submit an assignment more than once.
  12. For the test in part 2, note that 1 comes before 8 in the output string because of the stated rule for breaking ties. I didn't catch this error on the first ones I graded, so I did not take off points for it.
  13. If you got fewer than 15 points on this assignment, you should see me.

Here are some answers:

This is Part 1 and was written by S. Robbins
Input values: 16 4 5 7 3 1 8 9 4 2 
output string: 00000000000000001111222223333333444566666666777777777888899
Output values: 0 16 20 25 32 35 36 44 53 57 
average is 31.800000

This is Part 2 and was written by S. Robbins
Input values: 16 4 5 7 3 1 8 9 4 2 
output string: 59944411118888222223333333666666667777777770000000000000000
Output values: 43 6 14 19 3 0 26 34 10 1 
average is 15.600000

This is Part 3 and was written by S. Robbins
Input values: 16 4 5 7 3 1 8 9 4 2 
out_size is 59
output string: 00011122233344456667778889900012233366677780003667770000000
Output values: 43 27 28 40 12 15 41 43 39 25 
average is 31.300000