Let's say I have a multithreaded C++ program that handles requests in the form of a function call to handleRequest(string key). Each call to handleRequest occurs in a separate thread, and there are an arbitrarily large number of possible values for key.
I want the following behavior:
Simultaneous calls to handleRequest(key) are serial...
In some asp tutorials, like this, i observe the following pattern:
Application.Lock
'do some things with the application object
Application.Unlock
However, since web pages can have multiple instances, there is an obvious concurrency problem. So my questions are the following:
What if one page tries to lock while the obje...
Hello,
my java application has a loading task which requires two server calls which can be parallelized. So I launch a Thread t1 (doing task1) and a Thread t2 (for task2).
I want then to do a specific task, task3 when both other tasks (1 & 2) are over. Naturally I can't tell which of task1 and task2 will finish first...
Which would be f...
Is there an advantage to using java.util.concurrent.CountdownLatch instead of java.util.concurrent.Semaphore? As far as I can tell the following fragments are almost equivalent:
1:
final Semaphore sem = new Semaphore(0);
for (int i = 0; i < num_threads; ++ i)
{
Thread t = new Thread() {
public void run()
{
try
{
...
Hi there,
I maintain an application which, during the course of two years, has constantly required new hardware to be even usable, due to the amount of new users / new data inserted. However, justifying the investiment is sometimes very hard to do.
I started to wonder - how can I establish the maximum number of users a web application...
I have one std::list<> container and these threads:
One writer thread which adds elements indefinitely.
One reader/writer thread which reads and removes elements while available.
Several reader threads which access the SIZE of the container (by using the size() method)
There is a normal mutex which protects the access to the list fro...
This'll be my first question on this platform. I've done lots of development using Flex, WebORB and ASP.NET. We have solved Concurrency problems with messaging (Pessimistic Concurrency Control). This works pretty good but it also makes the whole application dependent of the messaging. No messaging, no concurrency control.
I know that ASP...
Have had to write my first "proper" multithreaded coded recently, and realised just how little I knew about how "imperative-style" (ie, concurrency models used by C++/C#/Java, and the like) concurrent programming techniques.
What resources are there (both books and online tutorials, etc) in order to learn more about this area of coding-...
Hi,
We are trying to build a High-Volume Orders Record System.
There are three primary tables:
1. Orders
2. OrderDetails
3. OrderShipment
The Shipment table contains n record per order and any record shipment entry can be changed before the Customer accepts th order, after which it is frozen. (A business requirement)
Although this may...
In my enviroment i have a database on ms sql 2000 that is being hit by hundreads of users at any time. Also the are lots of intense reports using reporting services 2005 hitting the same database. The problem we are getting is when there are lots of reports runnig at the same time and people using the database concurrent with the reports...
I'm building a .NET client application (C#, WinForms) that uses a web service for interaction with the database. The client will be run from remote locations using a WAN or VPN, hence the idea of using a web service rather than direct database access.
The issue I'm grappling with right now is how to handle database concurrency. That is,...
When using Lucene.Net with ASP.NET, I can imagine that one web request can trigger an update to the index while another web request is performing a search. Does Lucene.Net have built in it the ability to manage concurrent access, or do I have to manage it, to avoid "being used by another process" errors?
EDIT: After reading docs and ...
How would you unittest a safe-publication guarantee in Java?
To be concrete:
I have a Cache interface that has a method getOrLoad(K key, ObjectLoader loader). Thing is, if a Cache cannot find an object for the given key, then it must load it from the ObjectLoader instance. However, the Cache is required to guarantee that the act of loa...
Many optimistic concurrency examples refer to updates by using a database timestamp or flag.
However, I want to handle optimistic concurrency for INSERTS
To illustrate here is a fake scenario:
Multiple users can insert a journal entry at the same time, but allow only one journal entry is allowed per date.
Without any concurrency c...
I am building an enterprise application with .Net 1.1 and SQL Server 2000. I use the read committed isolation level . However changes in non-functional requirements have made it necessary to take measures against non-repeatable reads and phantoms. I see two options:
Introduce row-versioning to check if a row has been modified since it...
We're trying to come up with a recommended design pattern for our team when it comes to record locking. The typical school of thought goes something like this:
1. User picks a record from a list
2. Lock the record with the user id
3. Load the locked record record (no lock, then someone beat ya to it).
Am I missing something, or does th...
I have a List object being accessed by multiple threads. There is mostly one thread, and in some conditions two threads, that updates the list. There are one to five threads that can read from this list, depending on the number of user requests being processed.
The list is not a queue of tasks to perform, it is a list of domain objects t...
I was looking at the source code of java.uti.concurrent.locks.AbstractQueuedSynchronizer and the acquire() method looks something like this -
public final void acquire(int arg) {
if (!tryAcquire(arg) &&
acquireQueued(addWaiter(Node.EXCLUSIVE), arg))
Thread.currentThread().interrupt();
}
Why does it interrupt the t...
Hi!
It seems
import Queue
Queue.Queue().get(timeout=10)
is keyboard interruptible (ctrl-c) whereas
import Queue
Queue.Queue().get()
is not. I could always create a loop;
import Queue
q = Queue()
while True:
try:
q.get(timeout=1000)
except Queue.Empty:
pass
but this seems like a strange thing to do.
S...
I have a neural network written in Erlang, and I just bought a GeForce GTX 260 card with a 240 core GPU on it. Is it trivial to use CUDA as glue to run this on the graphics card?
...