Answer thefollowing questions based on the given c file:
#include
#include
#include Â
int c = 0;
void *fnC()
{Â Â Â Â int i;
   for(i=0;i<10;i++)
   {  c++;
       printf(\" %d\", c);
   }     Â
}
int main()
{
int rt1,rt2;Â Â pthread_t t1, t2; int trial_count = 0;
// For every trial, lets zero out the counter and run the countroutine “twiceâ€Â   Â
// as threads that can be scheduled onto independent coresinstead of running   Â
// in sequence.
for (trial_count = 0; trial_count < 1000; trial_count++)
{
c = 0;
          //Create two thread with the routine pthread_create(). You canuse
          //reference materials to get definitions of what the variousparameters           Â
// mean.
           if((rt1=pthread_create( &t1, NULL, &fnC,NULL)))             Â
printf(\"Threadcreation failed: %d\n\", rt1);
          if((rt2=pthread_create( &t2, NULL, &fnC,NULL)))             Â
printf(\"Threadcreation failed: %d\n\", rt2);
         // Wait forboth threads to finish. The main process thread will block
         // until thethreads that were launched terminate. Once they bothfinish,         Â
// then the “mainthread†unblocks and continues.
         pthread_join(t1, NULL);         Â
pthread_join(t2,NULL);Â Â Â Â Â Â Â Â Â Â
printf(\"\n\");
       }
   return 0;
}
Activity A, Task 1: DiscussionQuestions (10/50 points):
- You should have observed output lines that were NOT alwaysprinted in integer order. This is because the code as written has acritical section that is being simultaneously run by more than onethread. What lines of the sample code constitute the criticalsection? You can cut and paste those lines into your answer, or youcan type them in. Â
- Thread safety (https://en.wikipedia.org/wiki/Thread_safety) isa concept often used when discussing subroutines or other codesegments that are written in such way that they can be “multiplyrun†as parts of multiple threads that are being scheduledconcurrently or otherwise multiprogrammed. Do you think that thefunction printf() is thread safe? Do some researchand/or run some code experiments and provide a brief, but complete,answer that explains your view on the subject. Be sure to explainwhy you hold your position on the subject, no matter what thatis.