Hi all
I have a question: what is the difference between concurrent programming and parallel programing? I asked google but didn't find anything that helped me to understand that difference. Could you give me an example for both?
For now I found this explanation: http://www.linux-mag.com/id/7411 - but "concurrency is a property of the ...
I'm trying to figure out if the code below suffers from any potential concurrency issues. Specifically, the issue of visibility related to volatile variables. Volatile is defined as: The value of this variable will never be cached thread-locally: all reads and writes will go straight to "main memory"
public static void main(String [] ar...
I'm new to threads. How can I get t.join to work, whereby the thread calling it waits until t is done executing?
This code would just freeze the program, because the thread is waiting for itself to die, right?
public static void main(String[] args) throws InterruptedException {
Thread t0 = new Thready();
t0.start();
}
@Override
pu...
I have some linq2sql stuff which updates some rows.
Then when I submit I do this:
try
{
database.SubmitChanges();
}
catch (ChangeConflictException)
{
database.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
database.SubmitChanges();
}
Now the second submit(the one in the catch) is throwing yet again a ChangeConflictEx...
I've suggested to the maintainers of the D programming language runtime a few times that the memory allocator/garbage collector should use spinlocks instead of regular OS critical sections. This hasn't really caught on. Here are the reasons I think spinlocks would be better:
At least in synthetic benchmarks that I did, it's several t...
Hi all,
I've a Java client which accesses our server side over HTTP making several small requests to load each new page of data. We maintain a thread pool to handle all non UI processing, so any background client side tasks and any tasks which want to make a connection to the server. I've been looking into some performance issues and I'...
I have a long running task, something like:
public void myCancellableTask() {
while ( someCondition ) {
checkIfCancelRequested();
doSomeWork();
}
}
The task can be cancelled (a cancel is requested and checkIfCancelRequested() checks the cancel flag). Generally when I write cancellable loops like this, I use a fl...
There is a set of N real-time data-independent tasks. Each of the tasks processes some digital data stream. A data stream for each task comes from an input port and a resulted stream then is being directed to an output port.
1) What is computationally less intensive: tasks in form of the processes or threads?
2) Does best choice depen...
we experience with some regularity contention on a database table, and would like to evaluate a number of different options for resolving this issue.
in order to do so, i need to reproduce in a test case, contention on a table (any table) with repeatable reliability.
the approach i'm considering would be to reverse the semantics of a l...
I am using the System.Drawing.Graphics.DrawLines(Pen pen, PointF[] points) method in a multithreaded application, but the System.Drawing.Graphics isn't shared between threads.
Why it keeps throwing the System.InvalidOperationException: The object is currently in use elsewhere ?
...
What's the best way to wrap non-thread-safe code in the .net framework?
I've got a third-party library that isn't thread safe due to its use of static variables. Rewriting it isn't an option. This library is used by an asp.net web service that receives lots of simultaneous calls.
I've currently got it wrapped in a proxy class that uses...
I'm looking at a code sample from "Java Concurrency in Practice" by Brian Goetz. He says that it is possible that this code will stay in an infinite loop because "the value of 'ready' might never become visible to the reader thread". I don't understand how this can happen...
public class NoVisibility {
private static boolean read...
You have the following scenario:
//Two threads, using shared data
shared data = 2
Thread1: reads shared data
Thread2: reads shared data
Thread1: shared data = read value + 1
Thread2: shared data = read value + 1
result: shared data = 3
//Should have been 4 if not for this problem.
I don't want a solution for the problem,...
We are planning to write a highly concurrent application in any of the Very-High Level programming languages.
1) Do Python, Ruby, or Haskell support true multithreading?
2) If a program contains threads, will a Virtual Machine automatically assign work to multiple cores (or to physical CPUs if there is more than 1 CPU on the mainboard...
I am designing the architecture for a set of WCF services. Due to the nature of the deployment of these services (remotely deployed onto a number of unmanageable systems on client sites, therefore we cannot afford the administrative overhead of database servers), the data store has to be file based (we are leaning quite heavily toward X...
A deadlock normally means that thread (or process) A is waiting for thread B, and at the same time thread B is waiting for thread A.
Currently I encountered a similar situation in our application. Thread A is waiting for an event to be set by thread B. However, thread B is not waiting for thread A, it just won't set the event (no matte...
Hello
I am struggling with the following problem for a week by now and need some advice.
def query(title: String): List[Search] // query("Terminator") => ["Terminator I", "Terminator II", "Terminator 1984", etc...]
def searchIMDB(s: Search): List[SearchResult]
def searchTMDB(s: Search): List[SearchResult]
def filterRedundantSearchR...
Hello. I am facing this issue:
I have lots of threads (1024) who access one large collection - Vector.
Question:
is it possible to do something about it which would allow me to do concurrent actions on it without having to synchronize everything (since that takes time)? What I mean, is something like Mysql database works, you don't have...
I've written a Monte Carlo player for the board game Nine Men's Morris. Everything is basically immutable. The program involves lots of futures (hundreds) and a lot of modifying immutable Maps. Sometimes I get a crash with the following exception:
java.lang.NullPointerException
at scala.collection.mutable.HashTable$class.elemHashCod...
I don't understand why in this implementation stopped is not volatile - If a different thread updates this will it be reflected correctly?
Secondly is testing (!Stopping) atomic?
using System;
using System.Threading;
/// <summary>
/// Skeleton for a worker thread. Another thread would typically set up
/// an instance with some work t...