Hi,
I am currently resolving a performance degradation issue due to heavy lock contention. I am considering "Lock splitting" to resolve this issue.
The skeletal usage pattern is ::
CURRENT USAGE ::
public class HelloWorld{
public static synchronized method1(){
//uses resource 1
}
public static synchronized method2(){...
I have a bizarre need here, and I am unsure of it's feasibility. I can only think how I would do it using threads (To create another thread that performs a Quine function along side a thread running the script I want to Quine and execute at the same time (without manually adding alerts everywhere!!!), but javascript doesn't have that fun...
I have a few scripts that need to run concurrently as separate processes. My plan is to have a cron job that executes multiple instances of these scripts at a set interval. Is this a good idea? What are the pros/cons to this approach? Are there any other options I need to consider?
Bottomline: I'm trying to mimic multithreading. Any rac...
Hey all,
I just watched the following video: Introduction to Node.js and still don't understand how you get the speed benefits.
Mainly, at one point Ryan Dahl (Node.js' creator) says that Node.js is event-loop based instead of thread-based. Threads are expensive and should only be left to the experts of concurrent programming to be ut...
/*
This should always produce 0 as output since all three methods increment(), decrement(), value() are thread safe(synchronized). but it is returning 1
*/
class Counter implements Runnable {
private int c = 0;
public synchronized void increment() {
c++;
}
public synchronized void decrement() {
c--;
...
As part of a Linux benchmark application, I have a parent process that forks multiple children that will each perform a task in parallel. I'm using signals to coordinate between them since I'm looking for as accurate of timing as possible. Each child will prepare for the test, then enter a 'barrier' controlled by the parent via signals...
What is the difference between memory consistency errors and thread interference?
How does the use of synchronization to avoid them differ or not? Please illustrate with an example. I couldn't get this from the sun Java tutorial. Any recommendation of reading material(s) to understand this purely in context of java would be helpful.
...
Dear StackOverflow,
I am looking for a high-performance, concurrent, MultiMap. I have searched everywhere but I simply cannot find a solution that uses the same approach as ConcurrentHashMap (Only locking a segment of the hash array).
The multimap will be both read, added to and removed from often.
The multimap key will be a String an...
Using volatile on a variable reduces the risk of memory consistency error (Please correct me if this reveals some holes in my understanding of any relevant concept). So in the following example even though the variable c1 is volatile, still the occurrence of memory constancy error results in c1 becoming 15 or sometimes 14 in the output ...
OK I am not only new to concurrency in java but am also fairly new to java programming. I tried understanding concurrency from The java tutorials, tried reading Concurrency in practice but it seemed too advance, so tried reading from couple of other books: SCJP A comprehensive, The java programming language 4th edition.
Its as if there ...
Given a table that is acting as a queue, how can I best configure the table/queries so that multiple clients process from the queue concurrently?
For example, the table below indicates a command that a worker must process. When the worker is done, it will set the processed value to true.
| ID | COMMAND | PROCESSED |
| 1 | ... | tr...
I want to create an async version of my page to speed it up. However, the number of async requests I need depends on the user's personal settings.
For example, I have a dashboard that can display numerous things. I want to do something like this:
public void IndexAsync(string city) {
AsyncManager.OutstandingOperations.Increment(3);
N...
I have a controller that looks like the following:
foreach(var setting in userSettings)
{
//connect to db here and run a 500ms query
}
The userSettings varies per user and so sometimes there are 2 settings which means 2 500ms queries need to run, while sometimes the user has 15 settings, meaning 15 500ms queries will run.
Since ...
Hi,
I have a multi-threaded C++ application.
Now I know that for global shared variables, you should use volatile in some cases while checking the state of the variable or else the compiler could assume that the variable's value never changes (in that thread).
What if, however, instead of checking the status of a variable I call a...
Hi,
I am using SwingWorkers to make my GUI responsive. But I can not understand the following:
I have a remote method I want to call from the GUI as the user presses a button.
I have inside the action of the button (short for presentation of problem):
//in action of button
SwingWorker worker = new SwingWorker<boolean,Void>(){
@Over...
I've been messing around with Expressions - and I may have gone beyond my capabilities - but here goes... I've implemented 'type-safe' INotifyPropertyChanged implementation (an example is here), but gone a bit farther and included changetracking:
public abstract BaseViewModel<TEntity>:INotifyPropertyChanged
{
private readonly IBaseC...
The software stack I'm using is: tomcat->spring-> hibernate-> DBCP -> postgreSQL
I have a query that search for some data using a column of type "timestamp without time zone".
If the application is tested in a single user mode, then there are no problems.
I'm using JMeter to make some stress test and can see that sometimes the query f...
The question came up when I saw this code:
private static volatile ConcurrentHashMap<String, String> cMap = null;
static {
cMap = new ConcurrentHashMap<String, String>();
}
To me it looks like the volatile there is redundant as the container is ConcurrentHashMap which according the JavaDoc already has synchronized puts, DUH, the c...
Please help me understand this program's execution and what concepts apply here in the larger sense? An illustration which explains thread(s)/stack(s) creations and destruction would be helpful.
class Joining {
static Thread createThread(final int i, final Thread t1) {
Thread t2 = new Thread() {
public void run...
I'm using the UPDLOCK and READPAST sql hints in a stored procedure in order to implement a sort of a table queue (I say a sort because I select top 1500 instead of a top 1, and I don't delete the rows after I select them. For more details, see question http://stackoverflow.com/questions/3636950/return-unlocked-rows-in-a-select-top-n-quer...