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

learn more… | top users | synonyms

5
votes
1answer
30 views

Class managing queuing updates from another thread, Version 2

This is an updated version of: Class to manage updates coming in from another thread Managing updates from other threads into Swing is a hard problem. In MVC design, if you don't want to have the ...
1
vote
0answers
31 views

Batching using semaphores

I need to batch messages when pushing them, where multiple threads do the publishing. What could be a better way of doing this? ...
5
votes
2answers
46 views

Class to manage updates coming in from another thread

Managing updates from other threads into Swing is a hard problem. In MVC design, if you don't want to have the Presenter be responsible for Thread safety, you can end up with deadlock issues, and also ...
5
votes
1answer
48 views

Multi-threaded bitcoin vanity address generator written in Java

The application leverages the bitcoinj library to generate a vanity bitcoin address. A vanity address is simply a bitcoin address that contains a personalized string. I would like some critical ...
1
vote
1answer
37 views

ArrayBlockingQueue - blocking drainTo() method

This is a follow-up question to this question. Is this a reasonable implementation for a blocking version of method ArrayBlockingQueue.drainTo(Collection)? ...
-1
votes
0answers
30 views

C++ Multithreaded Ip Range Port Scanner [closed]

Been working on creating a multi-threaded port scanner that can scan an IP range. However my results are being skewed. I feel as if I have a race condition in my code but I cant seem to find it. All ...
11
votes
0answers
63 views

Getting chatty with FX

Applying a lot of unprecedented concepts here, it's a simple chat server capable of handling multiple clients, which are run through JavaFX, and have their individual threads instantiated and handled ...
6
votes
1answer
50 views

Creating an in-memory ViewCounter that commits to database every 10 minutes

This singleton is responsible for counting every pageview (called Routes in our case) we get by id, until the timer runs out and commits the results to the database in one query. Then the counter gets ...
0
votes
0answers
77 views

Custom ConcurrentHashMap for ints

I've implemented a concurrent hash map for int primitives. ...
2
votes
1answer
37 views

ReadWriteMap implementation

I had a task to realize ReadWriteMap ...
4
votes
3answers
388 views

Debounce in Scala

This is my attempt at implementing debounce in Scala without any 3rd party library. How can I improve the code/make it more idiomatic (and any bugs I might have missed)? ...
-2
votes
1answer
203 views

Simple Implementation of a ReentrantLock

An implementation of a ReentrantLock: ...
-3
votes
1answer
66 views

Simple Implementation of a BlockingQueue

An implementation of BlockingQueue ...
5
votes
2answers
126 views

Queue for distributing tasks between threads

I implemented the following class to dispatch std::function<void(void)> objects to a thread pool. Multiple threads will block on the pop call until a task is ...
10
votes
1answer
113 views

Concurrency interview

A little while back I had an interview where they posed a problem, in summary: Watch a certain directory, and process incoming JSON files These JSON files have various "Type" fields Every second ...
4
votes
2answers
57 views

Serialize/deserialize objects to and from database concurrently

I have a class which runs as spring bean in the container and its purpose is data persistence. In the overriden method ...
4
votes
1answer
74 views

ConcurrentHashMap Implementation

I have written a simplified version of my own MyConcurrentHashMap. I tried to make use of a Lock[] array for ...
1
vote
1answer
29 views

Implementation of self-updating, asynchronous cache solution of individual (non-bulk) objects

Here I am again; referring to my previous code review request about a self-updating, asynchronous (?) cache. The previous class takes care of caching operations like "get all users registered in our ...
0
votes
2answers
59 views

Implementation of asynchronous (?), self-refreshing cache of object collection bulk

I'm trying to create a caching solution used in various parts of a clients' application. The resulting code will be open source. For example, it will be used for caching API queries like "get all ...
2
votes
1answer
39 views

Using goroutines to bruteforce a secret code

For a puzzle I had to brute force a password. I've never used goroutines before, and I don't have much experience in concurrency. This is the cksum function, which takes an array of the ASCII code ...
3
votes
1answer
86 views

Hybrid Lock Implementation

I have an algorithm that is painfully slow if I use 'pure' mutexes. That's because most of the critical sections are short and far shorter than the work to sleep a thread. However, it is also slower ...
4
votes
1answer
49 views

Multithreaded scoreboard for different levels

For an assignment I had to create a highly multi-threaded scoreboard for a multi level game. So every time a user adds a score if the level doesn't exist, it gets created ad-hoc. Important point: a ...
3
votes
1answer
47 views

Non-blocking solution to the dining philosophers

This is one of tasks, which I had to do for the recruitment process to be started in some company. Unfortunately they didn't like it so I've decided to share it here for discussion. Philo5.h ...
3
votes
1answer
46 views

Downloading 2 tables from db, does calculation and uploads resulting table

I have written this script that downloads two tables from the db, preforms an intersection on them and adds 2 new columns to the resulting table, and uploads the resulting table to the db. It's a bit ...
-1
votes
1answer
27 views

Removing an element and the element following from an ArrayList [closed]

I have an ArrayList of Strings. I want to delete all elements with a particular value and the element immediately after that one. I have an ArrayList with the elements "Ape", "Bear", "Cat", "Dog", ...
5
votes
1answer
86 views

