Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8841841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:49:10+00:00 2026-06-14T10:49:10+00:00

Relating to the selected answer for Number of Concurrent Threads in CreateIoCompletionPort , I

  • 0

Relating to the selected answer for Number of Concurrent Threads in CreateIoCompletionPort, I have a question regarding the definition of “runnable thread” in the documentation for I/O completion ports:

When the total number of runnable threads associated with the
completion port reaches the concurrency value, the system blocks the
execution of any subsequent threads associated with that completion
port until the number of runnable threads drops below the concurrency
value.

I understand that a thread, woken from GetQueuedCompletionStatus() because a completion packet was posted, might find itself in a sleep state for OTHER reasons (i.e., it has not yet completed its job and has not returned to call GetQueuedCompletionStatus(), but is sleeping and therefore – if I understand correctly – is not runnable according to the above definition).

What I would specifically like to know is this: Suppose the above thread, in its processing, is sleeping because it has spawned another thread and is waiting on that other thread to complete?

Will the thread be considered to be in a ‘runnable’ state if its child thread is in a runnable state – or not?

If not, it seems that one cannot spawn a worker thread from a thread associated with a completion port without risking the danger that other threads will wake up, such that the total number of running threads exceeds NumberOfConcurrentThreads.

For example – suppose I have 50 threads waiting on GetQueuedCompletionStatus(), the number of concurrent threads is 5, 20 completion packets are simultaneously posted that trigger very long tasks, and every time a thread wakes to perform one of these tasks, it immediately spawns a single new thread to do the work and waits on that thread to complete the long task before returning back to call GetQueuedCompletionStatus() once again.

In this example, would 20 threads wake up and spawn 20 total child threads that work in parallel, or would it only be 5 threads?

(Note: ADDENDUM: I am implementing a pool of worker threads using Boost.Asio in my specific case – which utilizes I/O completion ports internally – and my worker threads use JNI to call into Java; internally, the Java code spawns its own worker threads – so this is what concerns me.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:49:11+00:00Added an answer on June 14, 2026 at 10:49 am

    The place to look for answers to questions like this is always “Windows Via C/C++ (PRO-Developer)” by Jeffrey Richter and Christophe Nasarre.

    On page 327 of my copy it clearly explains that the I/O completion port tracks the thread id of threads that it releases from a call to GetQueuedCompletionStatus() (or equivalent) and counts those threads as “running” as long as they don’t call any function that puts them in a wait state.

    So, in your example, assuming the thread that calls GetQueuedCompletionStatus() is waiting on the thread that is created by JNI then the thread is considered as “not running” and so the IOCP can release another thread from GetQueuedCompletionStatus() to service requests. If all of your threads will eventually call into JNI and create another thread then I think you have a problem with your design as you are basically creating a “thread per event” design which will likely fail to scale as well as an IOCP design which doesn’t create external threads…

    Is it a function of the JNI layer that spawns the thread or is it purely in the Java code you’re calling into? If the later then I suggest redesigning the java code if possible…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this question relating to Lucene. I have a form and I get
I have a question relating to alignment in C/C++. In Determining the alignment of
I have a question relating to properties for a specific instance of a CI
Ok, I have a question relating to an issue I've previously had. I know
I have a question relating to plotting a cylindrical surface in Matlab. My dataset
Question relating to optim function in R I have the following code so far
I have a question relating programming and english language both: Whether to use third
I have a question relating to the timer function. I have managed to find
I have a problem relating to template functions and threads: template <class TYPE_size> void
I have a question relating to dynamic proxies in java. Suppose I have an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.