Hi,
i'm developing an app which download map tiles around different places in a city. To do this, i have one thread for each place in which i select the tiles and create a thread to download each.
Well, the question is how to avoid creating a thread for a tile that already exists in the thread pool.
Should not just check if the file ...
Any good source/links or concise explaination about it?
Thanks a lot!
...
I occasionally use a volatile instance variable in cases where I have two threads reading from / writing to it and don't want the overhead (or potential deadlock risk) of taking out a lock; for example a timer thread periodically updating an int ID that is exposed as a getter on some class:
public class MyClass {
private volatile int ...
I have a producer-consumer like scenario. Class A produces objects of type E. I have to hold it in a static data structure in class A, because the consumer logic should be handled in a class B, which has no reference to object of A. Is LinkedBlockingQueue the correct data type for the queue? Or are there any better selection for this?
...
I'm doing a program to handle many blocking I/O operations at a time by spawning an Agent/MailboxProcessor per operation.
I've got a bunch of files I've cached in memory in a Map which I want to share among these agents. However, I've also got a FileSystemWatcher to callback whenever changes are made to the files, so that I can update th...
.NET 4 includes new concurrent data structures. The Bag and Dictionary collections have obvious applications but I cannot see any use for the Queue and Stack data structures. What are people using these for?
Also, I've noticed that the design based upon linked lists incurs a lot of allocation and that destroys scalability. This is surpr...
Hi guys,
I am try to create a JSP page that will show all the status in a group of local servers.
Currently I create a schedule class that will constantly poll to check the status of the server with 30 second interval, with 5 second delay to wait for each server reply, and provide the JSP page with the information. However I find this w...
Hi
I am trying to compare the performance of Single and Multithreaded Java programs. Are there any single thread benchmarks which are available which I could then use and convert to their multithreaded version and compare the performance. Could anybody guide me as to what kind of programs(not very small) are suitable for this empirical c...
I'm working on a GUI application in Swing+Clojure that requires various mutable pieces of data (e.g. scroll position, user data, filename, selected tool options etc.).
I can see at least three different ways of handling this set of data:
Create a ref to a map of all the data:
(def data (ref {
:filename "filename.xml"
:scroll ...
I can't seem to find a good and accessible explanation of "Leader/Follower" pattern. All explanations either simply refer to it in the context of some problem, or are completely meaningless.
Can anyone explain to the the mechanics of how this pattern works, and why and how it improves performance over more traditional asynchronous IO mo...
protected synchronized boolean isTimeoutOccured(Duration timeoutDuration) {
DateTime now = new DateTime();
if (timeoutOccured == false) {
if (new Duration(requestTime.getMillis(), now.getMillis()).compareTo(timeoutDuration) > 0) {
timeoutOccured = true;
}
}
return timeoutOccured;
}
protected...
What's the status of multicore programming in Haskell? What projects, tools, and libraries are available now? What experience reports have there been?
...
I have a number of atoms in my code where a common requirement is to update them to a new value, regardless of the current value.
I therefore find myself writing something like this:
(swap! atom-name (fn [_] (identity new-value)))
This works but seems pretty ugly and presumably incurs a performance penalty for constructing the anonym...
I'm trying to get some speed up in my program and I've been told that Ruby Fibers are faster than threads and can take advantage of multiple cores. I've looked around, but I just can't find how to actually run different fibers concurrently. With threads you can dO this:
threads = []
threads << Thread.new {Do something}
threads << Threa...
Hi All,
I have a maintenance plan that looks like this...
Client 1 Import Data (Success) -> Process Data (Success) -> Post Process (Completion) -> Next Client
Client 2 Import Data (Success) -> Process Data (Success) -> Post Process (Completion) -> Next Client
Client N ...
Import Data and Process Data are calling jobs and Post Process...
Hi Folks,
I am supposed to process images in a multithreaded mode using Java. I may having varying number of images where as my number of threads are fixed. I have to process all the images using the fixed set of threads.
I am just stuck up on how to do it, I had a look ThreadExecutor and BlockingQueues etc...I am still not clear. What...
I've Lists and Maps in my WebAppContext.
Most of the time these are only read by multiple Threads but sometimes there's the need to update or add some data.
I'm wondering what's the best way to do this without incurring in a ConcurrentModificationException.
I think that using CopyOnWriteArrayList I can achieve what I want in terms of -...
If I have a multiprocess system that needs to process a bunch of directories, 1 directory per process, how likely is it that two processes will happen to grab the same directory?
Say I have dir/1 all the way to dir/99. I figure that if I touch a .claimed file in the dir that the process is working on, there won't be conflicts. Are there...
In .NET when you make an async call I understand that this call is resolved in a seperate thread thus not blocking the original thread where the call was made.
How does the mechanics behind this work. Is a new thread spawned on every async call or is there a shared async thread that handles these operations? If it is a shared thread, d...
A while back I put together a simple class named Actor that was my implementation of the Actor Model. Since then I've used it with great success (Minus some annoying workarounds for the lack of a discriminated union type.). I am left with an issue that I am unsure of how to resolve without making the class clunky and slow.
When someone ...