/Code-Samples

Code samples from CSE 3320

Primary LanguageCMIT LicenseMIT

Code samples from CSE 3320

The following programs are provided to demonstrate concepts covered in CSE 3320.

Process related programs

  • fork.c Demonstrates a simple forking of a child process
  • waitpid.c Demonstrates how to wait on a specific child process and also determine why the child process died
  • exec.c Fork a child and then call exec to turn the child into an ls process
  • thread.c Spawn a thread

Inter-process communication related programs

  • pipe.c Open a pipe between two processes and write a string from one to the other
  • pipe_redirect.c Open a pipe between two processes and redirect stdin and stdout
  • shared_mem.c Setup a shared memory segment and read or write using it
  • memmap.c Memory map a file and read from it
  • named_listener.c Create a listener on a named pipe
  • named_sender.c Create a writer to a named pipe
  • semaphore.c Guard a critical seciton using a semaphore

Signal handling programs

  • sigint.c Registering a signal handler, with signal(), to catch a ctrl-c (SIGINT)
  • sigint_sigaction_block.c Registering a signal handler, with sigaction(), to catch a ctrl-c (SIGINT). Also demonstrates masking (blocking) signals
  • sigint_signal_block.c Registering a signal handler, with signal(), to catch a ctrl-c (SIGINT). Also demonstrates masking (blocking) signals
  • sigqueue_example.c Send a signal to a process using sigqueue()
  • alarm.c Set a signal handler for SIGALRM
  • multiple_signals.c Set a single signal handler for multiple signals
  • block_signal.c Block signals with sigprocmask()

Unrelated related programs

  • endien.c Determine if your machine is big endien or little endien