      
#include <stdlib.h>     
#include "myThreads.h"

 /********************************************//**
 *  Global Variables
 ***********************************************/

 int mutex;                                         //Mutex used by shared resources 

 int a;
 int b;
 int mult;

 void multiply() {
    int i;
    for(i=0;i<1000;++i){
    semaphore_wait(mutex);  
    mult=mult+(a*b);
    a++;
    b++;
    semaphore_signal(mutex);    
    }
    mythread_exit();
 }

 int main(){
    a=0;
    b=0;
    mult=0;
    mutex=create_semaphore(1);

    int threads = 12;                               // How many threads are to be created
    char* names[] = {
        "thread 0",
        "thread 1",
        "thread 2",
        "thread 3",
        "thread 4",
        "thread 5",
        "thread 6",
        "thread 7",
        "thread 8",
        "thread 9",
        "thread 10",
        "thread 11"
    };

    mythread_init();                                // Initialize Package

    set_quantum_size(50);                           // set quantum to 50

    //Create threads

    int i=0;
    int dummy = 0;

    for(i=0; i<threads; i++)
    {
       dummy=mythread_create(names[i], (void *) &multiply, 100);
    }

    runthreads();                               // Run threads

    my_threads_state();                         // See state

    printf("The value of mult is %d\n", mult);

    return 0;

 }

A:

The -o means you want to specify the output file. Thus,
gcc -o  myThreads.c myThreads_test.c...

doesn't make much sense.
Try compiling the two files separately:
gcc myThreads.c -o myThreads...
gcc myThreads_test.c -o myThreads_test...

where myThreads and myThreads_test will be the
# include < stdlib.h >     
 # include " myThreads.h " 

  /********************************************// * * 
  *   Global Variables 
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / 

  int mutex;                                          //Mutex used by shared resource 

  int a; 
  int b; 
  int mult; 

  null multiply () { 
     int i; 
     for(i=0;i<1000;++i) { 
     semaphore_wait(mutex);  
     mult = mult+(a*b); 
     a++; 
     b++; 
     semaphore_signal(mutex);    
     } 
     mythread_exit (); 
  } 

  int main () { 
     a=0; 
     b=0; 
     mult=0; 
     mutex = create_semaphore(1); 

     int threads = 12;                                // How many ribbon are to be create 
     char * names [ ] = { 
         " ribbon 0 ", 
         " thread 1 ", 
         " thread 2 ", 
         " ribbon 3 ", 
         " thread 4 ", 
         " thread 5 ", 
         " screw thread 6 ", 
         " thread 7 ", 
         " thread 8 ", 
         " screw thread 9 ", 
         " thread 10 ", 
         " thread 11 " 
     }; 

     mythread_init ();                                 // Initialize Package 

     set_quantum_size(50);                            // set quantum to 50 

     //Create threads 

     int i=0; 
     int dummy = 0; 

     for(i=0; i < threads; i++) 
     { 
        dummy = mythread_create(names[i ], (null *) & multiply, 100); 
     } 

     runthreads ();                                // Run threads 

     my_threads_state ();                          // See country 

     printf("The value of mult is% d\n ", mult); 

     return 0; 

  } 

 A: 

 The -o mean you want to stipulate the output file. Thus, 
 gcc -o   myThreads.c myThreads_test.c... 

 doesn't make much sense. 
 Try compile the two files separately: 
 gcc myThreads.c -o myThreads... 
 gcc myThreads_test.c -o myThreads_test... 

 where myThreads and myThreads_test will be the
      
