CS 307 Programming Examples

  1. From class on 3/27/96. fork1.c (simple creation of a child), fork2.c (using fork(), execlp(), and wait()), getanumber.c (the program exec'd by the child process in fork2.c), signal1.c (catching CTL-C's and thumbing your nose at them).
  2. Two improved versions of 4/12/96 program. The first, race.c uses the flawed lock variable strategy to enforce mutual exclusion, and thus contains race conditions. The program does, however, show how to create, use, and delete shared memory. The second, norace.c, uses a semaphore instead, and thus has no race conditions (as far as this programmer can tell, that is).




Jeff Ondich, Department of Mathematics and Computer Science, Carleton College, Northfield, MN 55057
(507) 663-4364, jondich@carleton.edu