concurrency

In the Backus-Naur Form what does a comma ',' mean while defining a symbol

Hello, I am as much newbie to Pi-Calculus as I am with Backus Naur Form. Here is one of the core BNF for Pi Calculus ( found in "Applied Pi - A Brief Tutorial" by Peter Sewell) P,Q ::= 0 nil P | Q parallel composition of P and Q ~cv output v on channel c ...

Java share a variable between two threads

Hi, I have two threads. One invokes the update method of a class that modifies a variable. Another invokes the update method of a class that reads the variable. Only one thread writes and one (or more) threads read that variable. What do I need to do in terms of concurrency, since I am new to multi-threading? public class A { publi...

Large File Uploads.

Do large file uploads block an applications request/response cycle? I have an app that allows users to upload multiple large files (images in particular). These files are stored on a remote host. I cannot use async background jobs to upload these images as these have to be immediately accessible to the user once the upload finishes. How ...

ASP.NET concurrency

Suppose I have a.aspx and b.aspx both with a function f. I also have an object instance, o, that is held in Session. Each client has ajax scripts that call a.f and b.f asynchronously. a.f calls o.ReadData b.f calls o.ReadData Object, o, maintains one open file handle, from instatiation, until it is disposed. Are there any concurren...

Is concurrently overwriting a variable with the same value safe?

I have the following situation (caused by a defect in the code): There's a shared variable of primitive type (let it be int) that is initialized during program startup from strictly one thread to value N (let it be 0). Then (strictly after the variable is initialized) during the program runtime various threads are started and they in so...

JBoss Cache Configuration

Hi all! I'm using an extended persistence context (injected Entitymanager at SFSB) and have additionally set @TransactionManagement(value=TransactionManagementType.BEAN) for the SFSB to have full control over the UserTransaction. The Transaction is controlled on client side where I start a lookup for the SFSBs containing a reference to...

paper on event-based v.s. threaded programing

I am trying to tap into the stackoverflow community to aid my fogged memory. A while ago I have read a research paper regarding multithreading v.s. event-base programming paradigm. The thesis is to challenge the current belief that multithreading has a natural limit on the number of threads a system is able to support. It asserts such li...

Java RMI and synchronized methods

(Please leave a comment if the point is not clear) I'm studying the book "Distributed Systems" (by Tanenbaum & Van Steen) and they say something that seems to conflict to what seems to be instead thought by many on Java RMI and synchronized methods. What I thought is that using a synchronized method on a Remote Object implementation (s...

mvc call service layer method

i have a method inside service layer that is called by view layer to save content. the model is annotated with @Version JPA so support concurrent-update. but during web application peak-usage, sometime, i will get 17 Aug 2010 16:30:26,477 ERROR [http-2020-23] - Could not synchronize database state with session org.hibernate.StaleObjec...

How to control glassfish module startup order

I have several web modules. There are dependency between them, say during startup, module B will use MBean exposed by module A. How to configure glassfish to enable it start them by specific order? Or is it possible to configure it to load them concurrently. I searched quite a lot via google, but not result. BTW, I'm using glassfish-2 ...

How bad is using SELECT MAX(id) in MYSQL instead of mysql_insert_id() in PHP?

Hi, Background: I'm working on a system where the developers seem to be using a function which executes a MYSQL query like "SELECT MAX(id) AS id FROM TABLE" whenever they need to get the id of the LAST inserted row (the table having an auto_increment column). I know this is a horrible practice (because concurrent requests will mess the...

Example problems for concurrent computation

There's a plethora of paradigms and methods for concurrent programming in use today. Software transactional memory, actors, shared state concurrency, tuple spaces and many, many more. What I find lacking, however, is a library of interesting test problems for concurrency. One well known example is the "Dining Philosophers Problem", whic...

Parallel Programming With Recursive Functions?

Background of the Problem: I'm trying to write a puzzle solution algorithm that takes advantage of multi-core processors and parallel processing. However, the ideal/easiest solution is a simple recursive function. What's the best way to break down the solution to both take advantage of parallel processing AND the recursive function?...

When will ConcurrentDictionary TryRemove return false

Will it only return false if the dictionary does not contain a value for the given key or will it also return false due to thread race conditions, like another thread adds/updates something? Question in code: ConcurrentDictionary<int, string> cd = new ConcurrentDictionary<int, string>(); // This might fail if another thread is adding ...

Are twisted RPCs guaranteed to arrive in order?

I'm using twisted to implement a client and a server. I've set up RPC between the client and the server. So on the client I do protocol.REQUEST_UPDATE_STATS(stats), which translates into sending a message with transport.write on the client transport that is some encoded version of ["update_stats", stats]. When the server receives this me...

Java volatile for concurrency

Ok so I just read this question http://stackoverflow.com/questions/106591/do-you-ever-use-the-volatile-keyword-in-java, and I get using a volatile variable in order to stop a loop. Also I've seen this reference, http://www.javamex.com/tutorials/synchronization_volatile.shtml. Now the article says that volatile variables are non-blocking....

There is a rule to find out which objects could possibly have concurrent access in a Java program?

There is a rule to find out, for sure, all objects that could possibly have concurrent access in a Java program? My intention is use such rule, if it exists, to find out which Java classes could possibly have concurrent access and then guarantee that they are thread-safe. This rule could be very useful when inspecting a large Java projec...

A Single .NET Event Subscriber Associated with Multiple Event Publishers & Multithreading

Hello, Supposing I have a single class, containing a simple method. Let's say that there is a delegate with the same signature as this method. I want to run multiple long-running processes, each one launched from this class. Each process contains an event, which is composed of multicast delegates of the same type as the delegate mentio...

Thread-ring benchmark

Today I was doing the thread ring exercise from the Programming Erlang book and googled for other solutions to compare. I found that the language shootout has exactly this the same problem as a benchmark. I had the impression that this is an area where Erlang should be fastest, but turns out that C and C++ are again on top. My suspicion ...

Do I have to manually stop threads in Java?

Hi, When my application is ready to exit, either by closing a window or invoking the System.exit() method. Do I have to manually stop the threads I may have created or will Java take care of that for me? Thanks, ...