threadpool

C++ master/worker

跟風遠走 提交于 2019-12-04 13:08:57
问题 I am looking for a cross-platform C++ master/worker library or work queue library. The general idea is that my application would create some sort of Task or Work objects, pass them to the work master or work queue, which would in turn execute the work in separate threads or processes. To provide a bit of context, the application is a CD ripper, and the the tasks that I want to parallelize are things like "rip track", "encode WAV to Mp3", etc. My basic requirements are: Must support a

Context Switches on Sleeping/Waiting Threads

北城以北 提交于 2019-12-04 13:02:36
问题 I'm trying to understand how operating systems handle context switching in different models to better understand why NIO performance is better in cases of large peaks in the number of requests. Apart from the fact that there may be a limit to the number of threads, I'm curious how blocking operations being done in those large number of requests can affect resource utilization. In a one request per thread model, say a servlet 2.5 based web application, if 499 threads are waiting for database

How to make a Win Service run Long Term with Threading

ε祈祈猫儿з 提交于 2019-12-04 12:40:27
I have a win service hosting a few workflows (a WorkflowApplication and a WorkflowServiceHost) that I need to keep long running. Because OnStart() requires that it completes and returns to the OS, I have a main method that fires on another thread in a threadpool. My Onstart() mainly looks like this protected override void OnStart(string[] args) { eventLog.WriteEntry("Service starting..."); ThreadPool.QueueUserWorkItem(new WaitCallback(ServiceMainThread)); Thread.Sleep(100); eventLogCms.WriteEntry("Service Started."); } ServiceMainThread() is the method where my workflows execute and core

Tomcat active threads pile up and stalls the server

痞子三分冷 提交于 2019-12-04 10:53:52
We are having this issue with our production servers (apache-tomcat-7.0.6), which is running a Spring-JPA-Hibernate application using MySQL as DB. During this issue server becomes slow and within a minute it becomes unresponsive with number of active tomcat threads shoots up to 200(We use javamelody to observe these things). Logs look something like: 2012-04-07 07:53:48,058 DEBUG AuthenticationHandler:("http-bio-7006"-exec-304):35 - Authentication handler : ~ 2012-04-07 07:53:48,059 DEBUG AuthenticationHandler:("http-bio-7006"-exec-304):45 - Service Id : 1333765428059-/xxx-framework-service

Using ThreadPool within loops in C#

血红的双手。 提交于 2019-12-04 10:35:43
I'm not too clued up with threading but is the following code acceptable (I'm more worried about using thread pools within a loop): string[] filePaths = GetFilePaths(); foreach (string filePath in filePaths ) { ThreadPool.QueueUserWorkItem(DoStuff, filePath); } Is there any other way that this can be done? EDIT: N.B. Each execution of DoStuff will in turn create multiple sub threads (about 200). These sub-threads simulate users of the system and is only responsible for receiving and sending information via TCP. Your current code could go wrong when a combination of the 2 following holds: there

Threadlocal memory leak in Threadpool

≯℡__Kan透↙ 提交于 2019-12-04 10:33:55
I am getting threadlocal memory leak errors in Tomcat and I am using ThreadPool, but have no implementation of ThreadLocal in my webapp. SEVERE: The web application [/myWebApp] created a ThreadLocal with key of type [org.a pache.http.impl.cookie.DateUtils$DateFormatHolder$1] (value [org.apache.http.imp l.cookie.DateUtils$DateFormatHolder$1@4c2849]) and a value of type [java.lang.re f.SoftReference] (value [java.lang.ref.SoftReference@1e67280]) but failed to rem ove it when the web application was stopped. Threads are going to be renewed ove r time to try and avoid a probable memory leak. What

using TBB for non-parallel tasks

隐身守侯 提交于 2019-12-04 10:26:15
I want to get a thread-pool behavior using TBB. But whenever I read documents about TBB they always talk about parallel-for, parallel-dowhile etc. In contrast what I need is a main thread to assign tasks to a thread pool so those tasks will be executed 'on their own' - execute tasks asynchronously. Tasks here can be event handling for a GUI. Is the TBB task scheduler appropriate for such behavior? The impression I got from task scheduler is that it's only beneficial if I have tasks that can be broken down and executed in parallel to each other. Alexey Kukanov Starting from version 3.0, TBB has

Nexus 5 going to sleep mode makes activity life cycle buggy

给你一囗甜甜゛ 提交于 2019-12-04 10:07:50
I have a strange behavior on the Nexus 5 when going in and out to the sleep mode. It kills and relaunchs the app in a really strange way. I show you the log: Going into sleep mode (pressing the power button) 17.005: E/MotherActivity(28940): onPause called 17.025: E/MotherActivity(28940): onStop called 17.315: E/MotherActivity(28940): onDestroy called 17.365: E/GameTuto1Activity(28940): MainActivity Constructor called 17.365: E/MotherActivity(28940): onCreate called 17.695: E/MotherActivity(28940): onStart called 17.705: E/MotherActivity(28940): onResume called 17.705: E/MotherActivity(28940):

Is ThreadPool appropriate for this threading scenario?

别等时光非礼了梦想. 提交于 2019-12-04 09:49:21
I have a scenario that I'm trying to turn into a more responsive UI by pre-fetching some sub-elements of the results before they're actually required by the user if possible. I'm unclear on how best to approach the threading, so I'm hoping someone can provide some advice. Scenario There is search form (.NET rich client) that enable the user to select an account for a given customer. The user searches for given text to find a collection of customers which are then displayed in a result grid. Then when the user selects a customer, the list of accounts for that customer are searched for and

ThreadPoolExecutor's getActiveCount()

南笙酒味 提交于 2019-12-04 09:19:46
I have a ThreadPoolExecutor that seems to be lying to me when I call getActiveCount(). I haven't done a lot of multithreaded programming however, so perhaps I'm doing something incorrectly. Here's my TPE @Override public void afterPropertiesSet() throws Exception { BlockingQueue<Runnable> workQueue; int maxQueueLength = threadPoolConfiguration.getMaximumQueueLength(); if (maxQueueLength == 0) { workQueue = new LinkedBlockingQueue<Runnable>(); } else { workQueue = new LinkedBlockingQueue<Runnable>(maxQueueLength); } pool = new ThreadPoolExecutor( threadPoolConfiguration.getCorePoolSize(),