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 processors.

0
votes
0answers
6 views

Dynamic “compilation” of SQL stored procedures

I have a stored procedure which is called to create ( "compile" ) temporary stored procedures, code below, based on whether a flag in a database record is set - the various sub-procedures such as ...
4
votes
1answer
47 views

Upload a directory, in parallel, to an artifact repository

This code uploads an entire directory and allows for its reparenting on a remote server (an artifact repository). Three concerns: Copying the files locally takes a lot of space. Ideally, I could use ...
1
vote
2answers
45 views

Golang execute several go routine in loop and then wait

I'm new in Go and excited with its easy-to-use concurrency implementation. However I'm not sure if I'm doing it right in Golang way. Consider the code where I spawn ...
2
votes
1answer
35 views

Batch downloading to file or memory

This is likely my first useful piece of Rust code. Planning to crate-ify it. It works. ...
5
votes
2answers
96 views

Using two threads to increase RFC1951 Deflate compression performance

I have modified my implementation of RFC 1951 "Deflate" compression to use two threads. One thread performs the LZ77 matching, looking for sequences of at least three bytes that occur earlier in the ...
0
votes
0answers
17 views

Go wrapper around io.Writer that tracks the number of bytes written

The code below implements ProgressWriter, a wrapper around io.Writer that can track the number of bytes written, and a function <...
5
votes
2answers
68 views

Automatic RAII wrapper for concurrent access

Probably many people had to work with multithreaded applications with C++ and can understand how messy can be fine-grained locking of objects. So once in a while I came to idea of implementing some ...
1
vote
0answers
59 views

Critical section around given key

I would like to know if there is any pre-existing implementation of my solution so I don't have to reinvent the wheel. What I'm trying to create is an utility which allows me to create critical ...
0
votes
0answers
43 views

JNI: porting a semaphore data type to Windows

I have this JNI code to review. The demo driver + irrelevant porting code is here. semaphore_impl.h: ...
2
votes
1answer
48 views

Reading shards from a Kinesis stream

Here is part of my implementation of reading a Kinesis stream. I am not confident that this is the best way to implement synchronizing returns from goroutine. Assuming there are N shards in the ...
3
votes
2answers
71 views

Go grep command clone

I am trying to make a simple clone of the command line utility grep. I'm working on it just for fun and to practice Go. The thing is, I am trying to make it in a way that if several files are given at ...
4
votes
1answer
166 views

Concurrent observable collection

I'm working on a WPF 4.5 desktop application that has several nested collections with the following key aspects: writes mainly from UI thread, but also from worker threads writes are relatively ...
1
vote
0answers
111 views

Golang gRPC context to check if cancelled or if deadline is exceeded while running function code

I am writing a gRPC Golang application and am looking for the best way to check if the deadline is exceeded or if the client cancelled the call. On the server side I created a channel called ...
3
votes
0answers
52 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
100 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
19 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 ...
3
votes
0answers
55 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
34 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
96 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
40 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
129 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
654 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
108 views

Concurrent usage of resources

Please take a look at the following code. This is my attempt at understanding concurrent applications. ...
1
vote
1answer
94 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
36 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
214 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 ...
4
votes
2answers
361 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
64 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
20 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
96 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
76 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
60 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
29 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
43 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
78 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
17 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
71 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
212 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
131 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
164 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
85 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
89 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
51 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
236 views

Concurrency-safe cache in Go

I'm writing a concurrency-safe memo: ...
3
votes
0answers
68 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
86 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: ...