To solve my assignment about readers/writers problem , I write the code using C language. I guess that pthread_create line occurs segmentation fault. How I success to run this code?
sorry, I don't know any solutions.
int count_r = 0;
int count_w=0;
sem_t wse;
sem_t rse;
int initialize(){
sem_init(&wse, 0, 1);
sem_init(&rse, 0, 1);
return 0;}
void main(){
int i;
pthread_t tid[25];
initialize();
for(i=0;i<20;i++)
pthread_create(&tid[i], NULL, &reader, NULL);
for(i=20;i<25;i++)
pthread_create(&tid[i], NULL, &writer, NULL);
segmentation fault..