Multithreading is how work performed by a computer can be divided into multiple concurrent streams of execution (generally referred to as threads).
2
votes
1answer
40 views
Show a ProgressDialog and send an SMS in the background
I have written a procedure that
shows a ProgressDialog
sends an SMS
updates the View from another thread
hides the ...
9
votes
4answers
338 views
Multithreaded HiLo game
For my CS class I have to write a HiLo game using multithreading. I am brand new to multithreading and not sure how to best implement it. The program below works, but I am wondering if there is a ...
3
votes
1answer
42 views
Python Threading
I have the code below that I am using to thread certain tasks. Basically, you pass in a function reference, a list of data and the number of threads. It will run the function for each item in the list ...
7
votes
2answers
100 views
SQL service broker and threading
Basically my code waits for database table a to have an XML string inserted into it. The SQL query parses the XML string and stores it into separate columns (this ...
4
votes
1answer
36 views
Optimization of Barnes-Hut Multithread Insertion algorithm
I'm currently working on optimizing a Barnes-Hut implementation (connected to a previous post I did) and I need help to optimize it further.
After some testing, the main problem appears to be in the ...
1
vote
1answer
29 views
Decoding an element list
I have a function which I am calling an infinite number of times (or until a condition is met). The problem with this recursive function is that on a higher level, it is called by a worker thread ...
3
votes
2answers
85 views
Multithreading decouple update-logic and render-logic
I want to improve my multithreading competence and tried to build a compact doublebuffered way to separate two threads where one is only displaying the state and the other one updates the state. So I ...
2
votes
1answer
39 views
Taskqueue multithreading
I have a synchronized list that I use as a taskqueue. In this queue I have some long values that need to be proceed and create heavy I/O and delay. I thought of using threads to get things done ...
0
votes
1answer
33 views
Handle concurrent HTTP requests with a generic .ashx
I have created a .ashx file that is able to handle concurrent http requests.
Works great, but now I'd like to create a base class that does the common work in order to not repeat myself each time I ...
10
votes
4answers
266 views
Ugly optimized caching of SimpleDateFormat
Concerning the optimization of this simple function
String formatDate(String format, Locale locale, Date date) {...}
formatting a ...
2
votes
2answers
87 views
How to efficiently use RestTemplate with HttpComponentsClientHttpRequestFactory in multithreaded environment?
I am working on a project in which I need to make a HTTP URL call to my server which is running Restful Service which returns back the response as a JSON String. I ...
5
votes
1answer
125 views
General multithreaded file processing
I'm trying to write a general multithreaded file processing facility. The idea is that some input file consists of a number of discrete records, each record needs to be processed in the same manner, ...
4
votes
1answer
110 views
Creating Thread safe list using Lock object
Will this code qualify for a truly thread safe list? It is using the Lock object.
...
1
vote
1answer
70 views
Creating Thread Safe or Concurrent List [closed]
Can a thread safe or concurrent list be created using the code mentioned underneath, where I wrap all the calls to the base class in a ReaderWriter lock. I can similarly implement all the public ...
2
votes
0answers
21 views
POSIX: Synchronous event library
I have implemented a small library that handles synchronous events with POSIX compliant threads. I oriented me on the already existing POSIX thread API. Here are the files I created:
...
3
votes
0answers
48 views
Synchronous events library
I have implemented a small library that handles synchronous events with POSIX compliant threads. I oriented me on the already existing POSIX thread API. Here are the files I created:
...
10
votes
3answers
1k views
Dining Philosophers Algorithm
Please visit the http://en.wikipedia.org/wiki/Dining_philosophers_problem for algorithm discussion.
I have written below java program to solve this problem by Arbitrator solution algorithm mentioned ...
1
vote
1answer
65 views
Spreading the load more evenly from a background thread
I have a background thread which runs every 5 minutes. I am using ScheduledExecutorService for this. Every five minutes, I am making a call to one of my service and ...
7
votes
3answers
251 views
Having full atomicity against all the threads without impacting performance or throughputs
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 ...
3
votes
1answer
84 views
Loading GIF form on a Windows console app using threads
I have a main form which does processing for an extended period of time. Normally, progress bars are used to show either the loading status or simply show the program is still running/hasn't freezed.
...
6
votes
3answers
260 views
Correct control of execution of Java thread
I'm writing an application that will use the JLayer library to play an mp3 file. Since the player does not have any methods to pause the playback - ...
-1
votes
1answer
48 views
Multithreading - program with lots of parallel routines (C++) [closed]
I'm coding a networking software, which has lots of functions (modules) which can be run in parallel. They share some resouces, like libnet_contexts of every type, ...
5
votes
1answer
50 views
ThreadSafeKeyedObservableCollection<TKey, TItem>
Is this a thread safe collection? Any issues with the code?
...
6
votes
1answer
157 views
How do I interrupt a ServerSocket#accept() and shut down a multi-threaded socket server?
I have got here a work-in-progress piece of code here that does multi threaded communication via sockets. I am using a poison pill to shut it down. It is a local port number. Is there a better way to ...
1
vote
0answers
23 views
Creating a “Produce and Consume” using Swingworkers
I am experimenting with the produce and consume concept while trying to incorporate it into my own project.
I basically have two Workers in a small example I made:
...
3
votes
0answers
39 views
Parallelizing some model fitting code using multiprocessing
I'm trying to refactor some code for fitting parametric models that are defined symbolically using Theano. My goal is for all models to expose a common interface so that, as far as possible, they can ...
2
votes
1answer
53 views
Producer - Consumer interaction
I have an implementation of Producer-Consumer multi-threaded interaction.It works.But I feel that during the execution wait states happen too often between Consumer ...
4
votes
2answers
136 views
Lock-free multiple producer single consumer message queue
For a while now I've been after a lock-free, simple and scalable implementation of a multiple producer, single consumer queue for delegates in C#. I think I finally have it. I've run basic tests on it ...
7
votes
2answers
396 views
Generic cached value class mimicking Lazy<T>
Before I wrote this I searched and found a number of solutions that make use of a caching provider to handle a set of items. I felt that was too cumbersome of an approach and set out to create a class ...
0
votes
2answers
39 views
Which would be a more elegant way to make a thread wait?
I am writing a program that utilizes a third party API. I attach a handler to an object and wait for a message back. the responses from the server then get saved into an array list. Unfortunately it ...
4
votes
2answers
104 views
Flow Task Scheduler
Scenario:
I wanted a task scheduler/doer that enables my application to schedule some tasks to be executed in a specified time but in the same order they were scheduled in or depending on their ...
5
votes
2answers
122 views
FileSystemWatcher with threaded FIFO processing
I have single threaded C# console application that uses FileSystemWatcher to watch folder for new files.
My app sees a file being written, waits until it is ...
1
vote
6answers
144 views
Looping through an array of strings containing approximately 3 million lines of strings
I have a function that loops through an array of strings containing approximately 3 million lines of strings. My problem is this loop is running too slowly and I want to know how to make it faster.
...
2
votes
1answer
102 views
Efficient Multithreaded File Processessing in Java
This method in my code uses a producer-consumer design to read many files and process them for use in an NLP algorithm. The completion service collects files as they are processed, which means that ...
0
votes
0answers
64 views
Run a WCF server in a background thread on a console app
This app is a P2P client running on Windows using WCF.* I'm spawning the WCF service using Task<T>.
The WCF service can be canceled using a ...
1
vote
2answers
67 views
SynchronizedArrayList implemented using reader writer synchronization
I am trying to understand the workings of reader writer locks. For the sake of learning, I implemented reader writer synchronization by my own. I implemented ...
4
votes
1answer
46 views
Filewatcher compiler for watching different files
I'm trying to create a filewatcher program that can watch different files. The files might have subfiles that are being imported into the main file, which is being represented by the file object. I'm ...
1
vote
1answer
69 views
Async function with slow web reference(web service) slowing down webpage
Is there a way to make a threading/async post with a web reference not slow down the whole website just because the web reference takes a long time to return a response?
I have a send email function ...
5
votes
2answers
106 views
Queue that connects multiple producers and multiple consumers
The scenario is about processing 'Message' objects. Producer creates them and Consumer does the consumption.
...
0
votes
0answers
71 views
Command line multipart file downloader using requests
The code below downloads file in multiple chunks if split is set to some number, however there is a limit to maximum possible splits defined below by maxSplits if ...
4
votes
2answers
83 views
Accessing a String value from multiple threads without synchronization
I'm looking for some input here. I have a class that contains a value which is updated every few seconds by a method within that class. Right now, access to this value across multiple threads is ...
4
votes
1answer
97 views
4
votes
1answer
77 views
Simple way to prevent duplicate logging of errors
I've been tasked with updating our current error logging system to prevent the logging of similar errors (from a single client program) that were probably caused by the same event. The code here is ...
5
votes
1answer
122 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):
...
7
votes
2answers
161 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
46 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
71 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
...
4
votes
1answer
117 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
66 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
56 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 ...