Skip to main content

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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
54 views

A while ago I wrote for my own needs a (non-reentrant) read-write lock for kotlin's coroutines. I got no reactions on the relevant github thread. I think it's a nice code, so I thought I'd share it ...
Al.G.'s user avatar
  • 109
4 votes
3 answers
709 views

The task is educational. The basic functionality is working. Here are some questions for my code. Please give me feedback. Main: Architecture & Design: Is the decomposition appropriate? Should ...
bonnyped's user avatar
1 vote
1 answer
65 views

I have table called cash_voucher it has some columns. I want to generate voucher number based location id. I mean generates voucher numbers starting from 1 for each location For example location id is ...
Relax's user avatar
  • 141
1 vote
0 answers
65 views

I want to validate my solution for a lock-free leaky bucket rate limiter. Given a queuing capacity and rate limit per second, it should queue requests till capacity is reached and it should allow only ...
Pritish Nayak's user avatar
1 vote
2 answers
167 views

Intro This time, I was in the mood for concurrent programing (ProducerConsumerSimulation.java). To this end, I have ended up with the code below. My primary concerns are: Class design is trash, The ...
coderodde's user avatar
  • 32.3k
5 votes
1 answer
104 views

I'm developing a pipeline that processes unknown ingredient data from the OpenFoodFacts API. The goal is to find valid German words that are not yet in their taxonomy. The tool performs the following ...
kiaora's user avatar
  • 141
2 votes
1 answer
100 views

I've implemented a multithreaded merge sort using Java's ForkJoin framework, and I wanted to gather feedback on its correctness, efficiency, and scalability. Here's my implementation: ...
Akash Gupta's user avatar
4 votes
1 answer
113 views

