I am in the design phase of a programming language, currently thinking about the concurrency aspects. I need to figure out a consistency model, i.e. how data is handled by concurrent processes programmed in this language.
There are two important criteria:
I prefer ease-of-use over performance, as long as the consistency model allows g...
Hello, I've got lots of JTree in my app, all using different instances (with different options) of the same custom TreeModel class. I'm trying to add some threading to speed things up, since the getChildren() member takes a while to run, I added a SwingWorker subclass to the TreeModel and in my getChildren() I create an instance of that...
I have implemented a DAL using Rob Conery's spin on the repository pattern (from the MVC Storefront project) where I map database objects to domain objects using Linq and use Linq to SQL to actually get the data.
This is all working wonderfully giving me the full control over the shape of my domain objects that I want, but I have hit a ...
I am working on BoundedBuffer class in consumer and producer we want to use the Semaphore in that class
we did that but there are an error in every use of acquire()
the rerror is:
unreported exception java.lang.InterruptedException; must be caught or declared to be thrown
Here is the code:
import java.util.concurrent.Semaphore;
publi...
I'd like to know when my application is idle so that I can preload some content. Is there an event or something similar implemented in PyQt?
(I could also do it with threads, but this feels like being too complicated.)
...
I have two transactions T and U which are executed simultaneously in a DB. How does one provide an example of the lost update problem?
We can assume that we have three accounts A,B,C and they each have £100,£200 and £300 respectively.
...
When you write an iterator function in C#, using yield syntax, the compiler internally translates your function into a class. So, if I write something like this:
IEnumerator<int> MyIterator () {
for (int i = 0; i < 10; i++)
yield return i;
}
Invoking MyIterator() constructs a class with a private field for i, instead of using a ...
Recently I read this Wikipedia article regarding the Dining Philosophers problem but I am not clear with Chandy / Misra solution.
According to the article, "When a philosopher with a fork receives a request message, he keeps the fork if it is clean, but gives it up when it is dirty." In the context of this question, he passes it if he i...
Is there a simple way to do the equivalent of this, but run the two processes concurrently with bash?
$ time sleep 5; sleep 8
time should report a total of 8 seconds (or the amount of time of the longest task)
...
Hi,
I'd need advice on following situation with Oracle/PostgreSQL:
I have a db table with a "running counter" and would like to protect it in the following situation with two concurrent transactions:
T1 T2
SELECT MAX(C) FROM TABLE WHERE CODE='xx'
-- C for new : result + 1
SELECT MAX(C) FROM TABLE WHERE CODE='xx';
...
I'm in the process of designing a system which connects to one or more stream of data feeds and do some analysis on the data than trigger events based on the result. In a typical multi-threaded producer/consumer setup, i will have multiple producer threads putting data into a queue, and multiple consumer threads reading the data, and the...
I have a fairly specific question about concurrent programming in C. I have done a fair bit of research on this but have seen several conflicting answers, so I'm hoping for some clarification. I have a program that's something like the following (sorry for the longish code block):
typedef struct {
pthread_mutex_t mutex;
/* some sh...
Hi all members of stackoverflow, I have a question
What happend when I declare a variable inside a method, for example.
void myMethod() {
Ship myShip = new Ship();
}
Where is allocated myShip reference, in stack or in the heap ?
I think in stack but I'm confused because I was reading in J2ME Game Programming book
"Java classes ...
Question slightly in the abstract...
We have a situation where we have a struct that can be accessed by 2 or 3 threads concurrently.
We wish to signal to a thread that tries to modify the struct if it is already being modified.
e.g. The code at the moment:
thread0: struct->modify(var SomeNewState)
thread1: struct->modify(var SomeNewS...
Is it possible to use Java FutureTask with a Spring TaskExecutor to get a Future object?
I'm looking for a TaskExecutor that implements the Java ExecutorService interface, in particular the submit() method. Looking through the Spring Javadocs doesn't reveal any classes like this. Is there some alternate method to handle futures through...
In Brian Goetz's article on how to handle InterruptedException, one paragraph stands out:
The one time it's acceptable to swallow an interrupt is when you know the thread is about to exit. This scenario only occurs when the class calling the interruptible method is part of a Thread, not a Runnable.
I don't get this. Is the reason ...
Scenario
I'm going to be as succinct as possible. Basically with reference to this classdiag, I have a facade which manages a list of SocketManager ( which manages one Socket connection). Each SocketManager logs in to a remote server using a unique SocketUserId. Furthermore, each SocketManager will accept messages from clients destined ...
This question is related with one of my earlier questions..
Previous Post
In there the blocking nature is mentioned as an advantage.
I tried to develop some simple code to demonstrate the blocking nature but I got stuck. I just tried to make a BlockingQueue of size 4 and tried to add 5 elements and ended up with a java.lang.IllegalSta...
Single-threaded version description:
Program gathers a list of questions.
For each question, get model answers, and run each one through a scoring module.
Scoring module makes a number of (read-only) database queries.
Serial processing, single database connection.
I decided to multi-thread the above described program by splittin...
I have a domain object that looks something like this:
class UserStuff
{
String userid;
boolean primordial;
}
In the table, primordial is a TINYINT. A User can have possibly many UserStuff. What I want to ensure is that only one row (the first row created) will have primordial == 1. All subsequent rows will have primordial ==...