COMP 3000 Lab 6 2012: Difference between revisions

From Soma-notes
Created page with "This lab is due on Friday, Nov. 9, at 11:55 PM. Run the following three commands in bash. rm -f /tmp/race.txt x=0; while builtin test $x -lt 50000; do echo "P1 C1 $x"; e..."
 
No edit summary
Line 1: Line 1:
This lab is due on Friday, Nov. 9, at 11:55 PM.
This lab is due on Friday, Nov. 9, at 11:55 PM.


Run the following three commands in bash.   
Run the following three commands in bash.  (Note the \ is just to note the command continues on the following line.)


  rm -f /tmp/race.txt
  rm -f /tmp/race.txt
  x=0; while builtin test $x -lt 50000; do echo "P1 C1 $x"; echo "P1 C2 $x"; echo "P1 C3 $x"; let x=$(($x + 1)); done >> race.txt &
  x=0; while builtin test $x -lt 50000; do echo "P1 C1 $x"; echo "P1 C2 $x"; \
  y=0; while builtin test $y -lt 50000; do echo "P2 C1 $y"; echo "P2 C2 $x"; echo "P2 C3 $x"; let x=$(($x + 1)); done >> race.txt &
  echo "P1 C3 $x"; let x=$(($x + 1)); done >> race.txt &
  y=0; while builtin test $y -lt 50000; do echo "P2 C1 $y"; echo "P2 C2 $x"; \
  echo "P2 C3 $x"; let x=$(($x + 1)); done >> race.txt &


The following questions are based on these three lines.
The following questions are based on these three lines.

Revision as of 15:15, 5 November 2012

This lab is due on Friday, Nov. 9, at 11:55 PM.

Run the following three commands in bash. (Note the \ is just to note the command continues on the following line.)

rm -f /tmp/race.txt
x=0; while builtin test $x -lt 50000; do echo "P1 C1 $x"; echo "P1 C2 $x"; \
  echo "P1 C3 $x"; let x=$(($x + 1)); done >> race.txt &
y=0; while builtin test $y -lt 50000; do echo "P2 C1 $y"; echo "P2 C2 $x"; \
  echo "P2 C3 $x"; let x=$(($x + 1)); done >> race.txt &

The following questions are based on these three lines.