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 (2)

1
vote
2answers
61 views

Class for multithreaded insert into database

Here I have class that supposed to take dictionaries of product objects and their articles (kind of unique identifier) from queue and insert or update them in database table. Received dictionary ...
4
votes
1answer
60 views

Optimize the Buddhabrot

I am currently working on my own implementation of the Buddhabrot. So far I am using the std::thread-class from C++11 to concurrently work through the following ...
0
votes
0answers
34 views

synchronize 2 jobs/processes [on hold]

I am having a continuously running server application which processes 2 jobs (file processing) which are completely different flows. I invoke the client giving either job 1 or job 2 so it could be ...
-5
votes
0answers
53 views

Write to array index from one thread, read from another [on hold]

There are two threads, one modifies index variable, another thread test if index was changed does some action. The second thread actually needs to asses array element by that index. The part of code ...
2
votes
1answer
68 views

Counting words in files - follow-up

I have made a non-threaded version of counting words. The result was unexpected the non-threaded version was faster than threaded-parallel version. Non-threaded version: ...
4
votes
1answer
111 views

Counting words in files

I made a simple program for my study that calculates words in a text files and prints every word and its repeated times in the files. How can I improve this code? ...
9
votes
2answers
104 views

Printing all even and odd numbers with threads

The original question is on careercup. Write a multi threaded C code with one thread printing all even numbers and the other all odd numbers. The output should always be in sequence ie. ...
3
votes
0answers
47 views

Message Queue for RTOS for microcontrollers [migrated]

I'm currently writing an RTOS for microcontrollers. The whole thing is written in C++11 - if anyone is interested, and the link to the repository is at the bottom. Currently I'm writing a class that ...
5
votes
1answer
38 views

Synchronization Event with awaitAny