A Stream wrapper that executes all writes asynchronously

I wanted to make a Stream that can wrap another stream and buffer all writes, to increase performance; comparable to the ...
2
votes
2answers
31 views

Storing recent search phrases

I have a search on a very simple spring-powered website and I want to display 10 recent inputs: ...
3
votes
1answer
46 views

Implementation of FastICA in multithreading approach

I am to implement a parallel version of FastICA, so I implemented the serial version of FastICA. Now this is the architectural diagram of how it is going to parallelize. I just coded a basic ...
2
votes
1answer
89 views

Message queue with multiple producer, single consumer and no duplicates

I had to make a message queue in an android app which my thread takes messages from and processes them. There can be multiple producers and duplicate messages should be avoided. Rate of insertion is ...
7
votes
1answer
173 views

Continuation Implementation in C++11

While playing with the concurrency features in C++11 I noticed that there wasn't any support for continuations. I wanted to develop something similar to Tasks in The Parallel Patterns Library (PPL), ...
2
votes
0answers
50 views

Parallelized image transformations using GraphicsMagick

This is part of a script that I use for porting a TWRP Theme from one resolution to another. Respectively portrait to portrait and landscape to landscape. In this function entirely, it focuses on the ...
2
votes
0answers
44 views

Porting Java semaphore to MacOSX

I wanted to write some more JNI code and decided to (re)implement a semaphore for MacOSX. In order to assert somehow correctness of my implementation I hereby supply a (multi)consumer/(multi)producer ...
6
votes
0answers
134 views

C++ concurrency library

I started a C++11 library of concurrency primitives in order to study and compare their performance; provide high-quality implementation of those to use in my projects. Its main target platform is ...
-1
votes
2answers
54 views

Replacing Synchronization with Atomics

I have tried to make modification in below specified code by removing synchronized and replacing Integer with AtomicInteger . ...
3
votes
2answers
269 views

ArrayBlockingQueue: concurrent put and take

I have implemented an ArrayBlockingQueue (put and take) on the lines of LinkedBlockingQueue i.e using two locks so that my take ...
1
vote
1answer
37 views

Parallel natural merge sort

Continuing working on Natural merge sort, I have parallelized it. Requires \$\Theta(N)\$ space and runs in $$\Omega(N + \frac{N}{P}) \cap \mathcal{O}(N + \frac{N}{P}\log_2\frac{N}{P})$$ time, where ...
2
votes
1answer
216 views

Simple thread-safe loading cache based on RxJava

I'm sketching a simple thread-safe cache which can load missing values. It is based on RxJava's Observable which also means that it should be possible for a client to join a request for value which is ...
6
votes
2answers
2k views

A multi-threaded Producer Consumer with C++11

I am trying to learn concurrent programming in C++11. I tried to write code for a classic producer consumer concurrency problem. Would you please review and make any comments about it? ...
2
votes
1answer
150 views

Readers-Writers problem in C

I would love some suggestions on this code of mine, pointers on overall design, code quality, optimization in terms of memory and speed. ...
3
votes
1answer
91 views

Reducing lock contention for a caching utility, or make it totally lockless but threadsafe

My Java program is a module called configProxy which fetches configuration entries from a remote node (say from a Redis instance). When the caller calls the ...
7
votes
1answer
245 views

Cache for JSON API

I am working on a small project which utilizes a 3rd party API. Many of the queries from the API can take 5-10 seconds so to keep the front end moving a bit faster I decided to cache the responses ...
3
votes
1answer
422 views

Concurrent LRU cache using sychronizedMap() or ReadWriteLock

Trying to implement a simple, thread-safe LRU cache that's meant for "read mostly" use. Collections.sychronizedMap() Clean, simple, not much else to say. ...
7
votes
1answer
123 views

Code snippet for a method dealing with IDs from multiple threads

I have multiple threads calling a method, passing in an ID and value. I have two constraints I need to place on this method: Only one of the same ID can be processed at a time. Additional threads ...
3
votes
1answer
82 views

Execute startup method asynchronously

The goal is to call startManager on application start so that the manager is initialized in background without blocking application main thread. Is it a safe ...
3
votes
1answer
44 views

Walking and comparing contents of binary trees

I've written a solution for http://tour.golang.org/concurrency/8, which asks for a Walk() function to traverse a randomly generated binary tree, and a ...
1
vote
0answers
729 views

Golang concurrent HTTP request

I wanted to test the performance of concurrent http request in Go against node.js: ...
3
votes
0answers
141 views

Blocking builder with singleton

I am trying to implement a singleton builder that would be shared across multiple builder threads for Coordinate objects. Here is the simplified target class ...
7
votes
1answer
159 views

Sorting Algorithm Visualizer

Over the course of the past month I've worked on a little visualizer to show how different algorithms are sorted. I'm pretty happy with how it turned out but would be interested in any feedback ...
3
votes
3answers
143 views

Producer-consumer code

The idea I have in my head is this: I am not sure if I need the index variable in consumer and producer. Moreover, I want to know if it is OK like this (it ...
1
vote
0answers
46 views

Parallel for loop in Java - follow-up 2

The previous iteration at Parallel for loop in Java 8 - follow-up. The changes are as follows: MyTask is removed. Synchronization removed. Now the user is ...