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 ...
1
vote
0answers
15 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
31 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
40 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
62 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
42 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
64 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
58 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
62 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
202 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
1answer
148 views
3
votes
2answers
73 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
54 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
85 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
63 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
119 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
87 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
94 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
80 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
98 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
46 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
34 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
52 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
84 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
29 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
57 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
148 views
1
vote
0answers
35 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
90 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
40 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 ...
6
votes
5answers
926 views
A buffer that holds and provides the latest n items
I have developed the following code to hold n latest items it has received, and when asked for provide these n latest items.
The interface is:
...
3
votes
1answer
65 views
Receptive map queue
I've written a class I call ReceptiveMapQueue. Its purpose is to organize the internal structure of an AFKable RPG. It only has two public methods - dumping entries ...
0
votes
0answers
156 views
Ruby thread pool implementation
I'm in the process of adapting the simple thread pool described here to my application. I'm new to concurrency in Ruby, but here is what I have so far:
...
4
votes
2answers
115 views
Concurrent for loop in C++ - follow-up
I have incorporated all the cool points made by ChrisWue in the initial iteration of this post.
Now, I am not reinventing the wheel for my concurrent queue, but use internally ...
5
votes
2answers
81 views
Java controller to farm out concurrent tasks
I've recently given a coding interview on a Java concurrency task and unfortunately didn't get the job. The worst part is I've given my best but now I'm not even sure where went wrong. Can anyone ...
5
votes
1answer
216 views
Concurrent for loop in C++
(See the next iteration.)
I have this easy to use facility that maps input elements to output elements concurrently by the means of a thread pool:
concurrent.h:
...
5
votes
4answers
236 views
Implemenation for concurrent file access (read/write)
I am developing an application that works with files and folder on a network share (similar to the windows explorer). The application is used by multiple users and provides some commands for modifying ...
1
vote
1answer
83 views
Multithreaded Producer-Consumer pattern
I have Producer Threads A, B and C producing 3 different types of events Events A, B and C respectively. The Consumer thread can ...
2
votes
1answer
55 views
Managing PostgreSQL transactions for concurrency
I have a situation where I need to use PostgreSQL's serializable isolation level for transactions. This is for a table shared among multiple concurrent PHP processes. If the database runs into any ...
9
votes
2answers
223 views
Naive parallel Sieve of Eratosthenes in Java
My naive version now is too slow. I think setting/accessing concurrent atomic bit is way slower compared to access/modify an array of boolean. Second, the parallel execution only happens on the ...
0
votes
0answers
473 views
Golang: reading and writing files in parallel
I am trying to read a big file line by line, inspect and cleanse each row and write to either of two output files depending on the outcome. I am using channels for this. I am still quite new to this ...
3
votes
1answer
119 views
Concurrent non-blocking update of cached list of on-line users
I have following problem: My server (ASP.MVC WebAPI) is tracking, when client application ("Agent") is on-line. It's storing this inf on following table:
...
-2
votes
1answer
32 views
Capture some state in Haskell
I want to capture some state in a Haskell function. For instance, I have many thread trying to print on the console and I want the to play nice with each other. So I want to have some XX to make the ...
2
votes
3answers
442 views
C++11 Blocking Queue learning exercise
As part of my own C++11 learning exercise I have implemented this Blocking Queue using the new C++11 thread API. One of the aspects I would like to improve is efficiency i.e. in the ...
1
vote
0answers
41 views
Methods to add and check elements in a Bloom Filter
I have a working Java implementation of Bloom Filter.
These are the methods to addElement and check for an element.
...
4
votes
0answers
168 views
Pseudo-parallel depth-first search
I'm writing a small program, that generates a file containing an adjancency matrix, it then reads from that file, constructs a graph and does something like a parallel dfs on it.
How can I make the ...
2
votes
1answer
2k views
Reader-writers problem using semaphores in Java
I have written my own solution to the Reader-Writers problems using semaphores based on the psuedocode from Wikipedia. I would like to gauge the correctness and quality of the code.
...
3
votes
0answers
190 views
Concurrent resizable ring buffer
I'm trying to find the fastest way to enqueue and dequeue items concurrently in Go.
There are some restrictions:
it needs to be unbounded
Memory allocation should be low
Multiple producers
(Single ...
1
vote
1answer
351 views
Reading and processing a big CSV file
I am trying to write a script to read a CSV file containing 1 million domain names, look up these domain names and store the results in another CSV file. I am trying the following code, but the number ...
3
votes
0answers
174 views
Golang Tour Web Crawler Exercise
In the last few days I've played around with Go a little and took the language tour. The last exercise (text here) requires you to crawl a graph that simulates a set of Web pages with links, using ...
4
votes
1answer
59 views
Multiple Persons enter room simultaneously and exits after specific interval of time
Here is the link to git repo of my application I am currently implementing just to have better understanding of OOP as well as learning Concurrency (Atleast a try :D)
What is the whole ...