concurrency

RQ concurrency with supervisord?

时光毁灭记忆、已成空白 提交于 2019-12-23 16:19:04
问题 All, I'm attempting to 'force' RQ workers to perform concurrently using supervisord. My setup supervisord setup seems to work fine, as rq-dashboard is showing 3 workers, 3 PID's and 3 queue (one for each worker/PID). Supervisord setup is as follows (showing only worker 1 setup, 2 more workers are defined below this one): [program:rqworker1] command = rqworker 1 process_name = rqworker1-%(process_num)s numprocs = 1 user = username autostart = True stdout_logfile=/tmp/rqworker1.log stdout

ReentrantReadWriteLock multiple reading threads

元气小坏坏 提交于 2019-12-23 15:23:59
问题 Good Day I have a question relating ReentrantReadWriteLocks. I am trying to solve a problem where multiple reader threads should be able to operate in parallel on a data structure, while one writer thread can only operate alone (while no reader thread is active). I am implementing this with the ReentrantReadWriteLocks in Java, however from time measurement it seems that the reader threads are locking each other out aswell. I don't think this is supposed to happen, so I am wondering if I

ConcurrentDictionary doesn't seem to mark elements for GC when they are removed

混江龙づ霸主 提交于 2019-12-23 15:10:31
问题 I was surprised to find that my app memory footprint kept growing - the longer it run, the more memory it consumed. So with some magic of windbg I pinpointed a problem to my little LRU cache based on ConcurrentDictionary . The CD has bunch of benefits that were very cool for me (one of which is that its data never ends up in LOH). TryAdd and TryRemove are two methods used to add and evict items. !gcroot of some older element lead me back to my cache. Some investigation with ILSpy led me to

Thread-safe way to find the next TCP port in .NET (over multiple processes)

萝らか妹 提交于 2019-12-23 13:57:48
问题 Note that you can find a similar question here: Find the next TCP port in .NET My problem is that the solution (accepted answer) of this question is not thread-safe: Find the next TCP port in .NET - Top answer static int FreeTcpPort() { TcpListener l = new TcpListener(IPAddress.Loopback, 0); l.Start(); int port = ((IPEndPoint)l.LocalEndpoint).Port; l.Stop(); return port; } I wrote a test which proves that: private readonly BlockingCollection<int> _freePorts = new BlockingCollection<int>();

Does Websphere respect Daemon threads?

廉价感情. 提交于 2019-12-23 13:22:43
问题 I've got an app that creates a load of Daemon threads, I'd like each one to shut down when the app is shut down. I'm a little worried thought that Websphere 7 might not be shutting them all down. Does anyone know if Websphere 7 treats Daemons threads differently? (I know it should do) Note: I know what shouldn't create threads manually, and that I should probably use WebSphere WorkManager or something, but this app has to run in Tomcat and WebSphere. I know that I should tie in all threads to

Is there an automatic parallel prolog implementation?

萝らか妹 提交于 2019-12-23 13:04:53
问题 I'm currently doing some research in theoretical computer science, and one of the main tools I'm using is prolog. I've found it particularly handy for writing very quick tests to disprove conjectures. However, I've gotten to a point where the brute-force search is getting too slow. While I could use a different language, the whole point of my using prolog is that it's extremely fast/simple to write code to test a hypothesis. I'm wondering, is there an implementation of Prolog that allows for

What's the best way to pass data between concurrent threads in .NET?

时光怂恿深爱的人放手 提交于 2019-12-23 12:43:46
问题 I have two threads, one needs to poll a bunch of separate static resources looking for updates. The other one needs to get the data and store it in the database. How can thread 1 tell thread 2 that there is something to process? 回答1: If the pieces of data are independant then treat the pieces of data as work items to be processed by a pool of threads. Use the thread pool and QueueUserWorkItem to post the data to the thread(s). You should get better scalability using a pool of symmetric

Swing components freezing until one component completes its job

喜夏-厌秋 提交于 2019-12-23 12:43:00
问题 I have created a simple JAVA Swing program that has a JTextArea, three JTextFields and one JButton. What this application does is when the user clicks the button it updates the JTextArea with a text line, the text line inserted into the JTextArea is prepared in a for loop and number of repeat times is given in a JTextField. My problem is when I click the start JButton all the components of the application are freeze, I can't even close the window until the for loop completes it's job. How can

How do I make non-essential computations run in the background?

为君一笑 提交于 2019-12-23 12:41:04
问题 This question is in follow up to Why is this code running synchronously? . I realize that my real question is at a higher level than the one in that post. The question I now ask, below, is "how do I accomplish this?" I want to use concurrency in C# to compute things in the background. I have class ptsTin, which represents an existing ground surface. I want to make loading as fast as possible. Some of the work is essential in that you don't have an instance until the work is complete. For

High performance, lock free Java collection with very specific requirements

本小妞迷上赌 提交于 2019-12-23 12:35:14
问题 What would be a suitable candidate for a high-performance concurrent collection with the following requirements: The number of elements in the collection is small (a few elements, usually less than 10) and rarely changes. The main use case is iterating through the elements. This happens a lot and must be super fast (i.e. should be lock free). Occasionally an element will be removed by use of the iterator remove() method. This should preferably also work very fast (but it's less significant