In Java, there is no way I know of to wait for multiple events at the same time (see Stack Overflow). Since I would like to use that feature (similar to ...
1
vote
1answer
76 views

TCP Server with multithreading

I am working on a banking application. I want to create a multithreaded TCP Payment Card (iso8583) server that can handle passbook printing requests simultaneously. Multiple devices are connected to ...
1
vote
0answers
19 views

Thread synchronization and happens-before relation in simple examples

I wrote those examples to show different approaches to sharing results between threads. The whole code is on GitHub. All examples should return "Hello world". Are these OK from the perspective of ...
4
votes
2answers
66 views

Code organization when using threads

From OOP & OOD point of view, is it good idea to define Java-threads inside of the static method or in this case it's better to use instance-based method? ...
1
vote
0answers
17 views

Sum of N primes in parallel-ish

I'm primarily a C# guy--day job, most of my hobby projects, etc. Linq's AsParallel() call would be my normal way of doing something like this, but--tragically!--Rust hasn't stolen that just yet... ...
3
votes
2answers
73 views

Multi threaded TCP server

I wrote this just for fun, to hone my exception handling skills. I want to know what I can do better in terms of exception handling (and otherwise) in the below code Server ...
6
votes
1answer
66 views

Task scheduler coding exercise

In an interview about multithreading I was asked to write code to satisfy the requirements below. In the exercise you need to provide implementation of single-threaded TaskScheduler class with the ...
1
vote
2answers
69 views

Producer Consumer in C# with multiple (parallel) consumers and no TPL Dataflow [closed]

I am trying to implement producer/consumer pattern with multiple or parallel consumers. I did an implementation but I would like to know how good it is. Can somebody do better? Can any of you spot ...
2
votes
2answers
118 views

Using a Java queue

I am developing a plugin for a system, the plugin catches some events in that system, wraps them and pushes out to another system for analysis. The overhead generated by the plugin must be as low as ...
1
vote
1answer
64 views

Saving a collection of WPF user control layout into an XPS document

I am making an application to save a layout of user control into an .xps document. But, the export doesn't seem completed if the data is too many. I've tried to encapsulate each part with ...
0
votes
2answers
36 views

Java background server class that might be called from ui thread

I have a server communicating over network interface. This server should run on a background thread, so that it does not block the ui thread. The ui thread starts and stops the server. Even starting ...
10
votes
2answers
89 views

Implementing JQuery style 'deferred' and 'promise' in C#

I like the pattern of the jQuery Deferred object. I like how you can call Resolve any number of times, but the listening objects will only be notified once. I also ...
4
votes
1answer
50 views

Streaming hacker news posts

EDIT: Thanks for the answer. I took suggestions from here and readings elsewhere and have completely refactored it, link. Hacker News recently released an official API. Unfortunately, it cannot be ...
5
votes
2answers
95 views

Thread-safe Phoenix Singleton class template with Boost

I've implemented the phoenix-singleton as a class template with boost inspired by Modern C++ Design. The code compiles fine with MSVC 2013 - and it seems to work, but I'm new to multi-threaded ...
6
votes
2answers
135 views

C# program that uses events

I am trying to learn C#. Please tell me if the following code respects coding standards and naming conventions because I want to write beautiful code. The purpose of this program was to help me ...
2
votes
1answer
66 views

Multithreading pthread program

My multithreaded version of code works slowly than singlethreaded. Can you help me to understand why? ...
0
votes
0answers
14 views

wrote a code for race in java won't work [migrated]

Can anyone do a review of my code? I am new to Java. I tried to run it. It gave an Illegal Monitor State Exception Error in Race and RaceMain class. Thanks a lot if you read it. ...
10
votes
1answer
161 views

Mutual Exclusion with Mutexes

After I wrote this question: Producer/Consumer programs, I realized that I had forgotten to write a version using mutexes. I have now written a Producer/Consumer problem solver using mutexes using ...
1
vote
1answer
48 views

Can I get around manually resuming a thread in this C++ thread class?

I have inherited a C++ Win32 thread class which roughly works like this. I am looking for ways to improve the design; specifically I am looking for a way to get rid of the spurious ...
5
votes
2answers
78 views

Generic Object Pool in C#

I have a limit of 100 sessions (each session held in an object). Many threads will be requesting sessions, and it is very possible that all 100 sessions could be in use at any time. I'm a Junior ...
13
votes
3answers
227 views

Producer/Consumer programs

I am studying mutual exclusion in college, and we just covered the producer/consumer problem. The class does not involve writing code, but I decided to implement a bounded buffer version of this ...
2
votes
2answers
61 views

Handling thread interruptions in a directory iterator

This code is code written on a whim to help $someindividual asking for such a thing on $somechatmedium; what is needed is a way, ...
6
votes
1answer
247 views

Efficiently using ZeroMQ sockets in Java

I am working on multithreading project and I am using ZeroMQ socket to send the data as a byte array. Below is my example which works fine. I'm opting for code review to see whether it can be improved ...
1
vote
2answers
95 views

Proper way to wait end of a service and singleton design

My code works fine and I would like to know if I chose the best strategy to implement my code, or if It can written better (more fast, more clear, best use of design pattern, etc). In my android ...
1
vote
0answers
28 views

Python Multiprocess Dictionary Selector [closed]

I am attempting to select devices via telnet based on a key I get from pinging the telnet device. Basically it selects to use only the devices with the given key. I am running into issues when a ...
0
votes
0answers
34 views

From multiprocess to multithreading [closed]

I recently joined a team responsible for the enhancement of an existing 5-year old program. It was developed with multithreading in mind, but not correctly implemented. The solution is composed of ...
4
votes
2answers
46 views

Threaded generalised transform

I'm writing an application which works with huge amounts of sequential data, and often found the need to use std::transform. I see two potential improvements to ...
2
votes
2answers
144 views

Producer/Consumer Program

I am a semi-new Java programmer that tends to be a perfectionist. What I'd like to know about my code: How it compares to common practice. Is it readable? Are my comments appropriate? Any ...
5
votes
1answer
62 views

General Batched Job Runner

This question is inspired by: Generic Task Scheduler where the problem is to run tasks on a scheduled basis, in parallel, and have individual timeouts for each job. For example, consider this ...
2
votes
1answer
52 views

Precognitive waiting - waiting for something to finish, before it starts

I have implemented a class that has a method to wait until "something else" has happened. When this has happened, the current thread stops waiting and returns from the method. This is my current code: ...
3
votes
1answer
32 views

Syncing e-mails for multiple accounts

I wrote an email syncing program in my ASP.NET MVC website that syncs e-mails from multiple e-mail accounts to my database. Each e-mail account has to be independent from other accounts and they have ...
1
vote
0answers
72 views

Generic Java Task Scheduler (Followup) [closed]

As a followup to my previous question, and after receiving a great answer, here is the updated Scheduler class. I would also like to state some goals & ...
7
votes
1answer
112 views

Generic Java Task Scheduler

I wrote this generic task scheduler for executing tasks in fixed-delay intervals, can you find anything wrong with it, or issues that may arise from using it for sending something like queued mails in ...
4
votes
2answers
104 views

Managing FutureTask and ExecutorService

I have many unrelated tasks to execute and I have to get the result of the task so I use the FutureTask. I submit all the task to the thread pool and use a map to ...
4
votes
2answers
170 views

Concurrent activity on ArrayList

I have an immutable Point class and a CollectionPoint class which manages instances of my ...
1
vote
2answers
102 views

Logger facade code for configuring multiple loggers are runtime

Following is the code for a logger facade that I have created, which can be used to log via any of the standard and configurable loggers like log4net, BitFactory, currently I have just integrated ...
5
votes
0answers
59 views

Multithreading in a 2D Mining Game

I have implemented some basic multithreading in my 2D mining game that I asked about in a previous question. The first part is working out great (creating the initial object instances in the ...
1
vote
2answers
100 views

Thread, handler and activity structure for a bouncing ball animation

This is a custom MyActivity class with two custom views (bar and a ball): ...
6
votes
4answers
139 views

Efficient prime factorization for large numbers

I've been working on a little problem where I need to compute 18-digit numbers into their respective prime factorization. Everything compiles and it runs just fine, considering that it actually works, ...
2
votes
1answer
84 views

Lockless, blocking, non synchronized multiple producers and consumers ring buffer

My program is structured like this: there are M producer threads, each of which computes a section of an object O with index ...
1
vote
1answer
97 views

Monitoring progress in Parallel.ForEach every minute

I'm using Parallel.ForEach to download 500K URLs and I want to monitor the number of URLs that have been successfully downloaded each minute. ...
6
votes
2answers
104 views

An extension method to safely retrieve or add a dictionary value

The extension method: ...