0

In my C software I created 10 threads (multi-thread) and write messages in a message queue. I also created 1 more thread to monitor the queue and drain data out from the other end of the queue.

It ran ok, but the message size was stuck as default (10).

I learnt from the forum to increase the mqueue size by running "echo number>/proc/sys/fs/mqueue/msg_max", where I put "number" as 100 in Linux (Ubuntu).

However after this change, when I execute my software again, I'm not able to create (pthread_create) more than 4 threads. The other 7 threads creation report errors. Everything was ok before apart from the queue was too small.

Please may I ask how can I restore the default value of the msg_max so that I can run the software again?

Also is there any other way to increase the mqueue size?

Thanks a lot.

Cheers,

Janice

  • Did you try `echo 10>/proc/sys/fs/mqueue/msg_max`? – e0k Dec 29 '16 at 15:47
  • `/proc/sys/fs/mqueue/msg_max` changes the maximum number of messages in a queue. There may be other problems going on with your code, but we can't know because you haven't shown any C code at all. – e0k Dec 29 '16 at 15:51
  • See also [POSIX queues and msg_max](http://stackoverflow.com/questions/10558721/posix-queues-and-msg-max) – e0k Dec 29 '16 at 15:52
  • Many thanks for the suggestions. We tried 10 > /proc/sys/fs/mqueue/msg_max and everything is fine again. – Janice Man Dec 29 '16 at 17:45

1 Answers1

0

We tried 10 > /proc/sys/fs/mqueue/msg_max and everything is fine again. – Janice Man

Armali
  • 18,255
  • 14
  • 57
  • 171