I’ve developed a Go program to benchmark a FHIR server by uploading a dataset of FHIR resources concurrently. The goal is to stress-test the server by sending a specified number (...
Martin Hinze's user avatar
8 votes
2 answers
339 views

Introduction This is a queue that allows many producers to simultaneously write their items and many consumers to simultaneously read theirs. It's useful when construction and/or consumption could be ...
Toby Speight's user avatar
  • 88.7k
5 votes
2 answers
694 views

The code below was written for an interview question of designing a load balancer with only a register() method. ...
drets's user avatar
  • 313
3 votes
1 answer
169 views

This is an improved code version for Amount Transfer Between Different Accounts Welcoming any further improvements for this. ...
Jill's user avatar
  • 277
4 votes
1 answer
268 views

I implemented the below classes for transfer amount between different accounts. Used ConcurrentHashMap and Stamped Lock to handle concurrency. Am I missing any important concepts here? Are there any ...
Jill's user avatar
  • 277
5 votes
2 answers
960 views

I implemented the below URL Shortener class. Used ConcurrentHashMap to handle concurrency. Short URL building logic may not be optimal, but it ensures that only ...
Jill's user avatar
  • 277
4 votes
2 answers
517 views

Have Implemented below service registry class with 2 load balancing strategies.Used Strategy Pattern. Used Stamped lock ( Optimistic write locking) for ensuring thread safety and concurrency. Used ...
Jill's user avatar
  • 277
3 votes
2 answers
231 views

I have code that concurrently reads data from a stream, processes elements, and writes the data to another stream. Each of these individual operations may fail, in which case I want processing to halt ...
Will Beason's user avatar
4 votes
1 answer
422 views

There may be a dozen things that could be improved about this code, but it's just a very quick proof of concept and for the sake of this post I'm specifically wanting to know if someone can verify ...
BVernon's user avatar
  • 225
1 vote
1 answer
70 views

I was reading about the implementation of distributed locks where we need to verify the lease using a fencing token as per this article - https://martin.kleppmann.com/2016/02/08/how-to-do-distributed-...
Pratyush Prateek's user avatar
3 votes
1 answer
94 views

I'm just dusting off my C++ knowledge in area of multithreading. I started with implementing a producer-consumer pattern inspired by https://jenkov.com/tutorials/java-util-concurrent/blockingqueue....
Matt Black's user avatar
2 votes
2 answers
173 views

This is a popular interview question. It is meant to be done within 30 minutes. The task is to implement a thread-safe performant Bank Account API that allows to transfer, deposit, withdraw and check ...
Sasha Shpota's user avatar
5 votes
2 answers
983 views

I would like to know the possible improvements in design and concurrency of the following load balancer: ability to add/register new instance keep max of 10 instances for load balancer forbid ...
tinyzero4's user avatar
7 votes
2 answers
1k views

This is a popular interview question. It is meant to be done within 45 minutes. The task is to implement a thread-safe performant in-memory URL Shortener. My implementation is based on two maps that ...
Sasha Shpota's user avatar
2 votes
1 answer
85 views

I've been studying the Banker's Algorithm and was curious if I could implement a similar resource management system using only Mutex and Condvar. The code I wrote is a synchronization program that ...
ybjeon01's user avatar
5 votes
3 answers
154 views

The container should be thread safe and provide lazy load of data, and cache the data for set period of time. ...
trolkura's user avatar
  • 151
2 votes
2 answers
169 views

This solution has a total of four classes. Main.java: Class with main method. Execution starts here. ...
vvs14's user avatar
  • 121
2 votes
3 answers
158 views

Can someone please review my rwlock implementation to see if there are any issues with correctness (hopefully not), give any feedback on how to write good C code etc, design patterns which could be ...
Tejas Anand's user avatar
2 votes
1 answer
116 views

Background: The program reads 1000000 lines in the file. Every four line will be parsed into an object in a vector. If it has 2 objects with the same name, it will drop 1 object and increment one of ...
SummerGram's user avatar
4 votes
1 answer
78 views

My deployment and configuration process entails multiple processes trying to invoke dpkg on my VM at the same time. While dpkg has a locking mechanism, it causes anyone not holding the lock who is ...
billp's user avatar
  • 43
1 vote
1 answer
137 views

As stated in the javadoc below, this is intended for monitoring and debugging. I've found it especially useful for figuring out which tasks got stuck and prevented clean terminations of my ...
morgwai's user avatar
  • 389
2 votes
2 answers
260 views

How can I optimize the performance of the code below? Destruction of the condition variable at the end of main blocks, not sure why this behavior is occurring. Is it possible to remove some of the ...
Darnoc Eloc's user avatar
2 votes
1 answer
897 views

Problem statement: Consider a scenario where a vector of very small tasks, each encapsulated within a class 'Task' with a thread-safe method Task::process(), needs to be efficiently processed in ...
Shakti Malik's user avatar
1 vote
0 answers
116 views

This is an attempt to create a usable alternative to the "normal" method of implementing concurrency with tkinter. The "normal" method seems to be by pro-actively polling a result ...
Michael Lundie's user avatar
5 votes
4 answers
2k views

C++ shared_ptr implemented as a coding practice and learning purposes. It uses std::shared_ptr interface. Basic tests are included (using single header Catch 2) Some methods are omitted to keep the ...
Tomas Tintera's user avatar
2 votes
1 answer
297 views

I need a thread-safe counter that will see frequent increments but will be rarely read. This counter will be used to emit metrics, for example, the hit rate of a ...
Greg's user avatar
  • 121
4 votes
1 answer
168 views

I have the following simplification of a program which consists of 2 threads. One thread pushes packets to the back of a deque while another waits for user input before performing a "heavy" ...
Bula's user avatar
  • 369
2 votes
1 answer
887 views

I have SignalR app that publishes sent messages to Redis. My console app subscribe to channel where these messages are sent, deserializes it and saves in database. Problem is with handling these ...
Szyszka947's user avatar
1 vote
1 answer
68 views

Context I am making a system, where different clients issue queries A query is resolved by issuing a set of subqueries I have an invalidation-worker, which gets notified when subqueries go stale ...
Stepan Parunashvili's user avatar
6 votes
1 answer
957 views

Assume I have a type task_info that stores the task-specific data needed to execute the task. A std::vector of those is built ...
Bolpat's user avatar
  • 243
3 votes
2 answers
357 views

This here is the follow-up to this question. I was recommended to implement a Lockable type (similar to std::mutex) that can work with ...
digito_evo's user avatar
1 vote
1 answer
265 views

We have the following class written in Kotlin Native with the new Memory Manager (which doesn't require to freeze objects): ...
Volo's user avatar
  • 111
2 votes
1 answer
249 views

I recently discovered the atomic wait/notify mechanism in C++20 and wrote this readers-writer lock in the style of Linux kernel Seqlock. Writes have to be inside a lock/unlock, while reads are ...
MDH's user avatar
  • 23
2 votes
1 answer
1k views

The goal is to run a function compute in parallel on many inputs (10**6 in total, say) and store the results. Each call to ...
ga325's user avatar
  • 21
0 votes
1 answer
91 views

I have slightly refactored the Delayed, concurrent event stack in Java. Now it looks like this: DelayedEventStack.java ...
coderodde's user avatar
  • 32.3k
1 vote
1 answer
201 views

Link to go playground https://go.dev/play/p/ctQDpDW6pui This code has been based on suggestions and conversations in this thread here Architecture: A read method creates a channel shared with ...
JavaDeveloper's user avatar
0 votes
3 answers
232 views

(See the next iteration: Delayed, concurrent event stack in Java - follow-up ) Motivation I was confronted with a task of having "message events" for a GUI program. The use case is as ...
coderodde's user avatar
  • 32.3k
2 votes
1 answer
229 views

I have multiple E2E tests (written in Java) which share login details, each test during runtime will query the locker API for login details which is running on its own dedicated server. Below is my ...
Pawan Kumar's user avatar
2 votes
1 answer
164 views

I have a thread_pool class, that mimics std::thread. (I would have liked std to have a pool, but alas that is not the case.) thread_pool.h ...
rioki's user avatar
  • 472
4 votes
1 answer
899 views

I have a thread safe queue in my library c9y. It is generally used as a task queue in the task_pool class, but in can be used for any producer / consumer problem. queue.h ...
rioki's user avatar
  • 472
3 votes
1 answer
173 views

This mutex prevents concurrent access to a target resource. One key requirement is the ability to be acquired in a (scheduler) thread and released in a different (worker) thread. Unfortunately this ...
Raffaele's user avatar
  • 131
4 votes
1 answer
615 views

I am a beginner at using Golang, I would like advice about the following program. It is a CLI tool that can check the expiration dates of HTTPS certificates concurrently. I have only used the standard ...
preetpalS's user avatar
2 votes
1 answer
529 views

The code below is a sender/receiver setup in C++ where the sender is in one thread, the receiver is in another, and the data being sent/received is "shared" (global). The code uses the ...
tarstevs's user avatar

1
2 3 4 5
10