Multithreading is how work performed by a computer can be divided into multiple concurrent streams of execution (generally referred to as threads).
4
votes
1answer
77 views
Inefficient Stopwatch
I have just finished a simple GUI stopwatch, but some of its code looks like it needs replacing. This is the code:
Clock class (extends Thread):
...
1
vote
0answers
14 views
Displaying a scrolling stock exchange ticker in a window
I've written my first OOP program (194 lines including docstring and comments) in Python that uses Tkinter as GUI and Threads. The program shows a window and displays a scrolling stock exchange ...
2
votes
1answer
36 views
Implementation involving POSIX, semaphores, and locks
I am trying to get over my fear of multithreading programming and teaching myself to code using POSIX. I wrote a small version of the consumer producer problem. I am hoping I can get some feedback if ...
0
votes
1answer
56 views
Command line multipart or single file downloader
I am looking for a code review for this multipart or single file chunk downloader using threading and queues.
downloader.py
...
3
votes
1answer
75 views
Maintaining a car collection list in a multithreaded application
I have a multithreaded application for web scraping from an automobile website. While performing web scraping, there are many links that gives the same result, so I have to check for data redundancy. ...
1
vote
1answer
42 views
Concept for saving context information
My Problem
I have a library containing business logic which is being used from 3 different projects:
Website
Local WPF Application
WCF Service
The library uses Entity Framework and a connection ...
1
vote
1answer
51 views
Will this act like a ThreadPool? [closed]
I know that until the n threads will not complete their jobs, the new jobs will not be assigned, but will this code be thread-safe and execute ...
1
vote
1answer
51 views
Split download file buffer by any number of threads
This is my first attempt at splitting the download buffer into several threads by the number provided. I want to improve on performance and better implementation approach.
...
6
votes
1answer
104 views
Simple chat console app
I wanted to practice using sockets and multithreading. This is simple code where I start a Server and connect to it via Client ...
2
votes
1answer
36 views
PPL and AMP performing worse than sequential transform
I wrote the following short test code to test the performance of C++AMP and the PPL libraries against the sequential STL implementation of std::transform. To my ...
3
votes
3answers
75 views
Threadsafe get method on queue that draws values from other queues?
I have a class that implements Queue and draws values from other queues which may still be referenced outwith it. I want my method to draw values from the contained queues, using synchronized locks on ...
2
votes
0answers
48 views
Usage of Interlocked.CompareExchange for deciding whether a property has been changed by another thread
I'm developing a Windows Servise that receives data from somewhere and saves it to DB one time per 5 minutes. The Service is multithreaded and I actually got problems when several threads saved data ...
5
votes
1answer
69 views
Consumer-Producer Problem: POSIX Thread
I have implemented a producer consumer problem,
following the resources below:
Oracle doc
CSEE
I have used mutex_t and ...
3
votes
1answer
46 views
Uploading a video in S3 Using Future
I've posted a similar program previously, but I have not made any major modifications in the code, so I am posting it again by deleting the previous question.
I am afraid of the thread keyword and I ...
0
votes
2answers
75 views
Python UDP-server and JSON parser script
I am a python beginner. I wrote a script which should run on a raspberry PI as an UDP server. It is reading and writing to a serial device and has to process and forward JSON strings too.
Because ...
2
votes
1answer
44 views
Cross Thread Access to Object in ViewModel
This is a fairly straight forward question. I have a C# WPF MVVM application that call a C++ DLL to do some compilation/crunching. To update the UI C# application for progress updates I am using ...
21
votes
3answers
2k views
What are the best practices with multithreading in C#?
For a while I have been interested in seeing if some tasks work well when split across multiple threads.
On the one project I have been busy with I have been creating a lot of small utility apps, to ...
4
votes
1answer
99 views
Platform independant thread pool v4
This is a continuation of this question.
Following the previous advise, the thread pool now can handle almost all types of input, except for one key form, where the function/functor requires one of ...
4
votes
2answers
236 views
Creating a cache manager
I am purely new to C++ memory management. Am I on the right path, or should I employ a different design strategy or a different memory manager policy (such as ...
4
votes
2answers
64 views
Function object passing for a task scheduler
Here is my full implementation of a generic Functor-like class:
...
4
votes
0answers
225 views
Multithreaded file downloader using threading and signals
This is my first attempt to write a multithreaded application that downloads files from internet. I am looking for improvement in code, logic and better strategy for implementation.
Please ignore the ...
3
votes
2answers
63 views
Platform independant thread pool v2
This is a continuation of this question, v3 can be found here
Taking into account the advise given by Loki, an implementation of the threadpool using a ...
8
votes
1answer
92 views
Platform independant thread pool
v2 of this question is here and v3 is here
To get a better understanding of C++11/C++14, I thought I would develop a thread pool, even if it has been done to death!
The only dependency outside of ...
9
votes
1answer
170 views
Thread-Safe Integer Sequence
I would like to give an Integer to whatever demands it. For that I use the following code
...
1
vote
0answers
27 views
Mutualising multi-threaded calls to EJB from Servlet
I have a Servlet that makes an EJB call to a backing server which takes about a second to return some data that changes reasonably regularly.
I can't cache the data on the Servlet-side, so I have ...
6
votes
2answers
613 views
A simple semaphore in Java
It is a simple semaphore in Java. Although it passes all their tests with flying colors, I'm still not sure it's correct.
For example, the last thing I wasn't sure about was ...
1
vote
0answers
34 views
Moonshot & `Thread.Abort` - dealing with the fallout
Recently, I encountered an anomaly in the manner by which a worker thread was terminated. It prompted me to do some searching and I realized that I was constructing thread code in a haphazard manner. ...
4
votes
2answers
133 views
Concurrent blocking Tasks in a BackgroundWorker
I'm using a StaTaskScheduler (TPL extension) to open some web browser windows simultaneously and navigate to different sites (using WaitN, but it might as well just be a ...
5
votes
1answer
59 views
Scalability of C server implementation based on pthreads
I am wondering about the feasibility of the following basic implementation of a server and how well it would scale. I know that large-scale, distributed servers should probably be written in a ...
6
votes
4answers
89 views
Calculation of e performance issue
Can you give me some idea how to optimize the switch statements, maybe a for or do while ...
1
vote
1answer
109 views
Thread-safe callback registration and invocation in C++11
I need your help in reviewing the following code. My main concern is dead-lock, but there might also be other issues.
The EventGenerator object is owned by a ...
2
votes
1answer
32 views
Proxy using socket, doubts on multithreading and connection closing
I'm trying to make a simple proxy server in Python using the socket library, mostly to understand how it works. I'm a noob both at programming and networking, so please be nice if my questions are ...
3
votes
0answers
89 views
Concurrent queue
I recently wrote a concurrent, mutex-less (but not lockfree) queue and wanted to know if it is actually correct, and if there are any particular improvements I could make:
...
9
votes
2answers
350 views
Using synchronized blocks and volatile variables to ask a Java thread to terminate gracefully
Edit: Just to clarify, this isn't my original code, I've simplified it to make it smaller/easier to understand what I'm trying to do.
It's my first time working with threads in Java, and I was ...
3
votes
2answers
194 views
Slow data-processing and inefficient memory usage in .NET containers
I am writing a text classifier and in order to do so I need TF/IDF values per every word of my signle text. Then I need to use the cosine similarity:
\$similarity = cos(\theta) = \dfrac{A \cdot ...
9
votes
1answer
128 views
My first multi threading class
I've thrown everything I can at this, and I can't get it to lock or crash. My hope is that I have applied the principles correctly. I write client apps in JavaScript, and this is only the 3rd .NET ...
2
votes
1answer
83 views
Threaded pipeline
I have a threaded pipeline with single producers and (possible) multiple consumers. A producer might wait or not, depending on the policy provided. A problem here is valgrind (helgrind) is reporting a ...
4
votes
5answers
513 views
Circular queue implementation
Implemented simple thread safe circular queue. Looking for code review, optimizations and best practices.
...
1
vote
1answer
102 views
Multi threading in ASP.Net to increase performance of processing data from entity framework using anonymous types
Intro
I am trying to populate a Multi-column Combo-box with a large amount of records.Depending on the selection the user has taken there can be 1 - 50000 items in the Combo-box (I may not display ...
7
votes
2answers
137 views
Optimize a parallelized program to optimize train schedules
This loops through a vector of vector of A and adds a smaller array to a bigger one at a specified position+random shift. Then it is checked if it is a better solution, and if yes, it is stored, else ...
2
votes
0answers
62 views
Having functions run on different threads
I would like to know if there is a more optimal/efficient way of having some of my functions run on a different thread. When a user clicks a button, the program will either:
...
5
votes
3answers
274 views
Multiple background tasks
This is taken from my post at Stack Overflow here.
I need your help to review my code for improvement and best practice.
...
3
votes
1answer
65 views
Sequential Thread Execution using wait() and notifyAll()
Problem Statement:
T1, T2 to Tn threads prints numbers up to N such that each threads
prints number in circular sequential fashion. T1 prints 1, T2 prints
2, T3 prints 3 and T1 prints 4 again ...
6
votes
3answers
153 views
Is my below code thread safe w.r.t all the main application threads should get consistent data?
I am working on a project in which I construct a url with a valid hostname (but not a blocked hostname) and then execute that URL using RestTemplate from my main ...
4
votes
2answers
42 views
Download URL from clipboard
This is a Python script I made to download a URL from the clipboard.
When a new URL is copied to a clipboard it adds the URL to a download queue, then on a separate thread it downloads the URL to a ...
3
votes
2answers
80 views
Asynchronous Pattern
I have an n-tier solution which consist of DAL,BL and a ASP.net WebAPI project. I'm new with Asynchronous Pattern and I'm trying to add it to my Framework. Am I doing asynchronous pattern correctly? ...
7
votes
2answers
115 views
How to make sure all the threads are getting consistent data without performance impacts?
I am working on a project in which I construct a url with a valid hostname (but not a blocked hostname) and then execute that URL using RestTemplate from my main ...
0
votes
2answers
92 views
Continually process results of multi-thread worker [closed]
Let's say we've got some SQL queries and want to display the results. Processing takes some time, so I do it multi-threaded.
The following works quite well for me. I reduced the code to the important ...
3
votes
2answers
77 views
Thread-safe queue
I need a thread-safe C++ queue. This is what I have in my project, which is mostly based on code I've found on Stack Overflow. How good is it? Can you make it better? Can you suggest better ...
6
votes
2answers
149 views
Implement HTTP Server with persistent connection
I am trying to implement a HTTP Server in Java, I want the server to use a persistent connection per thread for request and response. After some research on Google, this is how my program looks like. ...