Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [concurrency]

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
votes
0answers
25 views

Count the number of occurrences of each symbol in a string array

This calculates the number of occurrences of each symbol in a string array. I want to find some places in this multithreading code which could lead to a NullPointerException or other exceptions or ...
3
votes
0answers
40 views

Linked list with hand-over-hand locking

Follow-up to this question: after reading the comments, I decided to redesign my linked list to have a cursor that only contains one node and implement the interface similar to the one of forward_list ...
5
votes
1answer
90 views

Specialized ConcurrentLinkedList

I need a concurrent data structure with the following properties: Low overhead for enumeration Insert only at end. Removal from any point. Enumeration should be safe with concurrent writing ...
0
votes
0answers
11 views

Running a JavaFX 11 interface update at regular intervals (in Kotlin)

I want to update a field on a JavaFX 11 UI in response to a thread which retries a process every second and updates statusString with the result. Since the ...
0
votes
0answers
55 views

Using nested multiprocessing pools in python

I'm processing image files, which are represented as 2d numpy arrays in python, and I need to iterate over the row of each array to apply a function. This is a ...
3
votes
0answers
51 views

Override prototype inside of constructor of ES6 class for dependency injection

We implemented a small dependency injection mechanism which we use in our project. Now after 2 years of developing our project we need our classes to know who instantiated them via dependency ...
0
votes
0answers
32 views

Using ReadWriteLock to implement a cache access guard

In my project, there is an internal cache api to use. I have noticed an emerging pattern such that: ...
1
vote
1answer
52 views

Rust Task Queue

The purpose of this program is to have one thread (main thread) working on I/O reading lines from a file and feeding it to a pool of worker threads whose job is to perform some processing on each line ...
2
votes
0answers
34 views

Comparing performance of multi- and single - thread search of a maximum number

I have a class that compares the performance of two methods (multi- and single- thread) that searches for maximum number in the string of numbers. I want to improve the performance of a multithreaded ...
1
vote
0answers
38 views

Max number of concurrent tasks in asp.net [closed]

Background I have a highly available asp.net (4.5.2) web api receiving very high load. The app primarily reads from a Redis cluster, processes/formats the data & returns in json or protobuf. Due ...
1
vote
0answers
118 views

Thread-safe Java class for managing XML files <> domain models

This Java class (aka application component) role is to handle a series of XML files stored in the file system. It must convert those XML files to the corresponding application domain model, and it ...
7
votes
4answers
638 views

Caching Color-Bitmaps as MemoryStreams

I am in the need to cache Bitmap's in a memory-optimized way because the API I am building will need to process many colored ...
1
vote
1answer
105 views

Concurrent usage of resources

Please take a look at the following code. This is my attempt at understanding concurrent applications. ...
1
vote
1answer
69 views

Run two computations in parallel, and return the results together

I am reading the "Learning Concurrent Programming in Scala" and there are exercises in the end of each chapter. One of exercises is Implement a parallel method which takes two computation blocks a ...
2
votes
1answer
34 views

ProcessPoolExecutor KMZ file search

I've written a script to look for coordinates in KMZ files. I've tried to speed execution up using the ProcessPoolExecutor. I'm quite new to Python, so any recommendations are more than welcome. <...
0
votes
1answer
37 views

Reading a user credentials from file concurrently [closed]

I came across the following code snippet: ...
4
votes
0answers
128 views

Custom TaskScheduler: Limited concurrency level

I'm interested in some feedback for a custom TaskScheduler implementation I wrote today for use on a game server - I wanted to be able to have a single-threaded scheduler for tasks since the game is ...
3
votes
1answer
145 views

ForEachAsync extension method (a way to run an async operation on each item of a sequence in parallel)

