Contents info

February 18, 2020 · View on GitHub


→ fork.c

  • create a c program that can create a new process by using fork
  • needs <unistd.h> for using fork

  • tree visualisation

                                     parent
                                       || (fork)
                                       /\
                                      /  \ 
                                     /    \
         (remaining parent code)<-parent   \
                                            \
                                             child->(copy of parent code)
       

→ fork tree.c

  • create a c program that can create a new process in a child produced by a parent
  • tree visualisation

          parent
            || (fork)
            /\
           /  \ 
          /    \
       parent child
                 ||(fork)
                 /\
                /  \
           parent child
       

→ odd or even.c

  • create a c program that takes takes an array of numbers and outputs only the even numbers
- visualization 

  <pre>
  
    parent -----(fork)-----> child
      ↑                        ↓
   arary[1,2,4]               [2,4]
   
   </pre>
   

→ message using thread.c

  • create a c program that takes makes a threads to display a message
  • need to use -lpthread after cc

cc threadmsg.c -lpthread


→ fibonacci and prime using thread.c

  • create a c program that takes makes uses threads to print fibonacii series and primes numbers for numbers 0 to n
  • need to use -lpthread after cc

cc threadmsg.c -lpthread


→ First Reader's Writer's Problem.c

  • create a c program that takes makes uses threads to solve the First Reader's Writer's Problem
  • need to use -lpthread after cc

cc threadmsg.c -lpthread


→ Second Reader's Writer's Problem.c

  • create a c program that takes makes uses threads to solve the First Reader's Writer's Problem
  • need to use -lpthread after cc

cc threadmsg.c -lpthread

  • create a c program

Codes are still incomplete. Contributions are welcome for adding more information to each program