Questions tagged [multithreading]
Use this tag when the program performs its work using multiple concurrent threads of execution.
1,589
questions
1
vote
0
answers
127
views
Building a generic WebSocket component in Python
I have the following working code for a generic WebSocket component:
...
5
votes
0
answers
637
views
Multithreaded pathfinding in Unity C#
I've tried to implement multithreaded pathfinding in an attempt to increase performance, but if anything, performance seems to actually decrease when I enable multithreading.
Is there anything I ...
3
votes
4
answers
2k
views
Multi-threaded merge sort
Below is the code for merge sort using multithreading. Will this code run for large number of inputs? Does any other part of the code need changing?
...
2
votes
1
answer
428
views
Brute Force Password Program / Python 3.9
I've been making a brute force program for fun. This program tries to guess a password using brute force. I've tried many things to help increase the efficiency. Here it is: (Sorry for the lack of ...
4
votes
2
answers
650
views
Spring Boot API - Avoiding Concurrency issues
I'm still in the process of learning Java / spring and I think I'm getting better. Now at this point I'm able to build a rest api BUT I'm at a lost at how to ensure I've no concurrency issues . I've ...
1
vote
1
answer
199
views
What is wrong with this CancellationTokenSource example
Anybody mind providing an opinion on whether or not this is a good or bad example of Task Cancellation and why. I have my own opinion and I've been told that its baseless, just trying to find out who ...
1
vote
1
answer
86
views
Android APP FTP host profile class implementation
This is a follow-up question for Android APP connect to FTP server in Java. I am attempting to create a tiny FTP host manager with FTPHostProfile class and ...
2
votes
1
answer
2k
views
Single Producer - Multiple Consumers in C++11 using Linux Threads
Hey everyone I was redirected here from Stack Overflow for this question.
I am completely new to thread synchronization using condition variables and pthreads in Linux.
Here is the code I wrote and I ...
2
votes
2
answers
498
views
Write deduplicated 9-digit numbers from concurrent clients to a log
Problem Statement:
Write a server (“Application”) in Java that opens a socket and restricts input to at most 5 concurrent clients. Clients will connect to the Application and write any number of 9 ...
4
votes
0
answers
2k
views
Android APP connect to FTP server in Java
I am attempting to build an Android APP with the ability to connect specified FTP server in Java. The connection operation has been performed in FTPconnection class ...
9
votes
3
answers
3k
views
Finding number of primes less than 10 million using a multithreaded program
I recently decided to learn how to multithread Java programs, so I made a small program to compare the performance of serial and multithreaded programs that perform the same task.
I created a serial ...
2
votes
1
answer
992
views
The multithreading model to clean ConcurrentQueue in C#
I have some code that populate EventfulConcurrentQueue which is ConcurrentQueue. So I need to save all data from ...
3
votes
1
answer
2k
views
Asynchronous dispatch queue
Background:
This is supposed to be the sole worker thread to carry out long-lasting jobs in a GUI application. The GUI thread should be able to schedule tasks in a non-blocking manner and the tasks ...
4
votes
0
answers
890
views
PyQt load images in background process
I am building an application that needs to load 100-200 images (really only limited by performance) and display them to the user in a sort of gallery. A good analogy would simply be Google Images. In ...
2
votes
0
answers
197
views
running a task on UI every x seconds
I often come around a requirement where we have to perform a repetitive task on the user's screen (for eg, updating a counter like flash sale/ live class timer, autoscrolling the banner, etc) .
I have ...
3
votes
0
answers
822
views
C# Procedural Mesh Generation Optimization
I'm making a terrain-deformation system in Unity that utilizes the common marching-cubes algorithm. So far I've gotten the system working, employed Unity's job system and burst compiler, and managed ...
1
vote
0
answers
37
views
Powershell Refolder by Filename Before Delim
I'm pretty new to Powershell but have been using it more and more to automate tasks at work. Now I'm reaching out for some help. I typically use the scripts I write in a way where I copy and paste the ...
3
votes
2
answers
149
views
Pool of Thread Pools
I had a problem at my work that we have some tasks that need to be executed as fast as possible. To do this we implemented them so they are multi-threaded in an ExecutorService. Originally we had for ...
5
votes
0
answers
177
views
stable producer/consumer threads in python
I have implemented a producer/consumer functionality using threads in a given framework and
I'm pretty sure I did not cover all possible scenarios.
I made a small reproducible version. Lines ending ...
5
votes
1
answer
6k
views
C++ event loop and thread signaling
Use case
This is an event loop and signaling system I created for a piece of software which will have multiple asynchronous server/clients/event-emitters/ui, some of those components will have their ...
2
votes
1
answer
2k
views
Wait for all threads in a pool to complete their work
I am trying to replace in an adapted code from internet, a thread pooling class, named ThreadPool:
...
2
votes
1
answer
874
views
Traverse directory using multithreading
I have written program which following purpose
Traverse directory in multi threading environment
First determine all top level directory and store into vector which have following result:
/home/dir1
...
2
votes
2
answers
57
views
Multi-threaded application performance in C
I'm programming a multithreaded application (server-client UNIX socket) implemented for the server-side. I have two thread check_cmd_thr and ...
5
votes
1
answer
65
views
Dynamic number of runnable tasks
I want to execute a number of tasks that may enqueue other tasks, and do all that in parallel, ending only once all tasks are finished.
For example, some sort of crawler that starts with node A, ...
4
votes
1
answer
562
views
A tiny threads pool in C
I'm a newbie in C, and currently following Stanford CS107 - Programming Paradigms. For assignment 6, I find it'd be better to isolate the threads management from the service logic.
The following code ...
0
votes
2
answers
376
views
Multithreaded implementation of K-means clustering algorithm in Java
Hello I have written a multi-threaded implementation of the K-means clustering algorithm. The main goals are correctness and scalable performance on multi-core CPUs. I expect to code to not have race ...
2
votes
0
answers
782
views
Assigning parallel workers to predict from keras model using concurrent.futures
I am working on a Reinforcement learning project, where I have to gather a lot of data using a TensorFlow model. During the data gathering, the weights of the model do not change. So, I am using ...
5
votes
2
answers
4k
views
Calculating pi with Monte Carlo using OpenMP
I'm a C noob and I'm learning about concurrency using C. I came across an exercise in a book asking me to find the approximate value of Pi using the Monte Carlo technique with OpenMP. I came up with ...
1
vote
1
answer
253
views
Simple multithreaded FileLogger in C++
I'm new to C++ and am following up on: A simple multithreaded FileLogger in C++
I am curious to know if I implemented his ideas correctly, if there are further improvements to the code and whether it'...
0
votes
1
answer
622
views
Simple read/write lock implementation without starvation
I've built a read/write lock and have been testing it without encountering any problems. It was made to avoid writer starvation, but I believe it works against reader starvation as well. I've seen ...
4
votes
2
answers
529
views
Downloading and parsing research papers
I am trying to write a script which gets a research paper from a website by calling their API and then traverse it sentence-wise with some conditions.
The paper is accessible in XML format. I am ...
-1
votes
2
answers
3k
views
C++17 multi threaded thread "pauser"
I needed a way to pause multiple threads from a single parent thread, this was my solution for the general case. I would like advice on code quality and enhancements. I'm particularly interested if ...
3
votes
1
answer
170
views
UNIX cp multithreaded implementation in C
I recently finished a high school project of mine for a class revolving around creating my own multithreaded implementation of the "cp" terminal command in UNIX systems.
I am seeking for ...
3
votes
2
answers
358
views
A toy example of the concurrent stack via atomic variables and CAS pattern
I've written a toy example of the concurrent stack which has only three functions push(), peek(), and ...
1
vote
1
answer
76
views
Eye tracking calibration
I am a newbie in std::thread and std::condition_variable.
I would like to use 2 threads: one for display (void showCalibration()) and the other for processing (void CaptureFrame()). These threads ...
1
vote
1
answer
877
views
Parallel map in Rust
A parallel map written in Rust. I am new to Rust and wondering if there is things that could be done better or more efficiently.
...
0
votes
2
answers
244
views
ScheduledExecutorService running a couple of scheduleAtFixedRate
I have created a task that I need to query database for List of String and store it in neededDataList. I will use neededDataList ...
3
votes
2
answers
2k
views
Allow one thread to execute section while others wait and resume
I have a requirement that is summarized below.
...
1
vote
1
answer
870
views
c++ multithreaded message broadcaster using callbacks
note: This is an updated design after a previous review round.
I have written a class that handles listeners registering callbacks to receive messages. Registered callbacks can be replaced or removed. ...
2
votes
1
answer
4k
views
C++ callback multithreaded, can unregister itself
update: a new version of this code is posted here
With this post, i would like to 1) ask for feedback on below code as it stands:
do i apply all best practices for c++20?
is it safe?
is my way to ...
3
votes
2
answers
141
views
A simple multithreaded openrct2 maze simulator
I found these two videos by Marcel Vos: (1) (2) that show how you can make hedge mazes that are very hard for the simple roller coaster tycoon 2 park guest AI to solve. Long story short, he eventually ...
1
vote
0
answers
76
views
Stoppable asyncio thread class
A threading.Thread subclass intended for running an asyncio loop that has the ability to be stopped gracefully from another ...
2
votes
1
answer
361
views
C++ implementation of recursive_shared_mutex
I know it's bad to even use recursive_mutex because of its poor performance, let alone a recursive shared mutex. However, I'm doing this just to practice. Any suggestion will be appreciated!
...
4
votes
0
answers
120
views
Sending simultaneous requests using threading
I have been trying to improve my Discord sending webhooks functions where I have multiple dictionaries, as you will see in the code below:
...
5
votes
2
answers
5k
views
Multithreaded Matrix Multiplication in C++, improving efficiency?
Here is a very simple Matrix Multiplication console application using multiple threads (one per row), I'm just looking for feedback to keep improving :) thank you in advance
...
2
votes
1
answer
1k
views
Parallelized web crawler using goroutines and channels
As part of the "a tour of Go" section on golang.org, I was trying to make a (formerly singlethreaded) web crawler parallelized using goroutines. I got it working but it doesn't seem to "...
-1
votes
1
answer
154
views
Determine whether number is prime [closed]
The code determines if a number is prime or not, and there are some initial checks to rule out some values.
I would like feedback on how to speed up this program. I am really new to threads - might ...
2
votes
1
answer
421
views
Thread-safe LFU Cache
I am trying to implement a thread-safe LFU cache algorithm, please review my code and would really appreciate some criticism or suggestion. (on naming, design, data structures used, anything)
Some ...
3
votes
1
answer
71
views
Avoiding race in a sub-millisecond TOD timer
Part of the project I am working on is to maintain the time-of-day, at the sub-millisecond accuracy, while not overwhelming CPU.
The controller has a pretty standard timer, with two registers, ...
1
vote
1
answer
1k
views
Thread-safe LRU Cache Implementation in Java
I am trying to implement a thread-safe LRU cache algorithm, please review my code and would really appreciate some criticism or suggestion.
Some assumptions:
capacity will be larger than 0
Some ...