Multithreading is how work performed by a computer can be divided into multiple concurrent streams of execution (generally referred to as threads).
1
vote
0answers
26 views
C# class to encapsulate and manage multiple background web crawlers
I need to crawl web contents from some websites and then do some processing. Note that this is a small application, so the dataset is relatively small (need to crawl about 30,000 pages every time, ...
4
votes
0answers
56 views
Multithreaded task-scheduler (C++11)
This is (supposedly) a multi-threaded scheduler for one-time and/or repeating tasks. The tasks are simple std::function<void()> objects. I built it to be a crucial part of a larger project I'm ...
0
votes
1answer
40 views
Stuck with Multi-Client Chat Application
I'm trying to make a MultiClient Chat Application in which the chat is implemented in the client window. I've tried server and client code for the same. I've got two problems:
A. I believe the code ...
2
votes
1answer
42 views
Is this actually thread safe?
I wrote this class to ensure that anything done in any of my worker threads can be displayed on the GUI via events, but i ran into non-thread-safe problems.
This class should take a action with zero ...
1
vote
2answers
65 views
Loading data async with queue. Proper write only locking and scheduling
I have to store and return data on multitasking requests. If data is missing, I schedule loading and return null. I'm using some nubie scheduling by saving current jobs in a list. Also I need data ...
1
vote
0answers
35 views
An implementation of parallel workers in Ruby
Much in the spirit of this question, I have implemented a simple class for parallel workers and wanted to get some feedback on it. Can I make the code even more concise or readable? Are there any ...
0
votes
2answers
84 views
Looking to improve mutex implementation
Overarching Problem
I am creating a threadsafe Queue that will act as a shared buffer between two threads for a game I am developing. I need it to be threadsafe so that one thread can throw messages ...
0
votes
0answers
37 views
Simple input lag test
This is my first post on stackexchange. So I am somewhat inexperienced in programming, but I take an interest in C and C++. Anyway, I have created a simple program that should be able to test for ...
1
vote
0answers
85 views
Asynchronous Server Sockets - Thread-Safety/Performance (MMO Gaming)
I'm writing this game server for my small 2D MMO game.
So here are my questions:
What do you think about the Thread-Safety of the code?
Please explain how can it be made thread-safe / show example/ ...
1
vote
1answer
77 views
Multi-threaded socket client for Scrolls
https://github.com/david-torres/ScrollsSocketClient
from Crypto.Cipher import PKCS1_v1_5
from Crypto.PublicKey import RSA
from base64 import b64encode
from threading import Thread
from Queue import ...
0
votes
1answer
76 views
Multi threaded application to send large no of emails
I need to build a application which sends a lot of emails. These emails are based on a table. Basic idea is, I grab a bunch of records from database. Create MailMessage (System.Net.Mail) and send it. ...
0
votes
1answer
66 views
Feedback on a Python 'sleeping barber' program
I recently came across the Sleeping Barber problem and found out that it is a good place to start learning how to use threads properly.
I don't have too much experience with threads and want to ...
-1
votes
1answer
52 views
Log4Net Wrapper with some error potential [closed]
Some time ago, I found the following log4net wrapper here
But I think it is errorprone (in case of threading, could there be deadlocks?)
and the public interface seems to be too wide.
What to do ...
2
votes
1answer
64 views
Is this the best message delay algorithm?
In my application I am attempting to queue outgoing messages by the following rules
By default they should be sent no less than messageDelay apart
Some messages can be sent immediately, completely ...
2
votes
1answer
56 views
Review: custom, simple cache with load timeout and expiry; thread safety, tests: can I do better?
The following is a code from one of my projects which implements a loading cache with timeout and expiry. The associated tests are here (mixed with a good number of argument sanity checks tests). I ...
0
votes
0answers
121 views
Using Barrier to Implement Go's Wait Group
I have implemented a WaitGroup class to simulate WaitGroup in Go lang. Then I've found that I can use Barrier in a different manner, to achieve the same thing. My WaitGroup has some additional ...
1
vote
4answers
140 views
Simple multi-threading class: Does anybody spot potential lock-based concurrency issues?
Trying to write a multi-threaded utility that logs some audit trails to the DB every 30 minutes, or whenever my storage data structure (a list in this case) exceeds a certain limit. The code works ...
2
votes
2answers
95 views
Criticize my threaded image downloader
I'm going to be working on a much larger version of this program and I just wanted to see if there was anything I should change in my style of coding before I made anything larger.
If it wasn't ...
1
vote
2answers
187 views
Reading output from multiple threads and writing to a file
There are 10 threads and I have 15 tasks. Now I have submitted all these tasks to these threads. I need to write all these threads output to a file which I was not successful.
I am getting output by ...
2
votes
2answers
44 views
Perl mutiple children creation
My program will fork, launching $n children. When a child finishes, the parent will launch a new one, if we have more to launch.
#!/usr/bin/perl
use strict;
use warnings;
use POSIX ":sys_wait_h";
...
1
vote
0answers
98 views
Reusing thread and UdpClient for sending and receiving on same port
The working and functional code below is a simplification of a real test application I've written. It acts as a client which asynchronously sends UDP data from a local endpoint and listens for an ...
0
votes
0answers
21 views
Create multithread DAO helper instance
I am using struts 1.3 action layer with hibernate. I am accessing through HeperFactory patten to create helper instance to access DAO layer.
The helper factory seems to be Singleton but thread safe. ...
1
vote
1answer
39 views
Review of concurrent php logic for a web spider class
I wrote a web spider that I would like to download and parse pages concurrently. Here is what I am trying to achieve:
instantiate a new instance of the class with the $startURL as the constructor
...
0
votes
0answers
12 views
Multi threaded API calls problem
I have this API to control some hardware. The API is not very well documented, but I've been able to make do with what I have. It is a API for a RFID device, but also has LED's on it that are ...
2
votes
1answer
56 views
Best way to call future.get()
The following is a small part of some code I am working on
Which is better/faster/nicer?
1.
for (Future<Subscription> future : futures) {
try {
executorService.submit(new ...
1
vote
0answers
129 views
Generic Task Blocking Queue
A generic blocking queue has the following properties:
It is thread-safe.
It allows queuing and de-queuing of items of a certain type (T).
If a de-queue operation is performed and the ...
1
vote
2answers
128 views
Correct way to delete elements from a ConcurrentDictionary with a predicate
I have written a caching wrapper class for ConcurrentDictionary. Basically it has a timer that checks if items are expired and removes them. Since ConcurrentDictionary does not have RemoveAll method ...
2
votes
1answer
77 views
Proper way to cancel WebClient in BackgroundWorker
I have a WPF application that needs to get a XML document using a web request. The request is based on an id that the user enters. If the user enters a second id, before the first returns, I would ...
2
votes
1answer
41 views
Synchronization of remote files download
Preamble: it's a self-assigned and pure syntetic task to learn (and remember what I already knew) C# threads and synchronization and data structures.
The original question was here ...
3
votes
1answer
251 views
Dining Philosophers problem Solution with Java Reentrant Lock
I have implemented Dining Philosopher problem using ReentrantLock in java.
The goal of this program is
Every philosopher should follow the workflow of think,getchopsticks,eat,putchopsticks (No ...
1
vote
0answers
66 views
Need guidance using Tasks
I am doing multithreading using TPL Tasks first time. This is what i have done so far and I want to do it the right way. I will really appreciate if you could honor me with your expert advice.
I am ...
2
votes
1answer
69 views
Simple Freelock collection
I wrote simple lock-free collection class for saving items from multithreading code. I did it just for fun and experience. Can you check my code for potentially problems please?
public class ...
0
votes
2answers
212 views
ThreadPool implementation
The following code is a self-implementation of the static class ThreadPool in C#, only the QueueUserWorkItem (the simpler method), written to practice multithreading in the .NET environment and ...
3
votes
2answers
141 views
Moving from normal threads to ExecutorService thread pools in java
I had my original threading code which worked well, but since my tasks were shortlived, I decided to use thread pools through ExecutorService.
This was my original code
public class MyRun implements ...
2
votes
2answers
33 views
Refactoring an interruptable thread
I have a long-running task that processes an input file and then uploads it to a web server. The processing part can be interrupted (with cleanup) but the upload shouldn't be interruptable so that we ...
1
vote
0answers
24 views
Uses of barriers for one main thread controlling n threads
Referring to this post: http://stackoverflow.com/questions/16328828/one-thread-controlling-many-others
My problem (summarized): One main thread waits for connections, on accept() spawns a new thread ...
1
vote
1answer
38 views
Ensuring my program is thread safe
I have a class which is responsible for waiting until a message is added to a message list and then sending it off to get processed
withdrawMessages - waits for message. I wait a total of 2 minutes ...
3
votes
0answers
52 views
Fast popcount on Intel Xeon Phi
I'm implementing an ultra fast popcount on Intel Xeon® Phi®, as it's a performance hotspot of various bioinformatics software.
I've implemented five pieces of codes,
#if defined(__MIC__)
#include ...
4
votes
1answer
60 views
Monkey testing a SmartCard library
My definition of monkey testing is basically playing with a program in as if I was a monkey (press every button, unplug things, go in the wrong order..etc etc)
So I made a rather simple SmartCard ...
3
votes
1answer
136 views
Review of simple Java Actor library
How can I improve this code?
Also available from git://github.com/edescourtis/actor.git .
Actor.java
package com.benbria.actor;
public interface Actor<T> extends Runnable {
public ...
3
votes
2answers
65 views
Is this a scenario to use volatile instead of synchronized?
I want to know if using volatile in this scenario will give a better performance than using synchronization. Specifically for the paused and running instance variable in the SimulationManager class.
...
2
votes
1answer
114 views
parallel_for_each
I have constructed a simple implementation of a parallel loop.
#include <algorithm>
#include <thread>
#include "stdqueue.h"
namespace Wide {
namespace Concurrency {
...
2
votes
1answer
108 views
Java - Is this the correct implementation of a timer/timertask to destroy a process that overruns a defined time limit
I was wondering if this is the correct implementation of a times task to destroy a thread after it overruns a predefined time period:
it works by creating a getting the thread from ...
0
votes
1answer
83 views
Java concurrent Map of List
I need concurrent HashMap of List as value with following behavior:
count of read/write ops approximately equals
support add/remove values in lists
thread safe iterations over lists
After some ...
4
votes
2answers
467 views
Java HTTP Server and multi-threading optimization
I wrote an http server for the management of scores for users and levels.
It can returns the highest score per level.
It has a simple login with session-key.
What do you think could be improved in ...
3
votes
0answers
463 views
Lock-free multiple-consumer multiple-producer queue
The code below implements an intrusive lock-free queue that supports multiple concurrent producers and consumers.
Some features:
Producers and consumers work on separate ends of the queue most of ...
1
vote
0answers
40 views
Communication with GARMIN throught WEB (Java Socket Programming Code Review)
I am developing a WEB based GPS system and one of its functionallity is to be able to send messages and routes to GARMIN devices.
I have never been using sockets before and for some (obvious) reason ...
0
votes
1answer
55 views
Does refactoring a while loop increase CPU usage
While upgrading our code base to take advantage of new features in .Net 4.5, I'm trying to refactor our take of the classic Producer/Consumer algorithm, but I'm concerned my refactoring is going to ...
0
votes
1answer
117 views
Multi Threaded Error Logger
I am trying to design a class that will log errors to a text file, the application is using threads heavily so it may be that 2 errors that need to be written at the same time. I know there are 3rd ...
3
votes
1answer
142 views
Multi threaded circular buffer
I should write a circular buffer with multithread write and single read ability. Here is my solution:
public class RingBuffer<E> extends AbstractList<E> implements RandomAccess {
...