threadpool

Any relationship between process priority and thread pool priority (C#)

青春壹個敷衍的年華 提交于 2019-12-05 22:46:41
I understand that thread pool priority should/can not be changed by the running process, but is the priority of particular task running on the thread pool somewhat priced-in with the calling process priority? in other words, do all tasks in thread pool run in the same priority regardless the calling process priority? thank you update 1: i should have been more specific, i refer to thread inside Parallel.ForEach Adriano Repetti I understand that thread pool priority should/can not be changed by the running process, That's not exact. You can change Thread Pool's thread priority (inside delegate

Mono ThreadPool concurrency issues

十年热恋 提交于 2019-12-05 21:08:05
问题 I wrote one software that uses ThreadPool for multithreading. ThreadPool.SetMinThreads(128, 128); ThreadPool.SetMaxThreads(512, 512); for (int i = 0; i < 40; i++) { ThreadPool.QueueUserWorkItem(_ => { Console.Write("!"); Thread.Sleep(1000); Console.Write("."); }, null); } Inside each thread I perform blocking network operations(work with http). Software designed around blocking network model and I cannot move to non blocking 1 threaded I/O. It works perfect on windows platform, I can use 128

How to configure ThreadPool priority in Playframework

我的梦境 提交于 2019-12-05 20:46:47
We have 2 ExecutionContexts in the system (Scala 2.11.4, Playframework 2.3.7) Primary context - for system operational work (Uses primary Play ExecutionContext). Administrative - for backend related tasks. I've separated those into 2 in application.configurations. play { akka { akka.loggers = ["akka.event.slf4j.Slf4jLogger"] loglevel = DEBUG actor { default-dispatcher = { fork-join-executor { parallelism-min = 20 parallelism-max = 20 } } } } } contexts { admin { fork-join-executor { parallelism-min = 30 parallelism-max = 30 } } } Is there a way to configure ThreadPool priority? There is

How can I solve MongoWaitQueueFullException?

淺唱寂寞╮ 提交于 2019-12-05 19:49:55
I run a java program which is a thread executor program that inserts thousands of documents to a table in mongodb. I get the following error Exception in thread "pool-1-thread-301" com.mongodb.MongoWaitQueueFullException: Too many threads are already waiting for a connection. Max number of threads (maxWaitQueueSize) of 500 has been exceeded. at com.mongodb.PooledConnectionProvider.get(PooledConnectionProvider.java:70) at com.mongodb.DefaultServer.getConnection(DefaultServer.java:73) at com.mongodb.BaseCluster$WrappedServer.getConnection(BaseCluster.java:221) at com.mongodb.DBTCPConnector

What is the C# equivalent of MsgWaitForMultipleObjects?

不想你离开。 提交于 2019-12-05 17:23:48
问题 I have a Windows Form with a ListView in Report Mode. For each item in the view, I need to perform a long running operation, the result of which is a number. The way I would do this in native win32 is to create a worker thread for each item (naively; of course I won't create an unbounded number of threads) and then MsgWaitForMultipleObjects() on the array of thread handles. As each calculation finishes, the threads signal and the main UI thread wakes up and updates. In the mean time, we pump

Limit number of processors used in ThreadPool

我是研究僧i 提交于 2019-12-05 15:30:33
Is there any way to limit the number of processors that the ThreadPool object will use? According to the docs, "You cannot set the number of worker threads or the number of I/O completion threads to a number smaller than the number of processors in the computer." So how can I limit my program to not consume all the processors? After some experiments, I think I have just the thing. I've noticed that the ThreadPool considers the number of processors in the system as the number of processors available to the current process . This can work to your advantage. I have 4 cores in my CPU. Trying to

Python multiprocessing pool stuck

不羁岁月 提交于 2019-12-05 13:12:11
I'm trying to run some sample code of the multiprocessing.pool module of python, found in the web. The code is: def square(x): return x * x if __name__ == '__main__': pool = Pool(processes=4) inputs = [0, 1, 2, 3, 4] outputs = pool.map(square, inputs) But when i try to run it, it never finsh the execution and i have to restart the kernel of my IpythonNotebook notebook. What's the problem? KT. As you may read from the answer pointed out by John in the comments, multiprocessing.Pool , in general, should not be expected to work well within an interactive interpreter. To understand why it is the

Why does memory consumption increase dramatically in `Pool.map()` multiprocessing?

一个人想着一个人 提交于 2019-12-05 12:40:16
I am doing a multiprocessing on a pandas dataframe by splitting it into several dataframes, which are stored as list. And, using Pool.map() I am passing the dataframe to a defined function. My input file is about "300 mb", so small dataframes are roughly "75 mb". But, when the multiprocessing is running the memory consumption increases by 7 GB and each local process consumes about approx. 2 GB of memory. Why is this happening? def main(): my_df = pd.read_table("my_file.txt", sep="\t") my_df = my_df.groupby('someCol') my_df_list = [] for colID, colData in my_df: my_df_list.append(colData) # now

ScheduledThreadPoolExecutor and corePoolSize 0?

谁都会走 提交于 2019-12-05 11:39:31
问题 I'd like to have a ScheduledThreadPoolExecutor which also stops the last thread if there is no work to do, and creates (and keeps threads alive for some time) if there are new tasks. But once there is no more work to do, it should again discard all threads. I naivly created it as new ScheduledThreadPoolExecutor(0) but as a consequence, no thread is ever created, nor any scheduled task is ever executed. Can anybody tell me if I can achieve my goal without writing my own wrapper around the

When is specifying separate core and maximum pool sizes in ThreadPoolExecutor a good idea?

和自甴很熟 提交于 2019-12-05 10:46:15
I'm trying to understand the point in specifying separate core and maximum pool sizes for Java 5's ThreadPoolExecutor. My understanding is that the number of threads is only increased once the queue is full, which seems a bit late (at least with larger queues). Isn't it that I'm either happy to allocate a larger number of threads to the tasks, in which case I might just increase the core pool size; or I am not really willing to do so, in which case I should rather have a larger queue? What is a scenario where separate core and maximum pool sizes are useful? sbridges There is a discussion of