Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How many threads can single application handle?  (Read 4383 times)

0 Members and 1 Guest are viewing this topic.

Neomex

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • Email
How many threads can single application handle?
« on: December 30, 2011, 07:08:13 pm »
How many threads can single application handle?
Is there some limit, might they slow program down?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
How many threads can single application handle?
« Reply #1 on: December 30, 2011, 07:46:18 pm »
The limit depends on the OS. But if you ask this question, it means that you're doing something wrong: the more threads you spawn, the slower your program becomes. You should have only a few threads, and only if they are really necessary (beginners tend to overuse them).
Laurent Gomila - SFML developer

Neomex

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • Email
How many threads can single application handle?
« Reply #2 on: December 30, 2011, 08:52:53 pm »
Didn't implemented any yet, but considered to use them in few places like loading files and displaying graphics at the same time. Also, do clocks use different threads for measuring time?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
How many threads can single application handle?
« Reply #3 on: December 30, 2011, 10:40:01 pm »
Quote
displaying graphics at the same time

Don't create multiple rendering threads, it won't work.

Quote
Also, do clocks use different threads for measuring time?

No.
Laurent Gomila - SFML developer

TechRogue

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
How many threads can single application handle?
« Reply #4 on: January 17, 2012, 07:02:14 pm »
Quote
Don't create multiple rendering threads, it won't work.


I believe the intent here is to load resources while displaying a progress bar or something.

tobybear

  • Newbie
  • *
  • Posts: 27
    • View Profile
How many threads can single application handle?
« Reply #5 on: January 18, 2012, 09:18:03 am »
For Windows, see also this MSDN post:
http://blogs.msdn.com/b/oldnewthing/archive/2005/07/29/444912.aspx
But the real question that is raised whenever somebody asks, "What's the maximum number of threads that a process can create?" is "Why are you creating so many threads that this even becomes an issue?"