Concurrency is a property of systems in which several processes are executing at the same time.

learn more… | top users | synonyms

0
votes
0answers
21 views

Proper way of empting deques with higher priorities with a threaded removal

I'm developing a producer/consumer system with three deques (each for one priority level, from max to min); first deque has major priority, so it must be read before others: once empty, others deques ...
0
votes
0answers
45 views

Maintaining consistency with loosely coupled business and data layers

Take the following sequence of events: Business layer requests data x and y from data layer. Data layer returns version 1 of x and y. Business layer starts performing logic based on data x and y. ...
-3
votes
0answers
62 views

How to deal with concurrent accesses to ArrayList? [duplicate]

I have an ArrayList that stores some data about users. Users can be created, deleted, and updated via REST calls. How do I ensure concurrent accesses to the ArrayList are consistent?
2
votes
1answer
165 views

When to lock an object in a game

I'm writing a game in Java where each game object has a number of properties, but these can all be changed in one of two ways: Every second, a tick runs which may automatically cause a change. Users ...
2
votes
2answers
66 views

AMQP broker and happen-before guarantees

I am trying to figure out how an AMQP broker, such as RabbitMQ, can be integrated in our architecture. This should allow to easily scale horizontally in the future. For the sake of simplicity, let me ...
0
votes
1answer
36 views

How do I handle the potential concurrency problem of making a payment to Paypal for a limited number of items?

After doing some investigation* I have learned that I could potentially have a concurrency problem. I'm currently building a Tournament Platform in ASP.NET MVC 5 with Entity Framework 6. So far, I'...
1
vote
0answers
51 views

One producer and one consumer vs inconsistent shared resource state

I was reading about implementation of producer-consumer problem with one producer and one consumer. Looking at this paragraph I see the implementation where shared resource access is not synchronized ...
4
votes
2answers
86 views

How to handle a one-time startup SQL script

I'm trying to figure out the best way to tackle running a one-time SQL script when a service instance starts up. Here's the scenario: We run multiple Amazon instances of our service in parallel. ...
4
votes
4answers
152 views

Serializing mutating objects

In our system a media file can have several states: invalid, empty, uploading, ingesting, ready… Depending of the state, information about the media are accessed in different ways. For example, during ...
4
votes
0answers
89 views

possible to achieve Rust's ownership model with a generic C++ wrapper?

Looking through this article on Rust's concurrency safety: http://blog.rust-lang.org/2015/04/10/Fearless-Concurrency.html I was wondering how many of these ideas can be achieved in C++11 (or newer)....
17
votes
1answer
462 views

How does Rust diverge from the concurrency facilities of C++?

I am trying to decide whether Rust fundamentally, sufficiently improves upon the concurrency facilities of C++ that I should spend the time to learn Rust. In light of Stackexchange's format, I should ...
2
votes
1answer
143 views

What are the advantages of Observables over an iterable of futures?

I recently came across the ReactiveX pattern for asynchronous data-flows. I studied the information provided there and also watched this talk by a Netflix engineer on how they used Observables to ...
3
votes
1answer
81 views

Is there use case for implementing a callback if a future is returned?

If I have function which returns a future, is there any reason to also include a callback where the callback is simply called right before the future completes? The only advantage I can think of ...
2
votes
1answer
104 views

Should I use BackgroundWorker in Pipeline pattern?

I am planning the implementation of a Pipeline pattern as seen in this MSDN article. This is a WPF application for which I need to monitor progress of each stage of the pipeline in order to display it ...
2
votes
1answer
82 views

Possible DRY with Pausing Mechanism

Background I am currently working on the architecture for a future software design. The design is one long running task (hours-long) with thousands of sequential calls to various libraries. I ...
-1
votes
2answers
140 views

Lock threads or not lock threads?

