23,115
questions
-1
votes
0
answers
42
views
A concurrency issue in getting correct exception
I'm currently working on a rule validation function in Java. To process these rules, I'm running multiple validation tasks concurrently using a fixed thread pool ExecutorService.
Here is the related ...
-1
votes
0
answers
13
views
Is it node js express or nestJs fastify better to use concurrency, scalling, performance, large data fetching and saving side? [closed]
give me advantages and disadvantages with the result previously used POC's mainly i'm facing issue concurrency and scalabitity issue with large number of data. so i need to select proper framework to ...
0
votes
2
answers
102
views
What is the meaning of this 'for' loop in the lock free queue implementation in the book "C++ Concurrency in Action"?
I am reading Anthony Williams's "C++ Concurrency in Action, Second Edition", and I encountered this code:
template<typename T>
class lock_free_queue
{
private:
void set_new_tail(...
0
votes
0
answers
4
views
Reading from a queue in sounddevice with a long lag
I writing a script for real-time speech translation. Sound from a microphone is put in a python queue, with another process getting sound chunks from the queue, transforming speech into text and ...
7
votes
2
answers
118
views
Is FrozenDictionary<TKey,TValue> thread safe in .NET 8?
I have a very simple question:
is it safe to read concurrently from an instance of FrozenDictionary<TKey,TValue> from different threads ?
I assume this type being thread safe, since it is ...
0
votes
0
answers
11
views
Task exception was never retrieved future: <Task finished name='Task-7' coro=<testu() done
I am using fast api and I above is a test setup I did in which on the route test, I want to create a background task using asyncio and it would make a POST request to my another javascript server ...
0
votes
0
answers
22
views
Issue with multiprocessing and Pulse Width Modulation on Raspberry Pi
It seems to me that I have problems running pwm in multiprocessing, and I wonder if you have any ideas on how to resolve this.
I have a project where I'm building a toy car being controlled by a ...
-1
votes
0
answers
56
views
How do I asynchronously perform as task when elements exist in two queues?
I've got this working example below where there are tasks being fed to a simulation class. Once a task is seen, a worker is dispatched to perform the task. Tasks take time to setup (prep_time) and ...
1
vote
1
answer
125
views
Read, Increment and Update Transaction in SQL Server
To implement special Id, we need to append current date with an identity counter which resets per day. As an example, the Id must be something like 20240825-0001 for the first record of August 25th ...
-3
votes
0
answers
41
views
RegistryKeys Access Crash Parallel and Async WinForms C# [closed]
I have a UserPanel that has a ListBox in it that gets loaded with the uninstall keys from LocalMachine to get the users installed .exe files. I also have a refresh button that re-does the same method ...
-1
votes
2
answers
43
views
How to share data between concurrently executed promises in NodeJS
I want to share data between the two concurrent method calls shown below.
async generateSuggestedSparks(userId: GraphID, friends: Person[], latLng: LatLng) {
let suggestions = await this....
0
votes
0
answers
23
views
Azure App Service caching of config settings or secrets [closed]
Within an ASP.NET Core Web API or App Service that processes high number of concurrent requests, what is the best pattern for caching commonly utilized config settings that possibly could be updated, ...
1
vote
1
answer
34
views
Running a python child process concurrently doesn't seem to be concurrent
I've been tasked to update an existing python program that currently runs as a single process, to run a child process concurrently. I'm new to python concurrency techniques and wrote a simple script ...
0
votes
1
answer
41
views
Lambda Service Quota increase cannot be increased above 10, how do I increase the lambda concurrency quota?
AWS Lambda quota value is listed as 10, and through the Request Quota Increase form via Service Quotas page in AWS Console I am given an error response claiming I must choose a value larger than 1000. ...
0
votes
0
answers
34
views
HTTP connection is closing before S3AsyncClient getObject request can complete
I have a Spring Boot application that reads content from an S3 bucket. In my case, I'm trying to perform an MD5 checksum validation on a large file stored in the S3. However, when I try to get the ...
0
votes
1
answer
81
views
Why isn't my async method called immediately in C#
Caller:
var snapshotMessages = snapshotRepository.GetMessages();
_ = Console.Error.WriteLineAsync("Loading XML timetables...");
// some lengthy operation which loads a large dataset from a ...
0
votes
1
answer
76
views
Perform time consuming disposal asynchronously
Imagine having a class that does some stuff and displays the results in modal window.
The class has a costly dispose, i.e. it has to free resources which may take some seconds.
The problem: When I ...
0
votes
1
answer
61
views
Executing DAG pipeline with ansible
I have 3 ansible tasks (A, B, C). I want task A and B to be run concurrently and C to be executed as soon as A and B are finished (C uses data from A's and B's stdout). So, if each task takes 30 ...
2
votes
2
answers
64
views
"Lock Pools" or other solutions for handling memory intensive operations in a .NET Framework backend?
My backend application takes byte arrays that represent image data and applies certain transformations to it, like changing the resolution and such, and then stores this modified data to disk.
During ...
0
votes
0
answers
61
views
Is there a way to avoid the 'static lifetime requirement in this implementation?
I'm trying to better understand concurrency in Rust. I got the followin assignment:
A Looper is a paradigm frequently used in reactive. When created, a Looper creates a queue of generic Message ...
0
votes
1
answer
31
views
Running an async task in the background after others finished
I have X asynchronous tasks that are executed using asyncio.gather(), and they are created in a loop. Once these tasks are finished, I need to run a single asynchronous task to perform some actions. ...
1
vote
0
answers
35
views
How to execute thousands of requests using both Concurrency and Parallelism using playwright with python?
I am currently on a crossroad whether to use AsyncIo or AsyncIO and multiprocessing. I stumbled upon an external python package called aiomultiprocesswhich simplifies the use of both AsyncIO and ...
0
votes
0
answers
53
views
How to prevent duplicate inserts without Serializable transaction?
I have an API, where an insert to tableA happens after validating the result of a select query on some other tables. So tableA can have no unique keys other than the auto-generated ID.
Therefore ...
0
votes
1
answer
57
views
Is an 8 byte memcpy() atomic on a 64bit linux machine?
I'm using an 8 byte shared memory segment in PHP, using shmop_* functions. By looking at PHP's source code, I see that internally shmop_write() and shmop_read() use memcpy() to fill/read those 8 bytes....
0
votes
1
answer
70
views
Concurrency - Inserting to a map only if record has a certain status
I have the below code snippet that I want to change. Currently, it reads from a list and creates a map keyed on transactionId and it overrides the element stored in the map irrespective of the status ...
-1
votes
0
answers
68
views
Facing race condition due to Futures running on threads are interleaving and hence getting data inconsistency in output with Scala Future
object DistributedSequenceGeneratorService {
@volatile private var instance:
Option[DistributedSequenceGeneratorService] = None
def getInstance(db: Database)(ec: ExecutionContext):
...
-1
votes
0
answers
26
views
Custom implementation of ThreadFactory to mirror ForkJoinPool.ForkJoinWorkerThreadFactory
Background Context
Hi everyone
I am implementing an Executor in a Spring Boot REST web app to execute all @Async methods.
I am implementing a custom ThreadFactory because of this HazelcastException ...
0
votes
0
answers
43
views
Azure Service Bus with a dedicated entity framework dbcontext for each handler in concurrent call [closed]
I have azure service bus (I use Azure.Messaging.ServiceBus) with configured MaxConcurrentCalls in receiver (let's say to 10). I want to make thread safe access to EF dbcontext in the callback and I ...
2
votes
0
answers
71
views
Java ThreadPoolExecutor: How can it ensure the state check in execute() method is safe?
Basic:
// this.a is a shared variable.
AtomicInteger a = this.a;
int x = a.get();
In a multi-threaded condition, we cannot ensure that x is 1 because some other thread may call something like a....
0
votes
1
answer
73
views
Two golang goroutines sending messages to the same channel result in a 10-fold increase in time consumption?
Why is there such a significant difference in the time taken for sending and receiving data through a channel between two goroutines?
golang version 1.18
this is my code
package main
import (
&...
4
votes
1
answer
69
views
TVar that blocks read until change?
I'm trying to wrap my head around how to correctly communicate between threads in Haskell.
I have multiple threads that read some state, and whenever it changes they need to do some update. Then I ...
-1
votes
1
answer
54
views
Controlling duplicate api calls with milli/micro seconds delay (concurrency)
I have a POST API, where you can save some data for a customer, there is a possibility that somebody can programatically initiates multiple calls with same data in milli/micro seconds time.
Now As i ...
0
votes
2
answers
79
views
Swift tasks dependency handling
I have 2 async tasks. And one task runs in a nested manner based on condition from other task. I want to achieve something like the code below.
Both Task1 and Task2 have AsyncStreams returning ...
-1
votes
2
answers
78
views
What problems might arise from ignoring this race condition?
I wish to represent a service that receives triggers to run a particular task, however it only runs that task once at a given time while ignoring concurrent triggers.
My brain came up with an ...
0
votes
1
answer
34
views
Using kotlin coroutines alongside threads in a thread based web server application
I have a basic kotlin webserver application built using dropwizard and jersey, which uses threads for handling requests. I have been reading a lot lately on kotlin corooutines and seeing articles ...
0
votes
1
answer
71
views
Why is multi-threading faster than multi-processing? [closed]
I am writing demonstration programs to illustrate various forms of concurrency. They compute the mean over a large set of (pseudo-randomly-generated) integers. I created two versions that use ...
1
vote
0
answers
88
views
boolean variables in keyboard should be volatiles?
I have this class:
public class Keyboard implements KeyListener {
private boolean[] keys = new boolean[256];
public static boolean UP, LEFT, RIGTH, SHOOT;
public Keyboard() {
UP =...
0
votes
1
answer
103
views
Thread hook function
I have two threads f1() and f2(), how can I make a function say g() called every time a thread is awakened to run? For example before thread f1() starts g() is called and returned and f1() runs, then ...
0
votes
1
answer
29
views
ProcessPoolExecutor fails
I have a simple setup to test parallel execution, but it fails no matter what I've tried. I'm working in a Jupyter Notebook.
Here is a model example:
from concurrent.futures import ProcessPoolExecutor
...
0
votes
0
answers
44
views
Producer-consumer problem with queue and semaphore
In Stroustrup's book The C++ Programming Language, there is a code example that demonstrates the use of condition variables:
class Message { // object to be communicated
//...
};
queue<...
2
votes
0
answers
108
views
Concurrency issues when locking using Concurrent Dictionary
I am writing code for a wallet system. At some point we receive a webhook from our payment provider notifying us of a successful deposit. The event is saved & stored and queued as a background job ...
1
vote
2
answers
138
views
Swift concurrency warning. The compiler warns that my concurrent code will not compile in Swift 6 but all the variables are local
I want to try concurrent processing of an array for the first time. The compiler gives this warning: "Mutation of captured var 'scaledImage' in concurrently-executing code; this is an error in ...
0
votes
0
answers
39
views
How to save header's value into Spring Security context considering concurrency safety
I have to use a header value for some utils logic in my kotlin spring application. I found a way to get header value for each request, but I realize that this way is not so good because of concurrency....
1
vote
1
answer
53
views
Does Java 11 Properties class uses double synchronization? It uses ConcurrentHashMap and at the same time synchronized methods
I'm currently diving into the implementation of the Java 11 Properties class. In Java 11 source code, the Properties class stores its data in a ConcurrentHashMap field called map. When you call the ...
0
votes
1
answer
148
views
Is main actor's init isolated or not in Swift (Xcode Beta 5)
The following code worked fine in Xcode 16 Beta 4, but fails to compile in beta 5:
@MainActor
class TimerSchudler {
init() {
}
}
class GameScene: SKScene {
let scheduler = TimerSchudler()
...
0
votes
0
answers
20
views
Concurrent http requests in .NET
I am trying to make many concurrent http requests to external API. The code which i wrote is definitely faster than the normal synchronous version (6x faster), but its still too slow. The avarage time ...
1
vote
0
answers
40
views
Why the low 16 bits of sizeCtl calculates the number of threads from 1 rather than 0 in ConcurrentHashMap?
When I read the source code of ConcurrentHashMap in Java 8, I learned that it uses the field sizeCtl to control initialization and resizing: -1 is for initialization and other negative is for resizing....
1
vote
1
answer
103
views
Concurrency, Reference to captured var in concurrently-executing code
I want to fetch user's contacts using enumerateContacts(with:usingBlock:) and async/await method. Here is my function:
func fetchContacts() async throws -> [Contact] {
let keys = [...
-1
votes
0
answers
81
views
can java code be executed non sequentially?
I have a menu item of a context menu with the following code:
MenuItem mi1=new MenuItem("to hand");
mi1.setOnAction(e->{
list.remove(card);
arena.getHand().addCard(card);
...
1
vote
1
answer
69
views
Why can I access isolated ivars in actor's init in Swift
I have this code:
actor Actor {
@MainActor
var checker: @MainActor @Sendable () -> Void = {}
init(checker: @escaping @Sendable () -> Void) {
self.checker = checker
_ = self....