Multi-threading is how work performed by a computer can be divided into multiple concurrent streams of execution (generally referred to as threads).
2
votes
0answers
24 views
Multithreaded task executor
I'll present stubbed code that is similar to actual code because I cannot post actual one as it is. In the following code I've a worker thread which is going to have one major state - Started. Started ...
4
votes
2answers
106 views
Python UDP class to control drone
I'm currently building a small plane with Raspberry Pi Zero W. I wrote a small code which uses UDP to control it.
Here I'm resending packets regularly in a thread because of the joystick input (it ...
1
vote
0answers
40 views
Get/Set the value in the cache using the AtomicReference in Java
I have this code which gets and sets the data in the cache using the synchronized block. I want to know if is there is any way by which I can remove the synchronized...
0
votes
0answers
28 views
BlockingQueue with unique elements in Java
This answer on Stack Overflow includes an implementation for a Java BlockingQueue with unique elements. I changed it and included it in a project:
...
0
votes
0answers
45 views
Force threads to work in strict order using condition variable and “notify_one()” function
The question is:
How to give access to critical section to multiple threads in sequence i.e. 1st thread should consume data before 2nd thread and 2nd thread before 3rd and so on, using condition ...
8
votes
1answer
109 views
Task-Based Multithreading Library - Implemented using Fibers
This is a library I wrote to enable task-based multithreading. It allows execution of task graphs with arbitrary dependencies. Dependencies are represented as atomic counters. Under the covers, the ...
9
votes
3answers
319 views
Naive lock free work stealing queue
Recently, I read a article about work stealing queue Job System 2.0: Lock-Free Work Stealing – Part 3: Going lock-free, and this is my c++11 naive implementation based on my understand of c++11 ...
2
votes
1answer
48 views
Read characters slowly (Threading with delay, .NET Framework 2.0)
Couple of months ago I was asked to develop a console app to do the following:
Write an application that takes an array of ICharacterReader
interfaces, accesses them in parallel, and outputs a ...
3
votes
2answers
48 views
Static ConcurrentDictionary to maintain static objects
I am using following code to maintain some static information. The problem I see with it is that, if the information retrieved using GeKeysFromCache is modified without using lock keyword it may lead ...
5
votes
1answer
60 views
Ping multiple sites via Python
Here is a simple script that I am using to ping 50 sites at a time and check if they are up or not. If not, save the down time with error in MongoDB.
...
5
votes
1answer
312 views
Increase the speed of this python code for text processing
I need to iterate through a file of words and perform tests on them.
...
-1
votes
0answers
68 views
Webscraper using threads and grequest in Python
I have to scrape a government website and retrieve the information about a food's particular calorie information. I wrote a program that does this. I have been all over the internet looking at ...
1
vote
1answer
55 views
IP Scanner via python sockets
Please review my code for scanning active IP address . Please Suggest improvements ...
...
6
votes
1answer
63 views
Simple slack bot in python
I wrote a simple slack bot, which is able to save links (command: "save name link") and print them (command: "get name"). Optionally, a delay in minutes and seconds can be specified (command: "get ...
-3
votes
0answers
33 views
RingBuffer with Spin
What do you guys think about the following code? Is there any potential thread issue?
...
6
votes
3answers
124 views
Concurrently reading a Map while a single background thread regularly modifies it
I have a class in which I am populating a map liveSocketsByDatacenter from a single background thread every 30 seconds inside ...
10
votes
1answer
112 views
Lightweight asynchronous event library in C - Threadpool module
I have finished writing a C library whose purpose is to provide a simple API for asynchronously executing functions, waiting for events on file descriptors and waiting for timeouts. The whole library ...
6
votes
1answer
51 views
Expanding url from shortened url obtained from tweet
I have a twitter data set. I have extracted all the expanded urls from the json and now am trying to resolve the shortened ones. Also, I need to check which urls are still working and only keep those.
...
1
vote
1answer
74 views
Player Packet System
I have recently coded a system where an instance of class Player is created for each connected socket, once the player class has been created, in its constructor the Socket that connected starts ...
1
vote
0answers
46 views
Two priests talking to one another
It's a part of code where two Threads ("priests") talk to each other. One asks and waits for the second to answer - then something happens depending on what has been answered by second thread.
I ...
1
vote
0answers
78 views
Sync SQLite databases using threads and a Service
I have an Android app that collects data in n number of SQLite databases. The user decides the value of n in runtime. A Service is in charge of sending that data to our server. We used to do this with ...
1
vote
2answers
46 views
Simplified LogService (from concurrency in practice) with shutdown feature
Brian Goetz provided following code of LogService with shutdown feature:
...
2
votes
1answer
46 views
Parse the response from http call and populate multiple maps
I have to parse a response after making HTTP call on the server. If the response is not successful then try another server otherwise parse the successful response and populate two ...
8
votes
2answers
79 views
Java queue with dynamic priority flag
I need to build a queue where the elements will be added and removed in chronological order by default. But if the client sets the priority flag for the queue I need to be able to pull the elements ...
3
votes
0answers
38 views
Partition numbers as polynomial, each number in a thread
I'm beginner at multithreading programming and I wanna write a piece of my code using it. I'm trying to split different numbers into multiple parts and store them as a polynomial. I wanna do this ...
1
vote
0answers
39 views
Mutex implementation without built-ins
I want to implement simplest mutex without built-in functions or the <pthread.h> module.
...
2
votes
0answers
50 views
Multithreaded chat application in python
I wrote a multithreaded p2p chat application with Qt, and I'm hoping for some feedback. I know there's some deficiencies with error handling, but I'd like to know what else I'm missing. Thanks!
<...
2
votes
0answers
32 views
Asynchronous service that publishes a possibly infinite amount of events
I want to implement a service that fetches eyetracking events and publishes them to all subscribers of the stream. The whole thing is supposed to run asynchronously, so it doesn't block the UI thread. ...
4
votes
2answers
80 views
Multithread the variant of matrix multiplication
This is matrix multiplication. Big matrix split on the submatrix and multiplication in parallel, result matrices merge to result. How i can make this code better?
...
1
vote
0answers
44 views
Thread class that uses std::unique_ptr
I have implemented a class which encapsulates a thread of execution and provides an interface to send messages to it. It is based largely on an article written by Herb Sutter in 2010. It also uses the ...
2
votes
0answers
45 views
Read bytes array from file, process and write to another file using multithreading
I was trying to read data from a file and after processing data write it to another file. Reading and writing do not need much CPU time, so I think it would be better if I use multithreading and ...
3
votes
1answer
50 views
TCP retarder for network delay simulation
I would like to simulate delay over network, for that I have implemented a simple retarder (=introduce random delay while maintaining order of messages) using Boost to handle sending itself. It ...
2
votes
2answers
156 views
Running multiple producer and single consumer in a multithread environment
I have a below class in which add method will be called by multiple threads to populate messageByChannelReference concurrent ...
1
vote
1answer
32 views
Model for starting a thread with an initial value, pausing, resuming with a new value and stopping a thread
Here is a design to achieve a simple model in Java which uses a Thread and has these features:
Starting the thread with an initial value
Pausing the thread
...
2
votes
2answers
64 views
ASCII to Binary and reverse in java
Here is a simple app that i am trying to implement in java.
my goal is to write a program that can convert ASCII to Binary and back.
Questions:
Am i violating any OOP Rule.
Is my code readable ?
...
5
votes
3answers
264 views
Brute-force Vigenere Cipher using multiple threads
I'm trying to brute force a Vigenere Cipher knowing only that the key length is 5+ characters and that the decrypted text has the word ...
0
votes
1answer
94 views
Multithreaded cURL wrapper
The following is a class for curl wrapper.
This class will be called like:
...
1
vote
0answers
61 views
TTimerThread - Threaded timer class
I was inspired by @LU RD's answer to the question: Using VCL TTimer in Delphi console application, and wrote a bit simplified TTimerThread class.
By simplified I ...
2
votes
1answer
57 views
Loading interstitial adMob in different threads
I want to load Interstitial AdMob after 5 second, after the Activity started, in another Thread. Is this code right, or I'm duplicating ...
0
votes
2answers
68 views
FutureTask in Android, wait for a thread to execute the next one
This code is executed on a background service every 60 seconds on an Android app. Each class instantiated on FutureTask (WifiInfoFetch and WifiApResults) contains an insert to an SQLite database. We ...
0
votes
1answer
39 views
2
votes
2answers
72 views
Custom log4net raising application-level events
Use Case: I have a form application in which I log events to a file/database and have a need to also raise those events to the application itself (for display purposes). Think old school updating ...
2
votes
0answers
28 views
Concurrent ObjectPool using ConcurrentLinkedQueue
Main ObjectPool Class: It uses atomic operations and a concurrent linked queue to achieve the best performance compared to Apache commons pool. I want to make sure there are no concurrency issues even ...
5
votes
1answer
57 views
Concurrent stack in C - follow-up
This is a follow-up question to Concurrent stack in C
The pop function not just removes the top element from the stack, but also returns it.
If a pthreads call ...
1
vote
1answer
45 views
Did I overuse / underuse threading locks in my custom list class?
I am writing a Python module in which two threads access one list. One thread adds 500 items to the list per second, and the other thread reads the list at an irregular interval. I want to make a ...
2
votes
0answers
108 views
Multiple readers, single writer synchronization
This is educational purpose "simulation" of multiple readers / single writer server.
No actual work is done, except the synchronization. In current realization, readers have priority over writers.
<...
5
votes
1answer
81 views
Single-thread worker in multi-thread webservice
There is standalone WCF webservice, which is providing methods to interact with legacy ERP system.
This system exposes an API, which allow programmer to interact with it.
The problem is that, for ...
3
votes
2answers
87 views
My first attempt at multithreading in C# with Prime Numbers
This is my first attempt at multithreading in C#. This entire program does several things with prime numbers, but the part I'm going to post is mainly focused with printing out all prime numbers ...
2
votes
0answers
60 views
Thread-safe RLockedList
I have written a thread-safe list which can be used as a drop-in replacement for a regular list. This has been tested and used internally without issue, but "The absence of evidence is not evidence of ...
4
votes
1answer
79 views
Multi-threaded code to handle messages from a provider
Having a look at my code, is there a way to be losing elements?
...