sysconf(_SC_NPROCESSORS_ONLN) is expensive in RHEL6

Solution Verified - Updated -

Issue

  • Qt application that has a lot of threads and uses QReadWriteLocks to protect data that the threads are accessing. When the server is heavily loaded, the application spends about 60% of it's time in system time as opposed to user time. Further investigation showed that the QMutex class is calling sysconf(_SC_NPROCESSORS_ONLN) for each thread that tries to get a lock where that lock is already locked.

Environment

  • Red Hat Enterprise Linux (RHEL) 6.4
  • qt

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.