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

learn more… | top users | synonyms (2)

2
votes
0answers
24 views

Multi-threaded webserver

Edit: I've been told my queue is not thread safe. Could I get some pointers on what I could do to fix it? Or an example of a thread safe queue? Can I get some help optimizing this webserver? Simple ...
3
votes
0answers
28 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
53 views

Multi threaded bottom up merge sort 3x as fast as single threaded?

Before I tried this, my impression was that (bottom up) merge sort would be memory (actual ram) bound, and not affected much by multi threading, but a 4 thread sort is about 3 times as fast as a ...
3
votes
0answers
13 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
31 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 ...
3
votes
0answers
37 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
128 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 ...
2
votes
0answers
24 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
34 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
74 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
103 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
95 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
62 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
100 views

Simple scoped lock

I've implemented a simple scoped lock like this: ...
1
vote
1answer
42 views

'PostRunnable' implementation in Java [closed]

I know that there any many, many topics and I really read a lot of them, but I have a question about a thing that I couldn't find anywhere. I'm trying to create a ...
3
votes
1answer
116 views

Read and write in C# buffer in parallel

I have a buffer - int array with defined length. I want to read and write values into this array in parallel. For instance, 5 readers and 3 writers with different ...
0
votes
0answers
32 views

Generic C++11 Thread Pool Implementation

I have written a fairly simple thread pool and I am looking to see if I have missed an crucial threading problems that might arise. ...
3
votes
0answers
38 views

Achieving thread safety in a payment service library

I wrote this code a while ago, which is an excerpt of a payment service library: ...
5
votes
2answers
98 views

Generic thread-safe data structure

I wrote the following class so that a single object can be shared across many threads. Is using the ReaderWriterLockSlim redundant in this case and only ...
1
vote
1answer
73 views

Using Concurrent Dictionary and Lazy<T> to cache expensive query results and only run query once in a threadsafe manner

Ok, so I'm querying a webservice. This webservice is slow with multiple o's. I want to cache the results of the query, because I only want to query on a given set of parameters once during my ...
1
vote
2answers
109 views

C++14 Thread Pool

I have written the following thread pool implementation in C++14. It appears to work fine on my system, but I am looking for a second opinion on the thread safety of my implementation and any other ...
4
votes
2answers
101 views

C# multithreading console app

I making simple multithreading signature program (it calculate SHA256 hash for parts of file). Please check my code and I would be grateful if you tell me about errors in my code Program.cs ...
91
votes
17answers
12k views

Disproving Euler proposition by brute force in C

I wrote a little bit of code to brute force disprove the Euler proposition that states: $$a^4 + b^4 + c^4 = d^4$$ has no solution when \$a\$, \$b\$, \$c\$, \$d\$ are positive integers. I'm no ...
3
votes
1answer
80 views

Deadlock watchdog for shared structures

In our application we have data which needs to be shared between multiple threads. Now and then we ran into a race condition and we could not figure out where that was. So I have implemented a ...
0
votes
0answers
15 views

Reading keyboard strokes using multiple input threads

I have a command line program which reads input one character at a time. The following code is working, and if I press three keys at once they will all be printed. There are four questions here: why ...
1
vote
2answers
65 views

C++ 14 thread pool executor design

With a few experience of python and golang, I tried to make (simple) thread pool executor. Tasks of the executor must be copy-...
0
votes
0answers
18 views

Alternate approach in processing huge array using multithreading [closed]

I am new to multithreading in Java. I have implemented a multithreading program in Java to process an array and need your help and suggestions to optimise it and refactor it if possible. Scenario ...
3
votes
0answers
73 views

Blocking TCP Client with Threads vs. Non-Blocking TCP Client with Unitys Update

I'm not sure if this is the right subsite of stackexchange because it's not only about code review but a bit about design eihter. I'm currently developing a network application. I need to connect a (...
3
votes
1answer
68 views

Streaming floating point data in Python2

I am in the process of creating a brain-computer interface, and one task is to stream electroencephalograph (EEG) data into a Python script for real-time analysis. Included in this question are two ...
3
votes
1answer
78 views

Multithreaded Python implementation of a Sudoku validator

I've just come across these day with the multithreading subject in Python. I remembered @200_success's answer and I thought of making that multithreaded as it follows: one thread to check that each ...
5
votes
2answers
94 views

