#include//for printf #include//for strerror #include//for srandom and random #include//for threads #define MAX_SLEEP 10//maximum sleeping time in seconds #define perror2(s,e) fprintf(stderr,"%s: %s\n",s,strerror(e)) void *sleeping(void *); main(int argc,char *argv[]) { int n,i,s1,err; pthread_t *tids; if(argc>1) n=atoi(argv[1]); else exit(0); if(n>50){ printf("Number of threads should be up to 50\n"); exit(0); } if((tids=(pthread_t*)malloc(n*sizeof(pthread_t)))==NULL){ perror("malloc"); exit(1); } srandom((unsigned int)time(NULL)); for(i=0;i