Multi-threading is how work performed by a computer can be divided into multiple concurrent streams of execution (generally referred to as threads).
2
votes
0answers
19 views
Concurrent ObjectPool using ConcurrentLinkedQueue
Main ObjectPool Class: It uses atomic operations and a concurrent linked queue to achieve the best performance compared to Apache commons pool. I want to make sure there are no concurrency issues even ...
5
votes
1answer
40 views
Concurrent stack in C - follow-up
This is a follow-up question to Concurrent stack in C
The pop function not just removes the top element from the stack, but also returns it.
If a pthreads call ...
1
vote
1answer
40 views
Did I overuse / underuse threading locks in my custom list class?
I am writing a Python module in which two threads access one list. One thread adds 500 items to the list per second, and the other thread reads the list at an irregular interval. I want to make a ...
1
vote
0answers
58 views
Multiple readers, single writer synchronization
This is educational purpose "simulation" of multiple readers / single writer server.
No actual work is done, except the synchronization. In current realization, readers have priority over writers.
<...
5
votes
1answer
72 views
Single-thread worker in multi-thread webservice
There is standalone WCF webservice, which is providing methods to interact with legacy ERP system.
This system exposes an API, which allow programmer to interact with it.
The problem is that, for ...
3
votes
2answers
68 views
My first attempt at multithreading in C# with Prime Numbers
This is my first attempt at multithreading in C#. This entire program does several things with prime numbers, but the part I'm going to post is mainly focused with printing out all prime numbers ...
2
votes
0answers
54 views
Thread-safe RLockedList
I have written a thread-safe list which can be used as a drop-in replacement for a regular list. This has been tested and used internally without issue, but "The absence of evidence is not evidence of ...
4
votes
0answers
56 views
Multi-threaded code to handle messages from a provider
Having a look at my code, is there a way to be losing elements?
...
0
votes
0answers
31 views
Queue that permits at most X simultaneous operations
I ran into this once (permits=N) and then again today (permits =1) where I only want 1 to N operations running simultaneously. One example comes from firing into a state machine (the permit=1 example)...
0
votes
1answer
51 views
Single producer single consumer command queue
I needed to create commands simply with lambda and execute it in another thread. The following code works fine. Any suggestions about performance are appreciated.
I want to use SSE aligned variables ...
4
votes
2answers
80 views
C++ Wrapper for cURL: Multithreading and serializing asynchronous ops
I did this library to help me from one of my projects and decided to publish it on GitHub hoping people might find it useful, convenient and easy to use in their projects too.
It's a header-only ...
6
votes
1answer
62 views
RabbitMQ wrapper to work in a concurrent environment
I'm developing a common library for my organisation that will be used across different services by different teams. The library is a simple wrapper for RabbitMQ.
Some services will only be producers, ...
2
votes
0answers
42 views
RCU in C++11 using std::shared_ptr and a little more
Here's some code I wrote to solve a problem at the server I'm working on. Is this valid? I've tested it, and it works, but I would like some opinions on this.
It's basically a ...
4
votes
2answers
149 views
Multi-thread safe buffer in C++
I am trying to design thread-safe data structure that I cna use as a buffer in my application. Can you please give me comments about this code and what can be improved:
...
1
vote
0answers
23 views
A simple thread safe LRU cache using unordered map and lists in C++
I am learning concurrent programming and am writing a thread safe LRU cache for practice. Below is my first attempt. Kindly comment and let me know where I can improve.
PS: There have already been a ...
6
votes
2answers
95 views
Concurrent stack in C
(See also the follow-up question.)
I was in the mood for pthread.h and decided to write a concurrent stack data structure. My requirements:
the stack has maximum ...
4
votes
6answers
321 views
Loop for periodic processing in a background thread
Occasionally I need to implement periodic checks in a loop in a background thread, a typical example being asynchronous processing using a message queue. While it’s not terribly complicated, I wonder ...
7
votes
2answers
110 views
Thread worker simulator
Because I have been writing more multithreaded C++14 code lately, I've developed some tools that help me make sure that my threads are all working as intended. In the real code, it's often difficult ...
4
votes
1answer
69 views
Safe handling of variables in multi-threading application with shared resources
I've been developing this application as my first C++ project and am at a point where it is functional and would like to take a step back and critique/improve my code from a standpoint of ...
6
votes
2answers
354 views
Creating multiple threads to process items in a listview
The goal is to pick items from a listview, do some web related task with the information and then update the UI with the returned information from the web request.
The problem is with having multiple ...
1
vote
4answers
74 views
Socket client in C using threads
I'm working on socket programming in C. I have no problem with usage the threads. This all works fine but I'm new in this area. I wrote this code in client.c but is there any misused code or something ...
5
votes
1answer
60 views
Collection to hold maximum number of running Tasks
I need a collection/bag (something) that will hold some maximum number of running Task objects. Adding a new running Task to the ...
6
votes
2answers
63 views
Synchronization of transaction processing
There's a server which does the following:
Receive request with transaction id
Load corresponding transaction from storage. New transaction object is returned each time
Process transaction
Save ...
3
votes
1answer
48 views
Multithreaded Monte Carlo pi approximation with own pseudorandom number generator
I made a Monte Carlo pi approximation program, that makes use of multithreading and a pseudorandom number generator I wrote (the one from big_wheel.hpp, which I ...
0
votes
0answers
23 views
Thread handling for playing videos
This is a simple motion detection using webcam written in Java, based on this example.
Basically, what this code does is:
While no motion is detected, play a 'blank video' in loop.
Every time a ...
6
votes
2answers
76 views
Insert and Remove Element in Deque using threads in C++
The following code works fine for inserting and removing an element from a deque using two threads.
I would appreciate any help on how to make it better, especially in terms of thread safety.
...
1
vote
0answers
44 views
Executing multiple kafka consumers on the same box and each thread working on different consumer instance
This is a follow on to : Running multiple kafka consumers on the same box independent of each other
In my previous question, @Vogel612 gave a great review and from that review I figured it out that ...
3
votes
1answer
70 views
Running multiple kafka consumers on the same box independent of each other
I have two Kafka consumer ConsumerA and ConsumerB. I want to run these two kafka consumers independent of each other on the same ...
6
votes
1answer
121 views
Clicking game in windows forms
I've made a simple clicking game where you spam a button in order to get coins which you can use to buy upgrades to get even more coins.
I've only 2 classes one that is responsible for the game logic ...
4
votes
2answers
79 views
Writing a thread-safe queue in C++
I created a SafeQueue class, which stores pointers. It has two methods:
push: Adds a new pointer to the queue
next: If the queue is empty, returns nullptr. ...
3
votes
2answers
59 views
Simple mutex and conditional variable signal in C
I'm new to multithreading in C so I made a toy program that uses a mutex and a conditional variable to communicate between two threads. do_work performs a task ...
5
votes
2answers
83 views
Dining Philosophers variation in C
This is a variation of the Dining Philosophers Problem. The task is to coordinate several students inside a gym. All students try to obtain their desired training weights from a shared weight rack. ...
1
vote
0answers
56 views
Downloading user's post data using Facebook Graph API [closed]
I'm trying to write a Windows Desktop application to download a user's post data from Facebook using the Graph API through the Facebook SDK C# library, to leverage a bit of the load and to make it ...
5
votes
1answer
87 views
Send multiple individualised emails via a limited number of SMTP clients
This is my first foray into multi-threading, and I'm keen to know if I have fallen into any traps or have room for optimisation/improvement.
Example usage:
...
0
votes
1answer
76 views
Thread safe singleton class to connect to Cassandra
I am working with Cassandra and using the Datastax Java driver for it. Here is my singleton class where it makes a connection to Cassandra:
...
3
votes
0answers
34 views
Hex Color Analyzer in javafx
Here is a simple hex color fetcher and analyzer in javafx that i wrote to understand multi-threading in javafx.
Questions:
Is my regex ok ? or if it can be improve?
I am not much familiar with ...
2
votes
1answer
58 views
3
votes
0answers
48 views
Pitch detection library, basic architecture
I'm a mechanical engineer/amateur programmer trying to learn modern C++. I'm working on a personal project where I'm building a library that uses PortAudio to abstract some basic audio processing, ...
3
votes
1answer
175 views
Multithreaded bottom up merge sort
Before I tried this, my impression was that (bottom up) merge sort would be memory (actual RAM) bound, and not affected much by multithreading, but a 4 thread sort is about 3.0 times as fast as a ...
3
votes
0answers
16 views
Python simulacrum of windows copy window
I wrote a program to copy files with an progress bar that looks similar to Windows built in function. The copy function is run in a separate thread and the tkinter GUI is run in the main thread. This ...
2
votes
0answers
46 views
Requesting information about people from a web API
I'm requesting from a web API information about 20,000 people that I need to update continuously at lightning speed (the web server doesn't throttle the number of requests). I can request an update on ...
5
votes
1answer
58 views
Working with threads - shared access and graceful cancellation
I've created this program to show how to stop threads in a controlled manner.
Important points in the program:
Starting and waiting for threads
Exception handling
Stopping threads in a controlled ...
5
votes
2answers
160 views
Faster brute force algorithm
I have this brute force code, where you input a password and runs through combinations of numbers, lowercase and uppercase letters, and special characters until it match the password given.
The ...
3
votes
0answers
41 views
Linux performance using multi-threads (vs one thread) and ssh message
My server receives requests in one thread and responds in another. I am using thread pools of pthread-s for both receiving and sending. The performance is not that bad, however...
When I am doing the ...
1
vote
1answer
36 views
Simplify TcpListener application in C#
I have a simple application that can receive and send tcp data.
right now there's a thread used to start the listener and within this thread there's another thread to receive.
it works but it seems ...
2
votes
1answer
111 views
Simple multi-client echo server
I've been looking at some async comms in C#. As a proof of concept, I've written a simple multi-client echo server. The server allows multiple TCP clients to connect and listens for input from the ...
2
votes
2answers
121 views
Object Pool implementation using blocking queue
You need to design and implement a generic pool for storing objects (implementing poolable). The pool should support the following:
A support for creational pattern which would be used by the ...
3
votes
4answers
99 views
Optimizing algorithm of analyzing incoming data
I've been making an app, which gets data from external device (via bluetooth) and displays received data.
I'm still pretty new to programming and I'm struggling to finish this app.
I wrote some code, ...
4
votes
2answers
71 views
Red light, green light… kinda
For an assignment I had to create a client and a server that communicate over a well known FIFO. The server is required to use three threads to serve the client, managed by a semaphore.
The code was ...
1
vote
3answers
113 views