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)

5
votes
0answers
47 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 <...
3
votes
0answers
41 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
39 views

C Threadsafe Priority Queue O(log n) push, O(1) pop

I wrote this for an A* implementation: (pqueue.c) ...
-2
votes
0answers
18 views
3
votes
0answers
24 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
142 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
49 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
263 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
30 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
508 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
85 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
32 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
502 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
40 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
22 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
63 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
144 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
99 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 ...
-1
votes
0answers
53 views

Find the possible mathematic expressions from the given integers to evaluate a value

How can I decompose this code into multiple threads so that it can run in parallel and enhance the efficiency (speed)? Can anyone suggest how I can use OpenMP here and where I can apply an OpenMP ...
2
votes
2answers
148 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
52 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
128 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
99 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
123 views

Exclusive access to objects

Take a look at following code: ...
3
votes
1answer
42 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
123 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
29 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
51 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
66 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
158 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
92 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
82 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
26 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
53 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 ...
2
votes
3answers
90 views

C++11 Blocking Queue learning exercise

As part of my own C++11 learning exercise I have implemented this Blocking Queue using the new C++11 thread API. One of the aspects I would like to improve is efficiency i.e. in the ...
1
vote
1answer
70 views

Improving GUI update call from a worker thread in winforms

I have a winforms app and I've been using the following approach to update controls on the main form from worker threads: GamepadManager class has: ...
1
vote
4answers
377 views

Reading HTML files, removing HTML tags, and writing content and summary to a file

Write a multithreaded C++ application (executable) for Windows Platform. This program uses the two threads to read and process the input data and store it into an output file. Candidate is free to ...
3
votes
3answers
570 views

Finding the tree height in Python

I'm trying to get an efficient algorithm to calculate the height of a tree in Python for large datasets. The code I have works for small datasets, but takes a long time for really large ones (100,000 ...
0
votes
0answers
43 views

Block a partcular machine for a particular period of time interval after x failure

This is an extension to this question I am working on a library which makes Http call to my service. I have below two requirements: If my service machine doesn't respond back (there is a socket ...
1
vote
2answers
135 views

Dynamic Multi-threading lock with while loop

I have already asked a question about a dynamic multi threaded lock, and the reviewer found a problem. Here is the description of the problem that I need to solve: I need to create a structure ...
3
votes
1answer
85 views

Dynamic Multithreading lock

I need to create an structure to control dynamically locks. For example, I have 100 threads running, and each thread will "process" a "key". Sometimes two threads could be processing the same "key", ...
2
votes
1answer
88 views

Custom countdown timer class to replace the Android CountdownTimer

This project was made to replace the stock Android CountdownTimer class. It is more responsive when completing the timer and adds additional functionality such as ...
5
votes
2answers
370 views

Android splash screen

I have implemented a splash screen, to hold/pause the screen for few seconds and then launch the next screen. I am very enthusiastic to know if there is a more basic way to write the code. ...
0
votes
0answers
34 views

Livelock simulation

I want to understand how Livelocks happen and also how to translate my thought in to working code. I have written the following snippet to simulate a livelock between two persons passing each other in ...
10
votes
1answer
353 views

Efficiently using Apache HttpClient in multithreaded environment

I have a library which is being used by customers and they are passing DataRequest object which has userid, various ...
2
votes
0answers
40 views

Automatic resource allocation for the purpose of resource-dependent task scheduling

Here is what I'm trying to accomplish: Suppose you are trying to control an embedded system with several external hardware resources/components/devices. Naturally, you are concerned with the issue of ...
1
vote
2answers
80 views

Small C++ thread pool

I've made a small thread pool that i'll be using to communicate with a Redis server: ...
2
votes
0answers
20 views

Using RemoteChannels for an parallel iterable map

RemoteChannels hit with julia v0.5 There are no examples online, but I managed to get them to work. They are still very new, and all this whole area of multithreading code continues to have running ...
1
vote
0answers
28 views

Loading sub items of TreeView in background

I am working with a TreeView (default control from .Net Framework) that displays hierachical data. Data are bound to the view using MVVM pattern with the ...