Tasks , Processes and Threads

Start with the following functions:

Write 2 different programs:

  1. Create the above tasks as threads
  2. Create the above tasks as processes

Test your code

On part 2 , make the main process watch the children and recreate a child while it exited

reference:

  • To create thread, use pthread_create
  • To create process use fork
  • Wait for a process to exit with the function wait
  • To compile without threads use:    # gcc -o myapp mytest.c
  • To compile with threads use:         # gcc -pthread -o myapp mytest.c