Multi-threading is how work performed by a computer can be divided into multiple concurrent streams of execution (generally referred to as threads).

1,519 questions
Filter by
Sorted by
Tagged with
38 views

### Producer/Consumer Multi-Thread implementation - Is the solution correct?

I recently faced this following question in a Java coding round, needless to say I did not get a callback. So I want to know where I am going wrong in my solution and also what can be done to improve ...
1k views

### Multi-threaded web server serving HTML, images, etc

I have a web server that can send websites, images, mp3 and other things and I was wondering how I could improve the code and make the server more efficient. ...
150 views

### Sum of 2 arrays using multi threading

I'm trying to implement sum of 2 array using multi threading. I expected that when I use more threads it will be faster than when I use one thread, but that isn't the case. ...
389 views

I've implemented a thread pool using C++20. I'm fairly new to concurrently/multi-threaded programming and wanted to work on a project that I could learn from while also getting to know some of the new ...
66 views

### Multi-producer/single-consumer queue in Python

I am currently working on a problem that involves multiple producers and a single consumer through a queue object. The following list is about a few things that's special about this problem: One ...
57 views

### Real time histogram using multithreading (Qt + Qwt)

I'm writing a GUI for different VME modules (electronics). There are several of them which are used for the data acquisition. For example, an ADC produces the digitized maximum voltage on its input. ...
96 views

I'm implementing something of a thread janitor in modern C++. What I've got works, and while it's not organized in the way I'd like yet, I'd like some feedback on the fundamentals. Thank you in ...
78 views

### C++11 revised std::latch implementation

This question follows up on this question. After turning the while-loop into a conditional wait using std::condition_variable, I ...
55 views

### Implementation of a latch

As an exercise to learn more about multi-threading and atomic operations work in C++, I decided to implement a latch class in C++11 loosely based off of std::latch ...
73 views

### Printing odd and even numbers in separate threads C++

I recently saw a youtube video on printing even and odd numbers from 0 to 100 in Java. https://www.youtube.com/watch?v=eRNTx8k5cmA Thread 1 prints even numbers and thread 2 prints odd numbers. Both ...
55 views

### Showcase difference multiprocessing and threading in Python

This week I dived into the issue of speeding up my program by either threading or multiprocessing. I did not understand well the difference between the two, but that became quite clear when I got the ...
93 views

### 2 Threads taking turns printing the alphabet

I am supposed to write code for an assignment. The goal is to make 2 threads (which are objects of a class that implements runnable) take turns printing the alphabet. One of them prints upper case ...
28 views

### Mean and variance of element-wise distances in a set of multi-dimensional arrays in Matlab

This is a follow-up question for Calculate distances between two multi-dimensional arrays in Matlab. Given a set SX $$S_{X} = \{ { X_{1}, X_{2}, X_{3}, \dots, X_{n} } \}$$ where n is the count of ...
56 views

### Hashing with python optimization, hashlib and multiprocessing

I am looking to get any type of improvement, I want to be able to hash a list of 'blocks' aka strings and check if hashes match per block, if you can help me with that, currently reading and writing ...
71 views

### pointer jumping on a GPU using Aparapi

Classic pointer jumping algorithm summarizing values from an array adapted to run on a GPU instead of a PRAM. Read about openCL and Aparapi yesterday for the first time, so this is my first trial: ...
62 views

I have written a fully functional simple command line multi-connection downloader, written in Python 3, using just threading, ...
152 views

### A simple java game engine [closed]

I'm starting an object orientated game engine in Java. My plans for the engine is to be able to split things easily into multi-core loads. My idea is that a Unique (interface with a ...
44 views

### Avoid global variable due to executor.map()

I'm pretty new to python but after watching Mr Robot I felt inspired to make a CLI portscanner. With all the fancy console outputs you see in movies like a progress bar. It's finished and works nicely ...
62 views

This is my code: ...
58 views

### Validate Empty Sudoku: Multi-Threaded Solution

The problem is that we have an unsolved sudoku board, and we want to validate it, we need to check each column, row and sub-square. Here we represent a empty cell with -1. My idea was to create a ...
102 views

97 views

### Longest Palindromic Subsequence Multithread in C

I'm trying to learn how to multithread with c, and thought that the longest palindromic subsequence problem would be a good place to start. The idea is that we run two threads and compare their ...
83 views

### Thread-safe collection to store Member objects [closed]

This is poorly written Java code, intended to implement a thread-safe collection to store Member objects and failing at doing so. ...
35 views

### Thread-safe running mean and variance

In one of my personal python libraries I have a custom class used for computing the running average and variance of a stream of numbers: ...
40 views

### Daily coding problem: Job scheduler invoking a function after specific time

This is a problem from Daily Coding Problem. I have implemented it in Java. For a function f I have used Runnable interface. ...
109 views

### C++ producer-consumer using blocking buffer

I'm working on a programming exercise (university, nothing related to industry) which basically asks to implement a Buffer to be used by two threads (a producer and a consumer). The first one enqueues ...
32 views

### How to check gcp pupsub empty/inactitve subscribtion

I have an application that subscribes to a topic in GCP and when there is some messages over there it downloads them and sends them to a queue on ActiveMQ. In order to make this process fast I am ...
219 views

### Using multithreading to send multiple emails

I'm trying to send any number of emails in the shortest amount of time using .NET 5.0? I've been playing with something like the following but I am not sure if it is optimal or even correct as there ...
110 views

### An async time-based rate-limiting semaphore for C#

This is a class that allows only limited number of requests to proceed per period of time. This is designed for use with external APIs that require such rate limiting, e.g. 600 requests per 10 minutes....
105 views

### Python best practices to impletent QThread, progressbar (pyqt5) and sniffer (scapy)

I'm new in python and I want to know the way to improve this code with best practices. I'm using PyQT5 to create new thread In that thread I'm using scapy to sniff traffic and filter ARP traffic to ...
33 views

### Rust program to create mail.tm accounts

I have created a rust program to create https://mail.tm accounts, but I think there are things I could have done better. Are there things I can do to improve performance? Are there any unnecessary ...
2k views

### C++ lock-free, MPMC Ring buffer in C++20

I have some performance critical inter-thread messaging code in C++. Multiple producers, one or more consumers. Profiling dozens of iterations of this messaging code over several years of development, ...
85 views

After the amazing feedback from these questions; I have prepared a third version of the original posted code. The Idea is the same: An std::size_t variable ...
89 views

Edit: An improved code based on feedback is available here. As a kind of sequel to the previous question, here is an improved version( with clarified naming ). The Idea is the same: An integer ...
90 views

### A file system watcher class for on-fly file reloading when it has been modified

I wrote a file sytem watcher class that is used to monitor file modification and then execute user-defined handler. Other file system events like moving or deleting don't need to be monitored. The ...
262 views

A new version of this code based on the provided advice can be found here. Latest improvement is found here. I made a simple ThreadPool implementation in C++ using ...
198 views

### Thread-safe LRU cache in Python

I've written a simple LRU cache class and I am trying to make it thread-safe. My thoughts are that I just need to wrap the code that updates the ordered dict in a lock so that if any thread is writing ...
54 views

### Particle swarm algorithm with multiple threads

I wrote a simple multitthreading program which does particle swarm optimization. Optimization itself and some corresponding functions were taken from https://nathanrooy.github.io/posts/2016-08-17/...
25 views

### Building a generic WebSocket component in Python

I have the following working code for a generic WebSocket component: ...
179 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 ...
573 views

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? ...
105 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 ...
111 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 ...
93 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 ...
42 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 ...
256 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 ...
138 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 ...
213 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 ...