In computer science, concurrency is a property of systems in which multiple computations can be performed in overlapping time periods. The computations may be executing on multiple cores in the same chip, preemptively time-shared threads on the same processor, or executed on physically separated ...

learn more… | top users | synonyms

3
votes
0answers
76 views

Thousands of GET requests for brute-force authentication attempts

I am applying a brute force to discover 123456 passwords in a given site (I am not going to say which one, of course). The html gets a ...
3
votes
1answer
40 views

Call third parties in parallel

I am trying to speed up some reporting on all employees but I am having difficulty determining where the "proper" place to parallelize my tasks. In order, this is what my code is currently doing. Ask ...
3
votes
1answer
90 views

Thread-Safe Task Queue Implementation

Purpose: This class exists to ensure actions created from other threads are executed in a synchronous manner. Additionally, it provides functionality to add actions that run after a delay. Code: (...
8
votes
2answers
238 views

C++11 Blocking connection pool with auto release

Relatively new to C++. Please help me understand the potential issues with the following blocking object pool. ...
5
votes
0answers
33 views

Link checker using Go channels

I've started to learn Golang and channels in it. I decided to write simple application - recursive link checker. Given some URL it tries to retrieve pages, parses them and goes deeper. Here's a code ...
6
votes
3answers
119 views

Concurrently reading a Map while a single background thread regularly modifies it

I have a class in which I am populating a map liveSocketsByDatacenter from a single background thread every 30 seconds inside ...
1
vote
0answers
59 views

Producer / consumer pattern with limits on .NET

For a project that I'm developing, I need to implement the producer/consumer pattern, but the quantity of consumers cannot be higher than some number (say 40). I created a concept project on GitHub ...
1
vote
1answer
48 views

canonical pattern for transactional library state manipulation

In golang I am finding that there is a definite pressure in the language itself and built-in libraries to do things in a canonical way. Please can someone critically look at these two ways I am ...
3
votes
0answers
23 views

Fast lock implementation using pipes only

For fun I wanted to create a lock implementation that was about as fast as one using futexes but that used used pipes instead and that queues waiters in user space instead of in-kernel. For the queue ...
1
vote
2answers
44 views

Simplified LogService (from concurrency in practice) with shutdown feature

Brian Goetz provided following code of LogService with shutdown feature: ...
2
votes
1answer
76 views

Repeat operation if signal is received

I have a data synchronisation operation that is observing a database. This is a fairly key piece of code for the system, so I want to make sure I handle the concurrency correctly. The problem The ...
4
votes
1answer
88 views

Concurrency and locking in a chat server

I've never done concurrent programming before, but I've written one using go channels and RWMutex, but I'm not sure if my approach is idiomatic. I feel like it could all use channels (Maybe). The ...
3
votes
1answer
56 views

JUnit assertion for concurrency test

I'm learning Java concurrency by a TDD approach. Therefore I wrote a basic test case in JUnit to test the behaviour / expected results of 2 threads. I'm looking for feedback for this code. In ...
0
votes
1answer
38 views

Turn a Non-blocking Concurrent Queue into a Blocking Concurrent Queue

Microsoft Visual Studio offers a non-blocking concurrent queue class, concurrency::concurrent_queue, based on Intel's TBB. I am using this as a base for a blocking ...
0
votes
1answer
31 views

Concurrent Stack with blocking and non-blocking methods

I wrote it this just for learning. Is there holes at this code? ...
1
vote
1answer
55 views

Concurrent blocking stack

I just want to train before interview. I googled concurrency interview questions and one of the question was write concurrent ready stack. ...
2
votes
2answers
150 views

Running multiple producer and single consumer in a multithread environment

I have a below class in which add method will be called by multiple threads to populate messageByChannelReference concurrent ...
3
votes
1answer
87 views

Parallel brute-force solution for Project Euler 4 (Largest palindrome product)

The pe4Concurrent.go file given below is my first attempt at writing a concurrent programme, pe4.go is a non-concurrent implementation of the same algorithm for comparison purposes. The algorithm ...
3
votes
0answers
44 views

Creating an observable stream of clicks and converting it to an iterator

Problem 1 StratifiedJS allows people to cleanly create observable streams using the Stream class from sjs:sequence: ...
0
votes
1answer
33 views

Caching wrapper for digest computation

I need to review this code: ...
2
votes
1answer
59 views

Receiving messages from TCP socket and processing them

I would like someone to look at my class for reading messages from a network socket. In short, the whole app should behave like a regular ping command with some additional functionalities. The point ...
2
votes
0answers
28 views

Concurrent ObjectPool using ConcurrentLinkedQueue

Main ObjectPool Class: It uses atomic operations and a concurrent linked queue to achieve the best performance compared to Apache commons pool. I want to make sure there are no concurrency issues even ...
0
votes
0answers
35 views

Queue that permits at most X simultaneous operations

I ran into this once (permits=N) and then again today (permits =1) where I only want 1 to N operations running simultaneously. One example comes from firing into a state machine (the permit=1 example)...
4
votes
0answers
46 views

Concurrent Queue using Ada SPARK with the Ravenscar profile

See here: https://gitlab.com/linted/linted/blob/162b5e9fba53a90b3c6d78e214776e069c3c722b/src/ada-core/src/linted-queues.adb The code implements a concurrent queue. It can't allocate memory or use ...
6
votes
1answer
95 views

RabbitMQ wrapper to work in a concurrent environment

I'm developing a common library for my organisation that will be used across different services by different teams. The library is a simple wrapper for RabbitMQ. Some services will only be producers, ...
2
votes
0answers
60 views

RCU in C++11 using std::shared_ptr and a little more

Here's some code I wrote to solve a problem at the server I'm working on. Is this valid? I've tested it, and it works, but I would like some opinions on this. It's basically a ...
6
votes
1answer
72 views

Consumer/Producer (Concurrency) - Exception Handling

I have a circular buffer (array/first in first out), a consumer and a producer. A producer puts random numbers into the array, and a consumer takes the first number and checks if it is relative prime. ...
3
votes
1answer
63 views

Time out or get a result when available

I have a system that can put and get messages from a messaging middleware (JMS), which is asynchronous. I need to provide an API that allows synchronous call, as in, when the API/method is called, it ...
3
votes
2answers
77 views

Enforce execution order with collections of CompleteableFuture's

I receive a message that contains a collection of items that need to be processed. Processing each item involves sequential calls to various services. The services return a ...
4
votes
2answers
210 views

Recurrent action on concurrent collection

I have a bunch of concurrent threads carrying out operations which return alerts. The alerts have to be persisted to a DB, but this cannot be done concurrently as it may cause duplicate alerts being ...
3
votes
2answers
212 views

C++ concurrent queue and testing

I've written concurrent queue based on std::queue. ...
3
votes
2answers
75 views

Filter request code handler

I use the following code which works OK, the code is filtering requests and in case there are too many requests it sends some logs/errors since I'm very new to Java my question if there is a better ...
3
votes
1answer
57 views

Executing an SQL command on a number of files

Is this thread safe? I have a program that executes an SQL command on a number of files (selected by the user). Here is where I create the threads: ...
2
votes
1answer
118 views

Ensuring no race conditions in my concurrent/parallel ForEachAsync method

Hopefully the final chapter of my ForEachAsync code review. The original question was the starting point and the second question contained modifications suggested ...
4
votes
1answer
95 views

Semaphore based concurrent work queue

There's a need to have a mechanism in place that will process messages received from the network concurrently. However, only X number of messages can be allowed to be processed concurrently and there'...
7
votes
1answer
130 views

Constant keys thread safe dictionary

I find that I use this pattern a lot where I have a dictionary which I would only read from and update and wouldn't add/remove keys. In that case, using ...
2
votes
1answer
131 views

Concurrent/parallel ForEachAsync - proper handling of exceptions and cancellations

I've created an asynchronous parallel ForEach mechanism so I could enumerate an enumerable by N degrees of concurrency and process an action for each item. ...
2
votes
1answer
99 views

Internship coding challenge post-mortem

I wrote this in 78 minutes as part of an application to an internship program. We were allowed to use whatever language we wanted, so I picked Rust because that's what I use the most. I'm a ...
2
votes
1answer
101 views

Creating a concurrent/parallel ForEachAsync that can fail immediately or wait until enumeration is complete

I needed an asynchronous parallel ForEach mechanism so I could enumerate an enumerable by N degrees of concurrency and process an action for each item. Searching ...
1
vote
2answers
107 views

One producer and multiple consumers wherein the producer has to wait until all consumers finish before adding more data

I am trying to solve the scenario involving 1 producer and 5 consumers. The producer puts data to queue and waits till all consumers have finished before adding more data. Please review and let me ...
5
votes
1answer
49 views

Concurrent task pool

My use case is to dispatch multiple long-running tasks to execute concurrently. The expectation is that the tasks will be IO-bound (e.g. network requests), but importantly each task is different. This ...
1
vote
0answers
47 views

Combination of Java's Future and Android's AsyncTask

My goal is create a class which implements Future interface of Java (get, cancel, isDone...), yet provides callback like ...
1
vote
1answer
53 views

Synchronize different tasks (I/O listening daemon, prompt scheduler, output etc)

Shortly, I need to create a Java application with client/server architecture (clients represent some sort of math functions and when they are done computing, server consumes these values and produces ...
5
votes
2answers
92 views

URLEncoder implementation

I'm looking for feedback on my URLEncoder implementation, which is a drop-in replacement for Apache Tomcat's URLEncoder. It was ...
1
vote
0answers
30 views

Adding to a message queue if more important messages come in

We need to send messages with highest priority first so we use a PriorityQueue for our purpose. ...
1
vote
2answers
58 views

Threadsafe filtering queue

I have implemented a thread safe filtering queue. The queue allows any objects, of the specified type to be added. A thread interested to take an object must specify which object it is interested in ...
1
vote
2answers
285 views

C++ thread safe queue implementation

I'm using this class for producer-consumer setup in C++: ...
1
vote
0answers
38 views

Simple Agent in F#

I wrote a simple agent system based on the agent type from Akka. It allows you to encapsulate a mutable state in a thread safe manner for use cases where mutation would be most convenient (like for ...
0
votes
1answer
129 views

Simple parallel_for_each in C++

I need to parallelise a for loop that does quite a lot of processing over thousands of items. I came up with this basic loop that seems to work quite effectively on ...
1
vote
0answers
41 views

Wikipath stack in Java - Part I/IV - The search algorithm

I am working on the following small software stack: The objective of the entire stack is to search for shortest paths in the Wikipedia article graph as fast as possible. As of now, I rely on two ...