Questions tagged [multithreading]

Use this tag when the program performs its work using multiple concurrent threads of execution.

Filter by
Sorted by
Tagged with
4 votes
0 answers
144 views

Just a digital clock in Swing

I've written a little clock implementation in Java Swing. It now seems to work flawlessly after having terrible Swing specific timing problems. Please indicate if this is the way to draw the clock and ...
Maarten Bodewes's user avatar
4 votes
1 answer
116 views

C++ multi-threaded determination of curling numbers in vectors

for a thesis I am creating a program that constructs curling sequences. The curling number of a sequence is defined as 'the largest frequency of any period at the end of the sequence'. (For example, ...
StevenCellist's user avatar
1 vote
0 answers
200 views

Python console pong game - multithreading

I am writing a pong game in Python that uses voice input to move the paddles. I have implemented multithreading so that the google speech recognition module can always run in a separate thread from ...
Newton Karanu's user avatar
3 votes
2 answers
688 views

Multithread reading and processing when working with HDF5 files

I have a program that should read and process about 500,000 files in the format hdf5, each of them containing about 400 data points representing the coordinates of ...
John K's user avatar
  • 133
2 votes
1 answer
127 views

Bulk slack emoji downloader

NOTE The script relies on ruamel-yaml and requests packages available on pypi. I wrote a script which goes over the pack file details as specified by the emojipacks project, and downloads (and saves) ...
hjpotter92's user avatar
  • 8,706
5 votes
1 answer
65 views

Multithreaded number printer in ordered manner

On recent interview I was asked to write program that print "Zero" and "One" to stdout from different threads, but in ordered manner: ...
Igor B's user avatar
  • 151
3 votes
1 answer
4k views

python flask spawn jobs with multiprocessing

I have a python flask app that waits for requests from user app and than spawns a process with job based on the request it receives. It keeps the status and queue of the jobs in memory. The requests ...
Ondrej's user avatar
  • 133
2 votes
0 answers
1k views

Simple multithreading programing in Python to download file from AWS S3

I have written this multithreaded program to download files from AWS S3. Kindly review if it is a correct approach. Code works and downloads the files. But I see an issue occurring sometime (below is ...
VBJ's user avatar
  • 121
3 votes
3 answers
421 views

Spawning two threads and if any of the threads returns true, let the main thread ignore the other and move on

Exact problem statement: A main thread spawns 2 new threads, the main thread waits on this threads with these conditions: if any of the threads returns True, then main thread moves on and prints the ...
user2495123's user avatar
4 votes
2 answers
293 views

Thread Synchronization - CPU Usage exceeds 200 - C program

I have a working program that reads user input keys and echoes them back to the screen using the producer/consumer paradigm (the project requires you to use threads). While this program does work, it ...
user232489's user avatar
7 votes
1 answer
2k views

Speeding up Python program that converts DOCX to PDF in Windows

This is meant to be a performance-centric question as this type of conversion is obviously very common. I'm wondering about the possibilities for making this process faster. I have a program that ...
rabbittas2739's user avatar
4 votes
1 answer
649 views

C++ reimplementation of Python's threading.Event

I've reimplemented in C++ the basic interface implemented by Python's threading.Event class using a mutex and condition variable. I've inlined functions rather than ...
Eric Reed's user avatar
  • 143
2 votes
1 answer
1k views

Python timed input

I'm writing a python game-bot where a user needs to send in an input within a certain amount of time. My current implementation of this is to spawn a new thread that sleeps for that amount of time, ...
Ariana's user avatar
  • 153
2 votes
0 answers
45 views

Using go jobs with generic function

I use the following which works( I remove the unnnecery parts to the question) https://play.golang.org/p/OozjexJ4hZk The program is doing the following: run concurrent functions each function should ...
Rayn D's user avatar
  • 237
5 votes
2 answers
1k views

Implementing Multi Producer Multi Consumer Simple Thread Safe Class

I am learning C# and in the process I am trying to implement a multi producer consumer thread safe class. Can you please code review and point me to any mistakes I have made and improvements I can ...
anands's user avatar
  • 53
2 votes
0 answers
113 views

Sequential writing and reading (two threads)

I am new to Java. My task is to create a SequentalWriter class and a SequentalReader class that implement the Runnable interface....
user51515151's user avatar
1 vote
0 answers
19 views

calling Cancel() on CompletableFuture after get() is correct approch

I writing this code to leverage the advantages of Completable future. My doubt is call cancel() method after get() is correct approach? ...
Ramesh Papaganti's user avatar
4 votes
1 answer
3k views

Is my implementation of a C++ setTimeout thread correct?

I've implemented a setTimeout thread similar to the one in JavaScript (new to thread programming) In the example on this page I see use of an atomic variable ...
user avatar
5 votes
1 answer
326 views

C++ Thread Server: Thread control & management

So I created a thread server that creates threads and associates them with a handle so that you can keep specific threads for specific tasks e.g. run all graphics rendering on thread 0, run physics ...
charlie00_'s user avatar
4 votes
1 answer
2k views

TCP Multithreaded Server and Client C#

I created a TCP Server and Client and I really would like to know if its any good in regards of performance and code quality / safety. I hightlight the server and client class here. If you need more ...
HodorKing's user avatar
4 votes
1 answer
115 views

Java blocking queue download process scenario

I have the following scenario . I have incoming file download requests and each download is happening in different thread until pool size is exceeded. And after a download completed, a processor ...
Alan Ajax's user avatar
2 votes
1 answer
79 views

Keep reading user keyboard input if available, while echoing back the latest available

On StackOverflow I have asked a question a few minutes ago, but then by trying a bit more, I found the answer myself, and I'm posting the resulting working code here for review. What the code does, is ...
Enlico's user avatar
  • 547
4 votes
1 answer
77 views

Java 2 grouped thread scenario

I have the following multi thread scenario and the codes. It looks kind of messy and want to know if I can make it better or if there is any flaw to fix. When a request arrives, one thread downloads ...
Davis's user avatar
  • 53
1 vote
0 answers
51 views

Is volatile enough in this case?

Below is my app's start/stop procedure, start/stop code is handled by a single-threaded ThreadPoolExecutor, so I'm guaranteed there's only one thread can be active ...
WLTY's user avatar
  • 41
3 votes
1 answer
105 views

Login system using callbacks in android

I wrote a login system for an app I am developing, but I'm not really happy with the code I have at the moment. I feel like there is a better way at tackling a problem like this. In particular I'm not ...
RuuddR's user avatar
  • 131
3 votes
0 answers
246 views

Metronome in Rust, Audio Handling and Threading

for learning purposes (and I found it kinda useful), I built a very basic command-line based metronome in rust. It's the first actual smaller project I built in rust. It consists of 4 source files. ...
stekepego's user avatar
2 votes
0 answers
130 views

Producer consumer with shared buffer in C++11

My C++ knowledge is outdated and I'm trying to learn about C++11 threading. I'm working on a SoapySDR driver where the client acquires a buffer it wants to write to and the hardware transmits from ...
watkipet's user avatar
  • 161
4 votes
0 answers
198 views

Game of Life, thread per cell

In an effort to learn Java's support for concurrency I solved a self-imposed exercise to write a Game of Life simulator in Java, running a separate thread for each cell. Here is my code: ...
gaazkam's user avatar
  • 561
2 votes
1 answer
291 views

Multiple producer single consumer on the same thread

I implemented a multi-producer single consumer class, with an important restriction that once the consumer started working, it must continue its work on the same thread (the reasoning behind this is ...
Ron Klein's user avatar
  • 1,157
2 votes
1 answer
281 views

How do I make multithreading in sending large file from FTP to Azure large files faster

Currently, I have a code which downloads a file from FTP to local hard disk. It then uploads a file in chunks to Azure. Finally, it deletes the file from local and ftp. This code is very slow though. ...
Gauravsa's user avatar
  • 121
1 vote
1 answer
148 views

Thread which executes code after Thread.sleep() and can be cancelled only if it's sleeping

I use Java8, I have a subclass of Thread called DelayedThread which wraps a Runnable and executes the ...
Kohei Nozaki's user avatar
6 votes
1 answer
178 views

Extract text file from zip, parse content and post to azure queue storage

Problem I'm trying to create the most performant code to: Extract a text file from a zip parse its content serialize class post to Azure Queue Storage Scenario 4 times per year I receive 20 zip ...
Andy Schmitt's user avatar
10 votes
2 answers
577 views

A Server and Client Chatroom Using Sockets and Threading

I made a chatroom with a server and client python files, using Sockets and Threading as a project. I'm interested to acquire ...
user avatar
5 votes
1 answer
148 views

Double LinkedList Deep Copy in Kotlin with Generics and Thread Safety

Goal Return a deep copy of a double LinkedList. Each node also contains an additional random pointer, potentially to any node or null. Code to start ...
AdamHurwitz's user avatar
8 votes
0 answers
327 views

Implementing GSL synchronized_value

Core Guidelines mention a type synchronized_value<T>, which supposedly pairs std::mutex with the internal value. I couldn'...
Sergey Kolesnik's user avatar
3 votes
1 answer
105 views

Concerned about thread safety

I'm writing start/stop module for my application. I have a class that manages application life cycle and I called it Work. Work ...
WLTY's user avatar
  • 41
8 votes
2 answers
859 views

C# threading and synchronizing methods

So I started this question, I believe i have synchronized the methods correctly, need some insight on whats wrong and what should be done. I have to modify ths class Purse so that the method AddCoin ...
tyler j's user avatar
  • 81
4 votes
0 answers
139 views

Running DNS lookup over million IP addresses

I need to run over all the IP addresses on the CIDR 10.96.0.0/12 network. There are 1,048,574 IP addresses. I created a multi ...
E235's user avatar
  • 237
5 votes
1 answer
46 views

Prototype of background save facility

I have developed NoSQL database. At the moment it has no threads (async). When the database needs to save data to disk, it blocks connections until it saves. This method works OK, because save is fast ...
Nick's user avatar
  • 1,480
3 votes
2 answers
261 views

Implementing metropolis algorithm in C

This is my second C program (an improved version of the first one). I want to optimize this simulation. Algorithm The simulation algorithm is: The system can go from \$i\$ to \$i+1\$ with probability ...
Kartik Chhajed's user avatar
1 vote
1 answer
190 views

Thread-safe event-queue code appears to work, any possible race conditions, deadlocks, or other design problems?

Cross-Posted from Stack Overflow I am new to using condition_variables and unique_locks in C++. I am working on creating an ...
PMARINA's user avatar
  • 113
3 votes
0 answers
2k views

OpenCv webcam streaming class for WPF

My goal is to make a class that wraps the complexity of OpenCvSharp implementation to show a webcam streaming into a WPF Image. ...
user avatar
5 votes
3 answers
2k views

Ensuring threads running infinite loops are terminated before exiting the program

As a hobbyist programmer, I gain knowledge where I can find it from google searches. I tend to write code that utilizes threads that have infinite loops using while loops, where the while condition ...
Michael Sims's user avatar
5 votes
1 answer
346 views

Server in Python

I'm looking for a code review and code improvement for my own small server. The server accepts the requests: User Join,User Leave,User Text Notify Group Join, Group Leave, Group Notify Request Time. ...
me4gqp's user avatar
  • 51
2 votes
0 answers
789 views

C++ threaded task manager

I've been writing a little task manager in C++ in my spare time. It's also the first time I am posting here for a review, I hope someone can spot any mistakes. There's still a lot to implement and ...
frostbyte's user avatar
5 votes
2 answers
1k views

C++ multithreading logger class

I have designed a logger class to log messages to a file. It uses an independent thread to log the messages save to a queue previously using the main thread. I want to receive reviews about it. ...
asmmo's user avatar
  • 237
0 votes
3 answers
1k views

Fastest way to create random pixel image

I want to create a very big gigantic PNG image. The image pixel are generated randomly, being How can I improve the below code to create a fast random pixel image in java? ...
Hither Joe's user avatar
1 vote
0 answers
556 views

Lock free ring buffer

I am hoping that someone can take a look at my implementation of a lock-free ring buffer and critique the implementation. I'm hoping that the focus can be of the correctness of the atomic operations ...
Pete's user avatar
  • 11
4 votes
1 answer
699 views

Bank with factory method for accounts, multithreaded deposit and withdraw

I have a couple questions about this program Should I implement runnable instead of using thread class? I like the idea of the consumer and producer being thread objects, it seems simpler to me, but ...
James's user avatar
  • 43
7 votes
1 answer
295 views

Design elevator to get user commands and execute request based on current elevator moving direction (UP/Down)

I have created an simple elevator design for 100 floors building with just one elevator. I have dependency between classes which I want to eliminate, any thoughts/suggestion to make it more better in-...
Naveen Kumar's user avatar

1
3 4
5
6 7
32