Multi-threading is how work performed by a computer can be divided into multiple concurrent streams of execution (generally referred to as threads).
0
votes
0answers
28 views
For loop is running for so long as it process 6000*2000 records
Down is my code on which I am working. Here testWorkflowResults size is 6000 and computSearchResults size is 2000. So my loops ...
2
votes
0answers
26 views
Make one greenlet tell another to shutdown
I am building a commandline app to check proxies, which has a daemon flag (running forever or just once).
There are producers, checkers and storers. I want them to run in parallel and be able to ...
0
votes
0answers
17 views
Multithreading external k-way merge sort
The task was to implement multithreading external sort:
...
1
vote
2answers
51 views
Multithreaded brute force prime generator
A number is a prime when it is divisible by 1 and the number itself. To check if a given number is a prime we can divide the number by primes which are less than the square root of that number. If ...
2
votes
0answers
27 views
Writing a file sequentially
I've written a procedure which allows serialized writing of a stream. I don't in any way consider this done, but this is the beginning of it. I know there are other implementations out there like this,...
4
votes
1answer
123 views
Start an EventHandler in different Thread
I just stumbeled accross some code and I would do it in a different way. Since I am quite new to programming, I just wanted to know if I understand it right.
Original Code:
...
1
vote
0answers
34 views
Wikipath stack in Java - Part I/IV - The search algorithm
I am working on the following small software stack:
The objective of the entire stack is to search for shortest paths in the Wikipedia article graph as fast as possible. As of now, I rely on two ...
0
votes
0answers
30 views
Finding vowels, digits, whitespaces and consonants
i am creating a simple app to find vowels, digits, whitespaces and consonants. the basic idea is to practice multi-threading and writing readable code.
So here is the code:
...
6
votes
1answer
50 views
Counting K-mers (words) in a sequence string
I recently found out how to use joblib for parallelization. I want to iterate through this string seq in steps of 1 and count ...
2
votes
1answer
42 views
Producer/Consumer implementation using condition_variable
Trying to implement producer/consumer problem in C++. I have one question: should I use nofify_all or notify_one method here? ...
1
vote
0answers
15 views
Ping Pong Cryptor - A Toy app in Javafx
I am creating a toy app to understand Multi-threading in Java. The app is on Github.
i have pasted the relevant code to be reviewed.
Questions:
Am i violating any OOP Principals ?
Is it readable ?
...
3
votes
2answers
74 views
Multi threading with webrequests/responses
I have been working with multi threading and would like some feedback on the code, i generally suck at class design/OO which i am trying to improve. Im sure there is a better way of making it neater ...
8
votes
1answer
46 views
Automated Safety System Daemon in C89
Explanation
This software is currently designed to:
Spawn a daemon which controls and monitors multiple threads
Create threads based on a 'list' of functions
Monitor threads for operation
Restart ...
7
votes
1answer
97 views
Multithreaded Decompression
I'm working on optimizing a class for decompressing Mass Effect 3's .sfar files. .sfar files are archives, and this function decompresses a file from inside an .sfar and writes it to the provided ...
6
votes
2answers
330 views
First simple multithreaded application
It's been quite some time since I got my eye on the multi-threading, today I decided to create a really simple application which runs 2 while loops simultaneously and prints the current progress of ...
4
votes
2answers
38 views
Class member method based multithreading [C++]
In briefly: I'm working on a little chat program just for fun.
I am using threads to control two main parts of the application. I am making a socket controller class based on the following design:
<...
4
votes
2answers
78 views
Passing variable to BackgroundWorker and use the same value later
I create multiple BackgroundWorker within a for-loop and each of them needs to know a special value. To simplify, it is just <...
5
votes
2answers
94 views
Atomic floating-point addition
I need to be able to atomically add a 32-bit floating point value to a location in memory. Here is what I came up with. While the code is Windows-specific, I'll extend it with Linux support using <...
5
votes
1answer
110 views
File downloader using Java, multithreading and HTTP Range request
I'm making a file downloader using Java. The project is on GitHub; I have included the most relevant excerpts here.
I separate the file into parts and download them using HTTP Range request, with ...
4
votes
3answers
55 views
C Threadsafe Priority Queue O(log n) push, O(1) pop
I wrote this for an A* implementation:
(pqueue.c)
...
3
votes
0answers
28 views
Concurrently identify duplicate files from size ordered list
Following on from my program to identify files that have common file sizes, I have developed an application that takes the output from that process and then compares each of the files that are the ...
6
votes
1answer
161 views
Update bitmap in picturebox with data from a socket
I'm working on a screen sharing project, and I receive a small block of images from a Socket constantly. I need to update them on a certain initial desktop bitmap I ...
3
votes
2answers
54 views
Make all additional threads return from a method using Interlocked.Increment
I need to ensure a method is executed only by one thread at a time. Contrary to what most of the synchronization primitives do, I don't need other threads to wait, I want them to return from the ...
6
votes
2answers
281 views
Simple dispatcher implementation
I need a simple dispatcher implementation(invoke methods on one thread from many threads)
once you dispatch method curent thread should wait for results, so I'm thinking about something like this:
<...
0
votes
1answer
49 views
How to avoid carrying around a lock with my variable when multiple threads instantiation in Python?
I created an application using multiple threads defined in multiple class files which read and write into a "shared variable" (a dictionary).
To ensure thread-safety, I am using a Lock, and I pass it ...
5
votes
2answers
543 views
C++ thread safe log file writer
I made this class (MFC lib) to write a log files. Eventually I want to implement this code in a thread safe way.
Log.h
...
5
votes
0answers
95 views
SVG mosaic creator
Although my code works as expected, there are a few gotchas.
A single row is not filled at once; instead, I can see partially filled rows during the rendering process(Fixed in the updated code below....
0
votes
0answers
41 views
Ruby thread pool implementation
I'm in the process of adapting the simple thread pool described here to my application. I'm new to concurrency in Ruby, but here is what I have so far:
...
3
votes
1answer
516 views
Sorting seems to be slower with 2 threads instead of 1
I'm implementing a simple merge sort to practice with Python's Threads. I've tried to split the job into two threads, that sort normally, then I can join them and merge the result. However, it takes ...
0
votes
1answer
46 views
Multi Producer - Single Consumer
I have written multi producer single consumer code with bounded buffer. Please review the code for any improvements or mistakes.
...
0
votes
0answers
28 views
Parallel Hillis-Steele Scan using CUDA
I'm learning CUDA (and C to some extent), and one of the algorithms that I am learning is the Hillis-Steele scan algorithm. I wrote a program that performs a simple scan with adding.
After seeding ...
5
votes
1answer
69 views
Reuseable C++11 Thread
I'm learning about threading support in C++. I've got a basic understanding of thread-pools and why creating and destroying threads on some systems can be expensive. As far as I'm aware C++11 doesn't ...
2
votes
2answers
153 views
Thread synchronization wait/notify
I need to run several identical threads. All threads must wait to do their job, until all threads are running (alive).
I use wait/notify to synchronize: when a thread is created it waits until it ...
4
votes
2answers
101 views
Multi threaded text-based tetris game
I have decided to make a game of text-based Tetris in C.
At first I had no idea how to start so I settled for threads.
Each thread moves its own piece down the grid and all the main thread does is ...
2
votes
2answers
152 views
How do I write my multithreading code correctly so that it is faster than a single thread?
I have the following code that I am trying to optimize. I am running it on a Linux machine with 24 cores. I thought I could use multithreading to make it faster, but it's somehow making it way slower ...
1
vote
1answer
59 views
Multithreaded Producer-Consumer pattern
I have Producer Threads A, B and C producing 3 different types of events Events A, B and C respectively. The Consumer thread can ...
4
votes
3answers
133 views
Producer/consumer problem with four priority levels
Here you can see a mediocre code of mine where I have fun with four deques, each with a different priority.
Here is how it works: in a ...
7
votes
1answer
101 views
Project hotel reservation in Python with OOP and multithreading
I have to create a project in Python 3 for a university exam. The project involves the use of object-oriented programming and the use of multithreading. My project is based on the simulation of ...
4
votes
3answers
131 views
3
votes
1answer
45 views
Run multiple prerequisite methods in parallel before continuing
I have an application in which I have multiple slow running prerequisite methods I need to call in order to have the data I need to continue.
To try to speed this up I am doing this:
...
3
votes
2answers
124 views
Counting multiples of 3 or 5 using threads
I have a modified version of the first Project Euler problem — where I find the sum of all the numbers below the value 2100000000 that are multiples of 3 or 5 using a multi-threaded program.
The ...
1
vote
0answers
38 views
Run a potentially long running application from within a Python webserver and return different results depending on whether the application finishes
I want an API on a Flask/Gunicorn webserver to make a call to a separate, potentially long-running java application. If the java application finishes before the Gunicorn timeout, Flask should return ...
3
votes
1answer
54 views
Mandelbrot image generator with parallel iteration
I'm currently trying to optimize this class I have for fractal generation. The equation is meant to be pluggable; I have used z => z*z + c so that it's not using ...
5
votes
0answers
33 views
Multiple rusty Sieves of Eratosthenes
To get more familiar with the multi-threading aspects in the Rust language I decided to multi-thread my earlier implementation of The rusty Sieve of Eratosthenes.
I have to say that it is probably in ...
3
votes
1answer
69 views
Simulating memcache get and set race condition and solving it with add
Memcache get and set can hit a race condition if you use them together to achieve something like locking because it is not ...
5
votes
1answer
160 views
Simple Background Thread Worker Class (follow-up)
This is a follow up of Simple, generic background thread worker class
What changed?
Moved from synchronized lazily evaluated static instances to true Singletons per the on-demand holder idiom https:...
1
vote
1answer
113 views
Skeleton of a Multi-threaded web crawler in Java
I am trying to prototype a simple structure for a Web crawler in Java. Until now the prototype is just trying to do the below:
Initialize a Queue with list of starting URLs
Take out a URL from Queue ...
5
votes
2answers
86 views
Thread synchronization with mutex
This program prints odd numbers by thread1 and even numbers by thread2 sequentially. Can this code be optimized or made more ...
-2
votes
1answer
28 views
Capture some state in Haskell
I want to capture some state in a Haskell function. For instance, I have many thread trying to print on the console and I want the to play nice with each other. So I want to have some XX to make the ...
1
vote
0answers
57 views
Parallel integer tree sort algorithm in Java
Introduction
In this post, I will present a parallel sorting algorithm for sorting primitive integer arrays.
Treesort
Treesort is an algorithm which iterates over the input array and constructs a ...