I have an application (full-stack) that is used millions of times concurrently. Some vital application properties are managed on the client side (at the time it seemed to be the simplest approach to ...
9
votes
4answers
316 views

Composable concurrency in Java or any other programming language

While I was reading a research paper on concurrency named Software and the Concurrency Revolution (html version). I came across following lines: Unfortunately, although locks work, they pose ...
0
votes
1answer
130 views

Synchronisation with offline system

I'm designing a system from which I will synchronise business data from mobile device that have an embedded application that generates datas and send them back to the server. Each line synchronised ...
1
vote
4answers
339 views

What is the ninja performance gap, why is it so large, and how can we overcome it?

According to this abstract: The "Ninja gap" [...] is the performance gap between naively written C/C++ code that is parallelism unaware (often serial) and best-optimized code on modern multi-...
1
vote
2answers
119 views

Why are the Coffman conditions necessary for a deadlock to occur?

Quoting https://en.wikipedia.org/wiki/Deadlock#Necessary_conditions : A deadlock situation can arise if all of the following conditions hold simultaneously in a system: Mutual exclusion: ...
0
votes
1answer
66 views

Concurrent languages and non-concurrent dependencies [closed]

We had a bug caused by ruby workers (4 processes, 1 thread each) doing batching records using a legacy mongodb as the store. The race condition was around whether the batch was full or not; with one ...
3
votes
1answer
40 views

Asynchronous socket.io for lots of concurrent messages

We have a web application which currently operates like this on a typical view/page: the front has to display 100+ "previews" (in the form of base64 images) each of this preview is built on-demand ...
4
votes
2answers
358 views

Understanding the Single-Writer Principle

The article on the Single-Writer Principle of the Mechanical Sympathy blog explains how bad queues are (performance-wise), because they need to be able to receive messages from multiple produers, and ...
0
votes
1answer
80 views

Concurrent and atomic updates to multiple properties/variable of an object

I have a class with multiple setters and want to make atomic updates to multiple properties/variables. As far as I can see there are three methods that could work: Call all setters in synchronized ...
0
votes
0answers
61 views

How to prevent parallel calls to model?

While there is some command running which calls methods on some model, how to prevent concurrent calls for critical places in that model? If multiple requests comes in then they should maintain their ...
4
votes
4answers
219 views

How to prevent user from requesting API method multiple times in parallel?

Let's say we have an app where the users gain points and can exchange them for rewards. The exchange request, in pseudo-code, could look like this: function exchangePointsForReward(userId, rewardId){ ...
2
votes
1answer
200 views

Event Sourcing + Updates to multiple aggregates

I'm trying to learn about event sourcing for potential application to a booking system I am building - I think I understand the core concepts, but I'm having trouble understanding how to handle cases ...
-1
votes
1answer
82 views

Approaches to Concurrency [closed]

I’ve been doing some research on the various approaches to concurrency, and I’ve ended up with the following taxonomy: Manual thread based concurrency with locks Asynchronous dispatch queues and ...
2
votes
0answers
71 views

Handling exceptions in multiple-issue CPUs

From what I read, VLIWs execute instructions in bundles, i.e. the CPU loads a bundle of instructions and dispatches them all at once. This is possible because the compiler scheduled instructions in ...
0
votes
1answer
864 views

akka and futures, which ExecutionContext should be used

Following this blog by @Tomasz Nurkiewicz we can see that 4 different approaches are available for picking the ExecutionContext, when interacting with akka actors, for scala futures to run on. import ...
3
votes
1answer
141 views

Java concurrency

I am working to solve interesting concurrent problem! Not sure if I understand it correctly since I am little bit confused. The system needs to process the prices, and typically they cannot be ...
0
votes
1answer
261 views

Ever-running timed tasks

I need to design a piece of software which is invoking some actions regularly. By regularly I mean that there is x things that need to be done at 12.00, y things at 12.30 etc,etc. The times and ...
1
vote
2answers
126 views

Don't quite understand check and set in concurrency

I don't entirely understand check and set behaviour.. here is an example: public static void main(String[] args) { List<String> list = Collections.synchronizedList(new ArrayList<>...
4
votes
2answers
423 views

Why is Akka good for concurrency?

I am new to Akka and actor framework - I am sure I am missing something obvious, please accept my apologies in advance. I keep reading that one of the main points to choose Akka is the way it manages ...
2
votes
3answers
179 views

Long running DB query with concurrent write at the same time [closed]

We have a big table with a lot of data and a select query which takes 3 seconds to run. However we are a highly concurrent environment and each second we get 100 new records in our database. So let'...
1
vote
0answers
117 views

Terminology - Difference between thread and process and how they manage DB connections

I've been working more with concurrency in Ruby recently, and I keep seeing various articles using "threads" and "process" interchangeably. What are the actual definitions of these terms? Is a ...
1
vote
1answer
185 views

Does ReaderWriterLockSlim provide thread safety and speed efficiency (compared to a traditional lock) when using a List?

I have a list, to which I write once in every update Loop and then I spawn some tasks which create read that List and create a duplicate to manipulate that data. More or less it's List.ToList() call ...
0
votes
0answers
49 views

Is using synchronization in service layer a bad idea?

I need to implement a mailbox monitor system as a web service. I have follow classes: MailboxMonitor: Contains information such as username, password, pulling interval etc. MailboxMonitorRepository: ...
3
votes
1answer
111 views

How does condition_variable::notify_one() choose which thread to unblock?

notify_one() of C++ 11 thread library is used to unblock one of the waiting threads. How does it choose which thread to unblock? To begin with, I tried googling but could not find any appropriate ...
5
votes
3answers
1k views

Is REST only limited to optimistic concurrency control?

Context Due to the statelessness of the REST architectural style involving that each requests stands completely alone, leading server to never store any informations about client. Thus, pessimistic ...
4
votes
1answer
2k views

Difference between Consumer/Producer and Observer/Observable

I am working on the design of an application that consists of three parts: a single thread that watches for certain events happening (file creation, external requests etc.) N worker threads that ...
1
vote
0answers
145 views

Injecting locking policy into a class

I have a class that does some operations on data, and I want to have different locking schemes (no-lock, simple-lock, and read reader-writer lock) in different situations. Think this main class like ...
1
vote
3answers
2k views

Can multiple synchronized methods in same object run concurrently

As far as i know when there are multiple synchronized methods(both static and instance) in a class, java allows only one such method to run at a time. But what if a thread acquires lock on an object ...
4
votes
4answers
595 views

Testing concurrency/thread-safety

A program I have wrote uses multiple threads and I believe my program is thread-safe but how can I really know? I've read a number of examples online and none of them describe how to test the code is ...
1
vote
1answer
173 views

Generic PHP web interface for handling concurrent updates optimistically

I'm looking in to writing a new PHP based CMS which handles concurrent edits optimistically like source version control rather than pessimistic locking like Wordpress. I want to be able to write some ...
9
votes
1answer
485 views

When asynchronous tasks make a bad UX

I'm writing a COM add-in that's extending an IDE that desperately needs it. There are many features involved, but let's narrow it down to 2 for the sake of this post: There's a Code Explorer ...
1
vote
1answer
946 views

How to concurrently write data in Java without locking?

How to implement a multi-threaded program in which each thread needs to write/output some data (in any order of course) but without the locking overhead that is involved with files or a particular ...
-2
votes
1answer
558 views

Crawler - programming language choice [closed]

I'm currently developing a web crawler. The first version was developed in Node.js and runs pretty well. The issues that I encountered with Node.js are in no particular order: slow URL and query-...
25
votes
3answers
4k views

How much work should I place inside a lock statement?

I am a junior developer working on writing an update for software that receives data from a third-party solution, stores it in a database, and then conditions the data for use by another third-party ...
1
vote
1answer
112 views

is a DoS attack a good analogy of Dining Philosophers?

Let's say that, instead philosophers, we have TCP/IP connections to a server, and instead forks we have the server's TCP/IP avaliable ports. In this scenario, we don't have a lot of connections ...