LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-07-2012, 01:01 PM   #1
Lobinho
Member
 
Registered: May 2010
Distribution: Ubuntu
Posts: 72

Rep: Reputation: 18
Problem with pthread + Embedded linux and threads limits


I'm currently working on a project with embedded linux and came across a problem creating threads. My process often launch a thread to threat an event, but after the number of events outnumber the thread limit of the system (919 max threads), the threads stop working properly, and the system become slow.

I tried increase the thread limit of the kernel (
/proc/sys/kernel/threads-max) and use setrlimit(RLIMIT_NPROC), but neither solved the problem.

One solution would be create one thread to threat all the events, and not one thread for each one, but i would like to know if there is a way to let unlimited the number of threads.
 
Old 11-07-2012, 01:17 PM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,850

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
no, you cannot have unlimited number of threads. Also you need to exit unused threads (I mean after the event handled the thread should be properly exited)
 
Old 11-08-2012, 04:09 AM   #3
Lobinho
Member
 
Registered: May 2010
Distribution: Ubuntu
Posts: 72

Original Poster
Rep: Reputation: 18
The threads exit after the events are threated, but the limit is still valid even after the threads are closed. I'll use just one thread to threat all the events, solves the problem and uses less resources. Thanks for the reply
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] pthread threads and mutex naaman Programming 1 02-07-2011 02:50 AM
Synchronization problem with pthread when migrating from suse linux 32bit to 64 bit vishypalepu Linux - Embedded & Single-board computer 1 08-30-2010 06:35 AM
Threads in C++ - alternatives to pthread? simopal6 Programming 17 04-08-2009 12:21 AM
problem in assigning real time scheduling to pthread in linux jasdeep_js Linux - Kernel 1 09-07-2008 01:44 AM
logger pthread watch&log other threads aral Programming 6 09-06-2006 03:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration