concurrency

SynchronousQueue fairness

Hi I'm using a 1producer-1consumer design in my app using a SynchronousQueue. By now, I'm using it with the default constructor (fair=true). And I'm wondering about how "fair=false" would affect to the system (performance and specially concurrency behaviour). Here what the docs tell: SynchronousQueue public SynchronousQueu...

Bash: limit the number of concurrent jobs?

Is there an easy way to limit the number of concurrent jobs in bash? By that I mean making the & block when there are more then n concurrent jobs running in the background. I know I can implement this with ps | grep -style tricks, but is there an easier way? ...

.NET Asynchronous stream read/write

Hi, folks. I would really appreciate to have your help on the following issue: I have been trying to solve this "Concurrent Programming" exam exercise (in C#): Knowing that Stream class contains int Read(byte[] buffer, int offset, int size) and void Write(byte[] buffer, int offset, int size) methods, implement in C# the NetToFile me...

Scalability implications of converting stateless session beans to POJOs

Imagine a heavily-used service object that's implemented as an EJB 2.1 SLSB, and that also happens to be thread-safe in itself by virtue of having no state whatsoever. All its public methods are transactional (via CMT), most simply requiring a transaction, but some requiring a new transaction. If I convert this SLSB to a genuine singlet...

JPA cache up-to-dateness with concurrent access to the database

A service tier that implements its persistence based on JPA can profit hugely from the second-level cache that is managed transparently by the JPA provider (e.g. Hibernate, Toplink/Toplink Essentials etc.). When this cache is activated, it holds instances of the persistent classes as soon as they were loaded from the database for the fir...

Java multithreading reading a single large file

What is an efficient way for a Java multithreaded application where many threads have to read the exact same file (> 1GB in size) and expose it as an input stream? I've noticed that if there are many threads (> 32), the system starts to contend over I/O and has a lot of I/O waits. I've considered loading the file into a byte array that...

What are recommended books for Parallelization ?

Hi, From my previous posts, I come to know that today software industry is moving towards more and more of parallelization and I want to learn and understand more about this technology and what are some of the recommended books/resources for Parallelization ? Thanks. ...

Books on Pi-calculus

Hi everyone!!!!!!! What is a good book on Pi-calculus, which will give an idea of practical problems? Can you suggest some new technologies in Pi-calculus to learn? Thank you. ...

Concurrency issues while accessing data via reflection in C#

I'm currently writing a library that can be used to show the internal state of some running code (mainly fields and properties both public and private). Objects are accessed in a different thread to put their info into a window for the user to see. The problem is, there are times while I'm walking a long IList in which its structure may ...

How should I make my hashtable cache implementation thread safe when it gets cleared?

I have a class used to cache access to a database resource. It looks something like this: //gets registered as a singleton class DataCacher<T> { IDictionary<string, T> items = GetDataFromDb(); //Get is called all the time from zillions of threads internal T Get(string key) { return items[key]; } IDicti...

Text on Concurrency/Parallel Programming.

Id like for a good text on concurrent programming, I really dont know where to start. Would you be so kind to recommend me one, possibly at the systems level. ...

Question About Deadlock Situation in Java

I'm learning about deadlocks in Java, and there's this sample code from Sun's official tutorial: Alphonse and Gaston are friends, and great believers in courtesy. A strict rule of courtesy is that when you bow to a friend, you must remain bowed until your friend has a chance to return the bow. Unfortunately, this rule doe...

uncommitted reads?

I was looking at potential concurrency issues in DB so i went to read up. I found http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/admin/c0005267.htm and it mentions access to uncommitted data. Access to uncommitted data. Application A might update a value in the database, and application B ...

How to determine what part of Java code needs to be synchronized?

How to determine part of what Java code needs to be synchronized? Are there any unit testing technics? Samples of code are welcome. ...

concurrent queue - general question (description and usage)

Hello, I am having some trouble grasping the idea of a concurrent queue. I understand a queue is a FIFO, or first come first serve, data structure. Now when we add the concurrency part, which I interpret as thread safety (please let me know if that is incorrect) things get a bit fuzzy. By concurrency we mean the way various threads can...

What are other modern, free analogs of Squeak and Esterel?

A long time ago, Rob Pike and Luca Cardelli wrote a paper called "Squeak: a language for communicating with mice". It was based on Hoare's communicating sequential processes, but it was compiled into single-threaded C code - no threads or scheduler at runtime. However, I can't find a compiler for Squeak, and Rob Pike went on to write new...

Synchronized Producer & Consumer with Circular buffer

I've got a producer and a consumer. The producer writes fixed size items on a given shared memory area, and the consumer retrieves them. The producer can be noticeably slower or faster than the consumer, randomly. What we want is that If the producer is running faster than the consumer, when it fills the circular buffer, it keeps wri...

What makes Erlang suitable for soft real-time applications?

Some background I'm working on building a programming language for digital media programming, which should support concurrency using no-sharing message passing and soft real-time (i.e. do your best to compute audio/video without losing samples or frames and with a constant throughput). It turns out that both these features are surprisi...

Is the volatile keyword required for fields accessed via a ReentrantLock?

My question refers to whether or not the use of a ReentrantLock guarantees visibility of a field in the same respect that the synchronized keyword provides. For example, in the following class A, the field sharedData does not need to be declared volatile as the synchronized keyword is used. class A { private double sharedData; p...

Google MultiMap and synchronization

Hi, I dont understand why i get a concurrentModificationException when i iterate trough this multimap. I read the following javadoc entry, but i'm not sure to understand the whole thing. I tried to add synchronized block. But i doubt on what to synchronize with, and when. Dont hesite to be crude if do huge mystake with concurency ;-)...