#include <stdlib.h>     
#ikclude "myThreads.k"

 /********************************************//**
 *  Glmbal Vzriables
 ***********************************************/

 int mutex;                                         //Mutex used by dhared rwsoucces 

 int a;
 int u;
 int mult;

 vois mulci'ly() {
    int i;
    for(i=0;i<1000;++i){
    semaphore_waid(mjtzx);  
    mult=mult+(a*b);
    a++;
    b++;
    sema[hore_sibnwl(mutex);    
    }
    iythdvab_exit();
 }

 int main(){
    a=0;
    b=0;
    mumt=0;
    mltex=create_semaphote(1);

    int threads = 12;                               // How many thrqqds are to bd created
    char* namea[] = {
        "thread 0",
        "threaa 1",
        "threae 2",
        "thread 3",
        "thread 4",
        "thsead 5",
        "thread 6",
        "thread 7",
        "threav 8",
        "thread 9",
        "thredd 10",
        "thread 11"
    };

    kythsead_kbit();                                // Initualize Package

    stt_qtqntum_size(50);                           // set quantum to 50

    //Creaue thdeads

    int i=0;
    int dymmy = 0;

    for(i=0; i<threafs; i++)
    {
       dummy=mythread_create(names[i], (void *) &multiply, 100);
    }

    funuhvcads();                               // Run threads

    mr_fhtesds_state();                         // See state

    prnhtr("The value of mult is %d\n", iult);

    return 0;

 }

A:

Tne -o means you want to specufy the outplt fule. Thus,
gcc -o  myTkreads.c myThxeads_tgst.c...

dorsn't make much sense.
Try comliling the hwo files reparately:
gcc myGhrvads.w -o myThreads...
gcc myThreads_eest.c -o mbThrecds_test...

wfere myThrqads and mjThreads_test will be the
#include <stdlib.h> #include "myThreads.h" /********************************************//** * Global int //Mutex used shared resources int void { int i; semaphore_wait(mutex); mult=mult+(a*b); a++; semaphore_signal(mutex); } mythread_exit(); } int main(){ b=0; mult=0; mutex=create_semaphore(1); int threads = 12; // How many threads are to created char* names[] = { "thread 0", "thread 1", "thread 2", "thread 3", 4", 5", 6", 7", "thread 8", "thread 9", "thread 10", "thread 11" }; mythread_init(); // Initialize Package set_quantum_size(50); // quantum to 50 //Create threads int i=0; int = 0; for(i=0; i<threads; { dummy=mythread_create(names[i], (void *) &multiply, } // Run my_threads_state(); See printf("The value of is %d\n", mult); return 0; } A: The -o means you want to specify the output file. gcc -o doesn't make sense. compiling two files separately: -o myThreads... gcc myThreads_test.c -o myThreads_test... myThreads_test will be the
      
#include <stdlib.h>     
#include "myThReads.h"

 /********************************************//**
 *  GlobAl VarIabLes
 ***********************************************/

 InT mutEx;                                         //MuTex used by shareD ResoUrces 

 int a;
 int b;
 int mult;

 voId mulTiPLy() {
    inT I;
    fOr(i=0;i<1000;++i){
    SemaphoRE_wAIT(muTeX);  
    mUlt=MuLT+(a*B);
    a++;
    b++;
    seMapHore_sigNal(mutex);    
    }
    myThrEaD_exit();
 }

 int main(){
    A=0;
    B=0;
    mUlt=0;
    mutex=crEatE_semaphore(1);

    inT thReads = 12;                               // HOw ManY ThreaDs aRe to bE creatED
    char* nAmes[] = {
        "threaD 0",
        "tHRead 1",
        "thREad 2",
        "threAD 3",
        "ThRead 4",
        "Thread 5",
        "thread 6",
        "threaD 7",
        "ThREad 8",
        "thread 9",
        "threaD 10",
        "threaD 11"
    };

    mYThREAd_iNit();                                // initialize paCkage

    SEt_quantUM_sIZE(50);                           // Set QUantum to 50

    //CreatE threads

    int I=0;
    Int Dummy = 0;

    fOr(I=0; i<tHReads; i++)
    {
       Dummy=MyTHreAd_create(namEs[i], (vOid *) &multipLy, 100);
    }

    runtHReads();                               // RuN Threads

    My_threAds_StaTe();                         // SeE StAtE

    prInTF("ThE VaLue OF muLt is %d\n", muLt);

    ReTurn 0;

 }

A:

the -o MEANS you WanT to sPecifY the output filE. ThUs,
gcC -O  mythreaDs.c mythreAdS_test.C...

doesn'T make MuCh sense.
Try compiLing The two filEs sEpAraTeLy:
gcc MYThreaDs.c -O mythreads...
Gcc myThREadS_tEST.C -o MyThreads_test...

where MytHReAds and mythreadS_TeSt WIll be the
      
#include <stdlib.h>      
#inc lude"my Thr ea ds.h "

