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

  • SEARCH
  • Home
  • 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 9221243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:32:08+00:00 2026-06-18T03:32:08+00:00

Basically I have a Task and a Thread class,I create threads equal to the

  • 0

Basically I have a Task and a Thread class,I create threads equal to the amount of physical cores(or logical cores,since on Intel CPU cores they’re double the count).

So basically threads take tasks from a list of tasks and execute them.However,I do have to make sure everything is safe and multiple threads don’t try to take the same task at once and of course this introduces extra overhead(and headaches).

What I put the tasks functionality inside the threads?I mean – instead of 4 threads grabbing tasks from a pool of 200 tasks,why not 200 threads that execute in groups of 4 by 4,basically I won’t need to synchronize anything,no locking,no nothing.Of course I won’t be creating the threads during the whole run-time,just at the initialization.

What pros and cons would such a method have?One problem I can thin of is – since I only create the threads at initialization,their count is fixed,while with tasks I can keep dumping more tasks in the task pool.

  • 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-18T03:32:10+00:00Added an answer on June 18, 2026 at 3:32 am

    Threads have cost – each one requires space for a TLS and for a stack as a minimum.

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

Sidebar

Related Questions

I basically have the following class: .sf-sub-indicator { background: url(/abcprod/images/arrows-ffffff.png) no-repeat -10px -100px; }
I have a SwingWorker thread with an IOBound task which is totally locking up
I have a basic asynchronous task that performs a web request. The thread is
I have a program which task would be to proof that my class is
I basically have an application that has, say 5 threads, which each read from
I have a task and no idea how to tackle it! Basically, I want
Basically, I have a long task that consists of bunch of sequence sub-tasks as
I have a task that needs to be executed on a schedule. (It basically
I have unit test sample code that basically runs 2 threads: the main test
I basically have a program that filters records from one excel file to another

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.