Multithreading 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 (1)

2
votes
1answer
34 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 ...
2
votes
1answer
53 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
44 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
65 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
68 views

ThreadPool implementation in C#

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
50 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
29 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
21 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 ...
0
votes
1answer
28 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 ...
2
votes
0answers
21 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 ...
0
votes
0answers
8 views

How do you have threads in Ruby send strings back to a parent thread [migrated]

I want to be able to call a method that repeats x amount of times on a separate thread that sends messages such as "still running" every few moments to the console while I am free to call other ...
2
votes
0answers
37 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 ...
2
votes
1answer
95 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 ...
-1
votes
0answers
84 views

What is needed to bring the website down?

I am running windows 7 (32 OS),on intel core 2 duo processor and 4 GB RAM. For learning purposes I was trying a Spam attack on a local website with the code written in java. I started the application ...
3
votes
2answers
54 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
80 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 { ...
1
vote
1answer
46 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
56 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
141 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 ...
2
votes
0answers
266 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
32 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
45 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
87 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
107 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 { ...
1
vote
1answer
144 views

How to update my Swing JTable dynamically. MVC Pattern

I have created a program using a version of MVC architecture. The purpose of the code is to scrape the h1 titles of a list of webpages and to return the results to a JTable. So far I have the ...
1
vote
1answer
77 views

creating dynamic threads

First, I want to say that this code works, but I want to make sure this is the right way of doing it. I am writing this for a SMS text API that loops through each phone number. I sometimes gets hung ...
3
votes
1answer
67 views

Implementation of ordered lock pattern

Below is attempt to catch potential deadlocks at runtime in C#. Basically this class allows user to acquire locks in a pre-defined order only. I ran some basic tests and it appears to work. Please ...
0
votes
0answers
55 views

Haskell network connection graceful handler

Just trying to work out some simple graceful connection handling code in Haskell to get my head around some of the IO/Networking/Threading stuff, some tips where I'm doing things poorly would be ...
1
vote
2answers
78 views

Multi-threaded Winforms Conventions for Main()

I'm trying to find a good pattern for new applications (and for refactoring old ones). Maybe it's just me, but I dislike spawning my main logic thread from inside my main form thread (so far I always ...
0
votes
1answer
85 views

Asynchronous version of AutoResetEvent

This is my second attempt to create asynchronous version of AutoResetEvent. At first I tried to make it completely lock-less, but it turned out to be impossible. This implementation contains a lock ...
3
votes
1answer
186 views

Java thread safety and caching techniques

This is my first Java multi-threading code. It is part of an Android application that is a client to a webpage that serves books. Each page of the book is in a separate PDF, and the Book class ...
0
votes
0answers
55 views

Finding Potential Thread Safety issues and Race conditions in my Multithreading Code

I am working on a project in which I have two tables in a different database with different schemas. So that means I have two different connection parameters for those two tables to connect using ...
1
vote
1answer
50 views

Log and Count the exception in a Single method

I am tring to count the number of exceptions happening and log those exceptions as well. So what I did is, I created one method addException in which I am counting all the exceptions. addException ...
1
vote
1answer
63 views

Looping through the ResultSet efficiently and the add the values for columns in List<String>

I am working on a multithreaded project in which each thread will randomly find columns for that table and I will be using those columns in my SELECT sql query and then I will be executing that SELECT ...
1
vote
1answer
162 views

Producer/Consumer with some limitations

The code realizes producer/consumer problem with multiple producers and consumers. Have this code any potential deadlock or races? //RandomDataProvider.cs namespace MyNamespace.Core { using ...
2
votes
4answers
151 views

Designing a better logger class

Could you please critisize the logger class below? Can it be used in a multi threaded web environment? If not how can I improve it? Is there anything wrong with locking in WriteToLog method or ...
3
votes
1answer
99 views

Thread Safety issues in the multithreading code

I am working on a project in which I have two tables in a different database with different schemas. So that means I have two different connection parameters for those two tables to connect using ...
3
votes
1answer
854 views

Java multithreaded file server and client. Emulate TCP over UDP

This is for homework. My task was similar to my last assignment but this time I had to do it with UDP instead of TCP. This basically means I had to emulate TCP over UDP. Multithreading was an ...
1
vote
2answers
122 views

Does my main class have too much code?

For some reason i have the feeling that i should put all of my thread starts and joins in a for loop just to reduce the amount of code. I dunno if that will hurt readability on this class? Also is it ...
2
votes
1answer
131 views

Lock free MPMC Ring buffer implementation in C

I have written a lock free MPMC FIFO in C based on a ring buffer. It uses gcc's atomic built-ins to achieve thread safety. The queue is designed to return -1 if it's full on enqueue or empty on ...
1
vote
2answers
69 views

Correct implementation for background task execution in web application?

I have a simple servlet which merely serves some cached data back to the user. I also have a background thread which runs at fixed intervals to refresh the cached data. Is this a reasonable ...
2
votes
0answers
43 views

Is this a correct way to handle a thread which uses a socket?

I am building an app for android to control VLC (mediaplayer) that runs on my computer. Atm it's just a prototype and it works but I was wondering if I am correctly managing my HandlerThread and ...
3
votes
2answers
158 views

Multi-threaded sort

I wanted to write a multi-threaded sort, unfortunately I don't know much about threads, especially in C++11. I managed to make something work, but I would be highly surprised if it was the best way to ...
4
votes
1answer
51 views

Timing single operation to not be repeated for a fixed time

Sometimes "a" service does not respond and so we need to restart it. Usually it's a glitch in the network. We can have like 100 calls at the same time so the service cannot be restarted for 100 ...
2
votes
1answer
129 views

Simple ThreadSafe Log Class

For the m_listeners BlockingCollection<>, I know it's a bit hacky right now, but I'm not sure what to use instead (List<>, Dictionary<>, something else?). I want to be able to add/remove ...
1
vote
1answer
43 views

Alternative to using sleep() to avoid a race condition in PyQt

I have a situation where I would like to use a single QThread to run two (or more) separate methods at different times. For example, I would like the QThread to run play() sometimes, and when I am ...
0
votes
3answers
64 views

How to correctly get a IDisposeable when you need to lock the factory?

If I need to create a IDisposeable object from a factory, but if the factory object is not thread safe and requires me to lock on it is this the correct pattern to use? public void ...
4
votes
2answers
112 views

Getting a decryptor object

I need to lock on my AesManaged instance _Aes to call CreateDecryptor() however the CreateDecryptor() method is not thread safe and this function could be called by multiple threads. Is this the ...
2
votes
2answers
85 views

Simple FIFO Job list in Java

For the first time I have to play with Threads in java. Basically, my code is a simple FIFO job queue. The main thread regularly puts jobs in the queue wich need to be executed. The code below is a ...
2
votes
1answer
50 views

Of the good usage of rhino

This is a sample class using Rhino (1.7R4). I need it because in the context of JSON Schema, regexes should be ECMA 262. One requirement is that it is thread safe, and it is. But I'm not sure I ...

1 2 3 4