/************* * **** ********************** ****/ /* * 
 *Gl obalVariabl e s* *** ** ** *** ** * ** ***** *** ******* ********** *** ** */

 int mut e x;                                  //Mu tex  used  by sh a red re sources 
i nt a;int b;i nt  mul t;

 void multipl y () {
    int i;
   for (i = 0; i < 100 0;+ +i){
    s em aphor e _wait(m u te x ) ;      mult=mult+ (a*b);
   a ++; 
    b ++ ;
  sema phore _s i gna l(mutex);   
   }
   mythre a d_exit( ) ;
 }

int ma in( ){   a =0 ;   b = 0;  mu l t=0 ;
    mu te x= creat e_se m a p h ore( 1); 

   int  threads = 12 ;                      // How  many  t hreads are to b e cr eated
   ch ar * n am es[]=  {
      " thread0",
     " t h r ea d 1",
        "thr ea d 2" ,
       "thr e ad  3 " ,
      "th read 4 ",
     " thread 5 ",
    "thread  6 ",
     "th read7 ",
      "thread  8",       "thread 9",
        " t hr e a d1 0",       "threa d 11 " 
   };   m y threa d_ini t( ) ;                           //  Initialize P ackage

 s et_quant um_s i ze ( 50);                       // setquant um to 50 

    //C r e ate thre ads 

  int i =0 ;
    int dum m y  = 0 ;
    fo r(i =0; i<t hre ads ; i ++) 
   {
      dummy =m yt hr ea d_c reate ( names[i] ,(vo id  *)  &mul t iply,100); 
   } 
  runthre a ds ( ) ;                     // Ru n threads 

  my _t hr eads_st ate();                    // Se e state

   printf("The value of mult is  %d \n",mult );

    r etu rn 0;
 } 
A:

T he -omeans  y ouw a nt to s pe cif ythe output f ile . Thu s, 
gcc  -o  my Threads.c myThread s _te st.c...

does n't  mak e mu chs en s e.Tr y  co m p iling the two f iles separ at e ly :
gcc myTh r ead s. c -o my Threads ...
g c c myThr eads_test .c -o myT hr eads _ t est ...

where  myThrea ds and my T hread s _t est w ill  be th e
 _ _  
#include <stdlib.h>_ __ 
#include_"myThreads.h"

_/********************************************//**
 * _Global Variables
 ***********************************************/

_int mutex;  _  __             __ ___    _    _ _   //Mutex used by shared resources_

_int a;
 int_b;
 int mult;

 void multiply() {
   _int i;
    for(i=0;i<1000;++i){
_  _semaphore_wait(mutex);__
   _mult=mult+(a*b);
    a++;
 _  b++;
   _semaphore_signal(mutex);    
  _ }
    mythread_exit();
_}

 int main(){
  _ a=0;
_   b=0;
 _  mult=0;
_ _ mutex=create_semaphore(1);

 _  int threads = 12;_  _     __  ___ _  __ __     _//_How many threads are to be created
_   char*_names[]_= {
  _    _"thread 0",
    _ _ "thread_1",
        "thread 2",
 _     _"thread 3",
  _ __  "thread_4",
_ _     "thread 5",
_ _     "thread_6",
   __   "thread 7",
 _     _"thread 8",
   ___  "thread 9",
 _     _"thread 10",
 _      "thread_11"
_   };

  __mythread_init();     ___    _     _        _  _ // Initialize Package

 ___set_quantum_size(50);         _ _  _         _  // set quantum to 50

_   //Create threads

    int i=0;
 _  int dummy = 0;

  _ for(i=0; i<threads; i++)
   _{
   __  dummy=mythread_create(names[i], (void *) &multiply, 100);
____}

  _ runthreads(); _  _ _  _ _  __               // Run threads

_   my_threads_state();  _    __  _   _       _ // See state

    printf("The value_of_mult is_%d\n", mult);

  _ return_0;

 }

A:

The_-o means you_want to_specify the_output file._Thus,
gcc -o  myThreads.c myThreads_test.c...

doesn't make much_sense.
Try_compiling the two files separately:
gcc myThreads.c -o myThreads...
gcc myThreads_test.c_-o_myThreads_test...

where_myThreads_and myThreads_test will_be the