concurrency

Is iterating ConcurrentHashMap values thread safe?

In javadoc for ConcurrentHashMap is the following: Retrieval operations (including get) generally do not block, so may overlap with update operations (including put and remove). Retrievals reflect the results of the most recently completed update operations holding upon their onset. For aggregate operations such as putAll and clear,...

Cummulative array summation using OpenCL

I'm calculating the Euclidean distance between n-dimensional points using OpenCL. I get two lists of n-dimensional points and I should return an array that contains just the distances from every point in the first table to every point in the second table. My approach is to do the regular doble loop (for every point in Table1{ for every ...

Concurrent Database transactions

My requirement is to fetch a unique ID from the database for processing on the application server(clustered application).For this , I have a table with single cell, holding a value X. This value will be incremented everytime it is fetched. BEGIN TRAN UPDATE ID_TABLE SET VALUE = VALUE + 1 SELECT VALUE FROM ID_TABLE END TRAN ...

properly writing a model with a property intended for view binding

I have a class MyModel with a property datalogEnabled (and other ones, but let's start there) that I would like to be able to implement properly for use with UI/view binding. public class MyModel { static final String KEY_DATALOG_ENABLED = "datalogEnabled"; final private PropertyChangeSupport pcs = new PropertyChangeSupport(th...

Assigning a object to a field defined outside a synchronized block - is it thread safe?

Is there anything wrong with the thread safety of this java code? Threads 1-10 add numbers via sample.add(), and Threads 11-20 call removeAndDouble() and print the results to stdout. I recall from the back of my mind that someone said that assigning item in same way as I've got in removeAndDouble() using it outside of the synchronized bl...

What does "readback" mean in terms of computer memory?

I am messing with multiple threads accessing a resource (probably memory). What does "readback" mean in this context? Any guides will be helpful... Google didn't give me any good results. ...

Java Google Appengine sharded counters without transactions

I'm going through the Sharded Counters example in Java: http://code.google.com/appengine/articles/sharding_counters.html I have a question about the implementation of the increment method. In python it explicitly wraps the get() and increment in a transaction. In the Java example it just retrieves it and sets it. I'm not sure I fully ...

Prevent programmers from acquiring lock on class instance

Is it possible to write a class such that other programmers cannot acquire a lock on an instance of the class? Lock-abuse, if there's a term like that, can be a serious killer. unfortunately, programmers torn between the disastrous forces of delivering thread-safe code and limited knowledge of concurrency, can wreak havoc by adopting th...

How to limit number of processes?

In my PHP web application, I am trying to limit the number of CPU/memory intensive processes that run (for example, ImageMagick's 'convert' command). I have a number of crons jobs that execute various scripts that could potentially execute too many instances of these CPU/memory intensive processes. In my attempt to limit such processes,...

Concurrency: synchronized vs lock

What is the difference between synchronized and lock? Thx. ...

Are Quartz scheduler instances thread safe?

Can more than one thread safely call methods on an instance of Scheduler returned by the StdSchedulerFactory concurrently? ...

Please explain History Monoid in Simpler Terms.

I tried to read the History monoid but couldn't wrap my head around it. Could somebody please explain it in simpler terms? Thank you Reference: http://en.wikipedia.org/wiki/History_monoid ...

Concurrent Processes

I'm looking to run multiple concurrent processes in a C program. The programs will take arguments from the user and then execute each argument as a child process. I think that means that all I need to do is ensure that the fork() is performed by the original parent process each time, and then each of the resultant child processes will ru...

Why does Google App Engine support a single thread of execution only?

Does anybody have an idea why Google App Engine permits only a single thread of execution for a deployed application? I personally believe that it has something to do with the predictability of an application so that Google can size its performance more reliably. There does not appear to be any rationale posted on Google's site regardin...

Concurrent map sorted by values with fast increment value operation

I have a web application where I need to keep track of "most popular" (most visited) articles. Most of the pages (including article pages) in that application displays "most popular" list in sidebar, so this list will be retrieved very often. On the other hand, articles are visited quite often too (approximately 1/2 of page visits are vi...

Terminate unresponsive thread

I have built a java application and have a thread thats doing something in the background when a button was pressed. The problem is, that thread might lock up, perhaps due to an infinite loop. Is there a way I can force terminate that thread? EDIT: I am using LuaJ on the java platform. It has the potential of locking up and I don't real...

Java - notify() vs notifyAll() - possible deadlock?

Is there any situation in which notify() can cause deadlock, but notifyAll() - never? For example, in case of multiple locks. notify() notifies only one thread to run, which checks for lock to some object and becomes waiting again, though another thread could unlock that object. In case of using notifyAll(), all threads will be notified...

Do java threads get deleted when they finish

Say I spawn a thread every couple seconds using the method below and every thread takes about a second to complete. Do the finished threads get deleted? new Thread (new myRunnableClass()).start(); ...

Determining row changes since last access in SQL Server

We have a multiuser system with users saving to a central SQL Server 2005 database. We have encountered an issue where a user refreshes in changes from the db while another user saves new data. The way we are currently collecting the changes is we have a timestamp column on each table which is filled at every row insert/update. Another u...

Why is one of the combo boxes empty when I open the same application in two windows?

I am working with icefaces for 3 months. Now I am facing concurrent issues when I open the same application in 2 windows at the same time. For the 1st window values for combobox are coming properly, but for the 2nd window the combo box is empty. I am using IE6, Apache Tomcat 6 and Icefaces 1.8. I also made com.icesoft.faces.concurrentD...