In a recent project I worked on we faced some issues due to an excess of parallelization (thousands of threads were created and the overall result was a degradation of performance and several spikes ...
3
votes
1answer
85 views

FutureTaskWrapper for Java

I did not like that get synchronizes every time I call it - because I may be calling it more than once. So I wrote the wrapper for the future interface which keeps ...
0
votes
1answer
60 views

Reading lines from a file and processing them concurrently

I'd like to read lines from a file and process them concurrently. I came up with the following code to do this: ...
0
votes
0answers
16 views

Processing object writes to external datastore in parallel using ForkJoinPool and list streams

I have the following code. I wanted to see if you thought this was a good way to go about processing an array of objects in parallel using a ForkJoinPool and array streams. This is just a sample, in ...
1
vote
0answers
62 views

Concurrent hash map implementation with Go's channels

I've implemented a concurrent hash map in Go. I'm fairly new to this language as I have mostly Python background so I'm looking for suggestions how to improve my code. I've ran the tests with ...
4
votes
2answers
69 views

Semaphore skipping additional threads

In this example I've a refresh method that might be called by multiple threads. Requirements are: refresh() method must be processed by only one thread at a time (...
3
votes
1answer
51 views

Java Concurrent Recursive API Access

I don't get to write multithreaded applications very often, so be gentle with my threads :-) I have an API input which contains a "score" and then a bunch of child nodes which also have scores, and ...
0
votes
0answers
28 views

Thread safe tile grid abstraction and implementation

I'm working on a tile engine and I'm trying to write a nice abstraction for writing Tiles and TileImages (which are just a group ...
4
votes
0answers
42 views

Drawing the Mandelbrot with multiple threads in rust

The code below draws the mandelbrot set for { z | z∈ ℂ, -2.2 ≤ Re(z) ≤ 0.6, -1.4 ≤ Im(z) ≤ 1.4} into a 300×300px png image. For each pixel, if the sequence {zi} is found to ...
3
votes
1answer
71 views

HTTP Load test with Golang

I am a golang novice... I am trying to write an application that takes in many requests - up to a sustained 10000 HTTP posts/sec and post the payload to two back-ends in parallel (5 second timeout). ...
1
vote
0answers
15 views

JSON API Scraper v2: Limited concurrency AJAX from a shared queue (ES2017)

Essentially the AJAX component of this question, reimplemented in ES2017 style async/await. The code connects to a remote JSON API and scrapes it using a limited number of streams to avoid triggering ...
2
votes
1answer
57 views

Concurrent access to data with QReadWriteLock

Using Qt, I've got this code in order to protect access to some shared data between threads. I'm pretty sure the idea is correct, but I don't know if RVO and/or RAII could potentially screw the ...
1
vote
1answer
154 views

Concurrent fire and forget async task queue

I had to do a lot of IO stuff on my server running Node JS where I did not really care about the result of the operations. The list of incoming tasks could be huge, so I had to limit the number of ...
0
votes
0answers
112 views

Concurrent booking system

I am trying to see how to create a booking system. Basically, I want to use "available" synchronizer utilities from util.concurrent and avoid using wait/notify/...
4
votes
0answers
142 views

An in-memory copy of the GDAX order book for an arbitrary cryptocurrency, updated in real time

GDAX is the cryptocurrency exchange owned and operated by Coinbase. This code is intended to be the basis for an order-book-strategy trading bot. I'd love feedback on my use of data structures, my ...
1
vote
1answer
82 views

Go task scheduler

This is the same problem as the Python task scheduler, but in Go. I chose not to use a sync.Cond (I couldn't seem to get that right), but instead use channels. <...
3
votes
1answer
84 views

Issue tokens concurrently with synchronization per client

I have an API application with token authorization. A token is valid for one hour. Each business client has its own instance of the API application: ...
1
vote
0answers
49 views

Asynchronous Message Passing

I'm implementing a method which has the purpose of waiting for a message (boolean value). Works, but can it be improved? Code: ...
1
vote
0answers
35 views

Implementation of an ObjectPool

we are trying to implement an object pool. The objects contained are reusable but not thread safe, and creation costs a lot so we went with this idea. We expect that the user of this object will need ...
0
votes
0answers
218 views

Concurrency-safe cache in Go

I'm writing a concurrency-safe memo: ...
3
votes
0answers
58 views

ConcurrentLinkedQueue Object Pool implementation

I have implemented this simple unbounded ObjectPool based on a ConcurrentLinkedQueue of WeakReferences. I have a thread-unsafe object that is pretty expensive to create, and most of the time it will ...
0
votes
0answers
66 views

Synchronous non-blocking executor with overflow

To implement a thread-safe state machine that handles transitions synchronously but avoids prolonged locking, I've implemented a following helper class: ...
10
votes
1answer
96 views

Simple concurrency implemented in Python

Purpose of the question: learn more about ways to implement concurrency in Python / experimenting. Context: I want to count all of the words in all of the files that match a particular pattern. The ...
3
votes
1answer
58 views

Concurrent Data Manager with minimal synchronization

So I have my own library to organize advanced critical sections at GitHub. It's based on the ResourceDataStorage class which is responsible for creating, storing and clearing resource records. I've ...
3
votes
1answer
68 views

ReadWriteSerializer

I am developing a C++ kernel, and I've got the need for manipulating huge data structures before the task-scheduler runs - it means in a non-preemptive environment. For this, I have developed a read-...
2
votes
2answers
200 views

Concurrent hero vs monster program

I have made a simple concurrent program. It represents a battle between a hero and a monster. I am beginner in concurrency so I just want to hear your opinion. What are bad and good sides of my code ...
1
vote
1answer
71 views

Use of concurrency to generate combinations

I have the following package to generate combinations from a slice of bytes: ...
1
vote
0answers
394 views

Semaphore of size 1 [closed]

I was wondering how to implement a simple semaphore of size 1 in javascript. I came up with this and tested it a bit, and wanted to make sure it covers all cases. ...
3
votes
1answer
161 views

Worker, Pool and Jobs

I created a snippet of code that allows me to create a worker pool, and from that worker pool I can run a bunch of jobs. I can configure each job to have a retry limit, and set a callback that will ...
2
votes
0answers
58 views

Pub/Sub Broker Subscriber Interface

I'm working to build out a Subscriber interface for handling at-least-once messaging semantics, so I can produce different brokers. Here's my interface thus far: <...
3
votes
0answers
248 views

Tool to calculate the average time that takes for a GitHub pull request to get merged

I'm learning go, and this is my first attempt at a command line tool that uses the GitHub API to calculate the average time that takes for a pull request to get merged for a particular organisation or ...
1
vote
0answers
35 views

Race condition of initialization with fail safe

I have the following usecase, I have a multi threaded environment and I want to initialize some parameters only only. The thing is that when I initialize the parameters I call a function that ...
8
votes
1answer
93 views

A Game of Life application, with mouse clicks

I have a Game of Life program that has a grid[][] array which is populated by Cell objects. If there's a cell in a grid square, ...