C# ThreadPool inplementation

I have implemented some methods to make the creation of multithreaded programs easier for me in the future The requirement was: Be able to add as many Tasks as I need to the pool Be able to restrict ...
2
votes
2answers
117 views

Print consonant and vowels

My assignment is to to create two threads running functions (called vow and cons). The threads take turns printing the respective words of the phrase supplied from a text file. The main thread shouldn'...
1
vote
2answers
70 views

Blocking and non-blocking queue

I came up with the following for a blocking and non-blocking queue implementation. Please suggest any changes/improvements/gotchas. Blocking queue: ...
4
votes
1answer
105 views

Consuming chunks from ConcurrentQueue

I need to implement a queue of requests which can be populated from multiple threads. When this queue becomes larger than 1000 completed requests, these requests should be stored into a database. <...
3
votes
1answer
85 views

Multi Threaded Server client communication where clients can signal the Server to shutdown

I have 3 classes: Server, Client, RequestHandler It's about reading out commands and executing them What the programm does: 1) The Server starts, opens a ServerSocket and starts listening for Clients ...
1
vote
1answer
81 views

Job queue with threading

On many articles and blogs, I have read that exceptions should not decide flow of your code. I have wrote the following code using one thread: ...
1
vote
1answer
73 views

A class for handling chores

I have created a class which handles (what i call) idle chores. These chores need to be executed every x seconds (x is random every time but within a certain range defined in the settings) With this ...
5
votes
1answer
809 views

Download Images as fast as possible

I have a spreed sheet and its something like 550+ columns and I need to pull URLs from it. Previously I was using LinqToExcel when the sheet was less than 255 columns a recent update has produced this ...
1
vote
2answers
94 views

C++ thread safe queue implementation

I'm using this class for producer-consumer setup in C++: ...
2
votes
0answers
74 views

Network Bandwidth Usage Monitor

I have written a very basic bandwidth usage monitor in C++/winpcap. I would like to get some feedback, regarding design choices, implementation, style, correctness. (Or anything else you care to ...
4
votes
2answers
94 views

Parallel quicksort algorithm taking way too long

Below is a Python implementation of the quicksort algorithm using parallelism. It takes about 1 second per every 10 items in the list, which is hilariously unacceptable. Why is it so slow? ...
2
votes
1answer
61 views

Using a new thread to post to observers

I have implemented my own Observer pattern. I want to post my events in a new thread. This thread would simply call all the the observers/listeners with the posted event. ...
2
votes
0answers
92 views

Multithreaded download of images from a spreadsheet

I've been wanting to go async with my HTTP calls but all the methods I tried have not worked, so I resolved to implement this as a task and then improve upon it. This is what I've come up with so far....
1
vote
0answers
42 views

Thread pool based unweighted path finder in Java for graphs with slow expansion operator

Introduction Given a directed unweighted graph, the objective of this library is to find a shortest path from a given source node to a given target node. Clearly, one candidate algorithm to find ...
0
votes
0answers
36 views

Lazily load permissions from database in multithreading environment

I would like to get the feedback about this code: ...
2
votes
0answers
66 views

Safest Connection pool in Java

I have read the code reviews on this website: this one and this one So creating the pool in itself might not be that difficult, I'm more worried about the client closing the connection or the ...
2
votes
2answers
81 views

Thread-efficient nonce generations

I need to create unique nonces for cryptographic purposes in a library that I am writing. If the nonces ever fail to be unique, the consequences may be up to and including remote execution of ...
3
votes
0answers
58 views

Rust publish/subscribe channel library

I've written a simple multiple-sender multiple-receiver channel, but I'm unsure if my approach is the best way to do this. I'm not using multi-threaded primitives but instead wrapping around std's ...
5
votes
2answers
82 views

Monte-Carlo method to estimate Pi runs slower in multiple threads, than in single thread

I'm learning Scala, and I wrote a program to estimate the value of Pi. When I'm using multiple threads, it takes 5-6 times longer to calculate the same iterations. I wrote a similar program in Java, ...
2
votes
2answers
105 views

Relaying stdin data from one thread to another

I'd like to know if this piece of code is thread-safe. I'm learning something about threads, queues and synchronization, and I'd like to make sure this is correct, before moving forward to next step. ...