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

learn more… | top users | synonyms

4
votes
2answers
87 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
33 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
57 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 ...
2
votes
1answer
60 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 ...
4
votes
4answers
126 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){ ...
40
votes
6answers
13k views

Is object pooling a deprecated technique?

I am very familiar with the concept of object pooling and I always try to use it as much as possible. Additionally I always thought that object pooling is the standard norm as I have observed that ...
0
votes
1answer
101 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 ...
-1
votes
1answer
67 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 ...
3
votes
1answer
139 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
257 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
123 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 ...
6
votes
3answers
2k views

How to avoid halting of the JVM due to a deadlock in java?

I have read many websites talking about how to avoid and how to design etc. I completely understand those strategies. My question is based on the following preconditions: You have a company with ...
4
votes
2answers
271 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 ...
23
votes
3answers
8k views

Why is multithreading often preferred for improving performance?

I have a question, it's about why programmers seems to love concurrency and multi-threaded programs in general. I'm considering 2 main approaches here: an async approach basically based on signals, ...
2
votes
3answers
570 views

Accessing shared data without blocking in TPL

I am writing a class that contains data. It exposes methods that allow to query the data, while the data is also being updated from an external source (web service, for example). All the methods ...
2
votes
3answers
113 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 ...
1
vote
0answers
68 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 ...
9
votes
3answers
2k views

Parallelism implies concurrency but not the other way round right?

I often read that parallelism and concurrency are different things. Very often the answerers/commenters go as far as writing that they're two entirely different things. Yet in my view they're related ...
1
vote
1answer
100 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 ...
73
votes
10answers
9k views

How to explain why multi-threading is difficult

I am a fairly good programmer, my boss is also a fairly good programmer. Though he seems to underestimate some tasks such as multi-threading and how difficult it can be (I find it very difficult for ...
0
votes
0answers
41 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: ...
9
votes
5answers
2k views

Best-practice to manage concurrency into a basket in a e-commerce website

What is the best practice to manage the case where two customers add in the same time a product whose the stock was only 1 ? Must there be a check in the code of the basket to avoid one of these 2 ...
2
votes
1answer
127 views

How do I handle online payment for items with single quantity? [duplicate]

I would like to implement a robust way to handle ecommerce payment for items with limited quantity, like for example exclusive paintings. Payment would ideally be accepted via PayPal and credit ...
11
votes
5answers
782 views

Why is implicit parallelism/concurrency not more widespread? [closed]

Implicit parallelism^ can take a big burden away from many programmers, placing it on the computer. So... why is it is not more widespread at present? ^ Implicit parallelism is to make a computer be ...
5
votes
3answers
722 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 ...
2
votes
1answer
81 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 ...
1
vote
1answer
137 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 ...
2
votes
1answer
752 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
113 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 ...
18
votes
5answers
25k views

The difference between “concurrent” and “parallel” execution?

What is the difference between the terms concurrent and parallel execution? I've never quite been able to grasp the distinction. The tag defines concurrency as a manner of running two processes ...
1
vote
3answers
1k 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
296 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 ...
9
votes
1answer
426 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
459 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
347 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 ...
16
votes
5answers
6k views

What are the best resources for learning about concurrency and multi-threaded applications? [closed]

I realised I have a massive knowledge gap when it comes to multi-threaded applications and concurrent programming. I've covered some basics in the past, but most of it seems to be gone from my mind, ...
25
votes
3answers
3k 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
2answers
230 views

How do I find a good middle way to make this library safe for concurrent operations

I've made a little library called SignalR.EventAggregatorProxy Before I push it into 1.0 state I need to fix so it works safely with concurrent operations. Easiest way is lock all operations but ...
1
vote
1answer
109 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 ...
-1
votes
1answer
77 views

What's the best way to implement a real time show board to show results from concurrent result producers in Java?

I'm making a load test tool that launches multiple thread to simulate load on the target server. Each thread executes a predefined set of commands in the structure of TestSuite - TestCase- TestStep ...
1
vote
1answer
208 views

Experiences with C++ Async/actor model Library [closed]

I am fairly experienced with async and concurrent programming in c# using event, actor, and task based patterns, but now I have a task in c++ with which I have basic familiarity and it needs some ...
5
votes
2answers
1k views

Where is the evidence for the performance of Node.js?

A lot of developers, especially ones who haven't used Node.js in production, seem to believe that Node.js is faster than other interpreted languages such as PHP, Python, and Ruby. These claims ...
1
vote
2answers
103 views

When, if ever, are basic concurrency optimizations generally made?

Lets say I need to preform the following computationally intensive task For i in range(100000000): doComplexCalculationWithNoSideEffects(i) Most people I talk to tell me that basically any ...
18
votes
3answers
17k views

UML Diagrams of Multi-Threaded Applications

For single-threaded applications I like to use class diagrams to get an overview of the architecture of that application. This type of diagram, however, hasn’t been very helpful when trying to ...
1
vote
1answer
61 views

How to model parallel processes (in a Bounded Context) with the same data store?

The situation. Let's say a background process puts stuff into data containers. It runs all the time, observes system events, and populates the data accordingly. The user may launch a control panel ...
3
votes
1answer
343 views

Does Clojure borrow concurrency ideas from Haskell?

In code quarterly interview with Rich Hickey, Michael Fogus hints that Clojure borrows a lot from Haskell: Fogus: As someone who only knows Haskell enough to read the papers, Clojure appears to ...
0
votes
2answers
321 views

Scaling locks in high concurrency web apps [closed]

Our web application has a certain resource type that is shared accross multiple users, and may thus be read and written by anyone at anytime. We resorted to the usual suspects, database transactions ...
25
votes
1answer
7k views

Are go-langs goroutine pools just green threads?

The commentator here offers the following criticism of green threads: I was initially sold on the N:M model as a means of having event driven programming without the callback hell. You can write ...
1
vote
3answers
503 views

Is there an algorithm to determine the amount of work needed to keep workers busy?

I wrote a multi-threaded program that randomly generates strings, and after generating, checks to see if the string contains a certain value. Namely, StringGenerator and StringChecker. What I'm trying ...