thread-pool

How expensive is creating of a new thread in Java? When should we consider using of a thread pool?

I wonder where is the verge after which a thread pool should be used. How many new threads per second can I create without using a thread pool still avoiding noticeable performance penalty? Are there any observable open-source thread-pool implementations? ...

A thread pool that lets me know when at least 1 has finished?

I need to use a thread pool in python, and I want to be able to know when at least 1 thead out or "maximum threads allowed" has finished, so I can start it again if I still need to do something. I has been using something like this: def doSomethingWith(dataforthread): dostuff() i = i-1 #thread has finished i = 0 poolSize = 5 t...

threads in a threadpool

Hi all, I have been reading about threadpools. A number of sites say that the default max threads on a threadpool is 25 (per processor). however i have not modified the max threads and when i do : Threadpool.GetAvailableThreads(out WorkThreads, out compPortThreads); I get 500,1000. I am running a dual core pc so wouldnt expect more th...

Parallelize the content retrieval from database, search and store as HTML

I have a database table having HTML content stored as binary serialized blob. I need to retrieve content one by one, look for certain keywords in the content (and report the matches found) and also save the content to the disk as HTML files. Can I parallize this using Parallel.ForEach? Is this a good Idea or there is a better one. Thank...

Android "misses" periodical execution of Thread using ScheduledExecutorService

Hi, I have an android app that repeatedly collects fingerprints from the wifi-networks that are around (for scientific reasons, not to invade anybodies privacy). Anyways, imagine I have a function that does this work and it's called scanWifi(). I initally wanted to start it like this: ExecutorService mExecutor = Executors.newSingle...

Will a ThreadPoolExecutor.CallerRunsPolicy ever throw a RejectedExecutionException?

Are there any circumstances under which a ThreadPoolExecutor.CallerRunsPolicy will throw a RejectedExecutionException? It seems to me that the policy itself is intended to prevent throwing these Exceptions. The API for its interface method, RejectedExecutionHandler.rejectedExecution() claims that it may throw a RejectedExecutionExceptio...

What happens to locks on objects passed to other threads?

I'm not quite sure how to word this, so I'll just paste my code and ask the question: private void remoteAction_JobStatusUpdated(JobStatus status) { lock (status) { status.LastUpdatedTime = DateTime.Now; doForEachClient(c => c.OnJobStatusUpdated(status)); OnJobStatusUpdated(status); } } private void doFo...

Network Service needs to return a callback

I have a Networking service that i want to use as a Service. It's a local Service since it's not valid anymore once the application process is dead and no Other applications need to access it.(or should...). I was pondering if to use the IBinder interface with local reference to the class and decided not to, for the moment. I have the ...

How to create threads in ASP.NET pages from CLR thread pool instead of ASP.NET pool ?

If I create a new thread on an ASP.NET page the IsThreadPoolThread property is true. First question is, is it from ASP.NET pool or CLR pool ? Second question is, if it is from ASP.NET pool then how to create a thread from CLR and don't use ASP.NET pool ? I need a synchronous solution for long-running requests (full story). ...