Arises when multiple threads can simultaneously access the same resource. Use this tag for code reviews of multithreaded code where concurrency is a potential issue.
0
votes
0answers
45 views
Web Crawler (A Tour of Go #71)
So I was trying to do this exercise from Tour of Go. I managed to get it working. I am not at all sure that it is correctly concurrent or idiomatic (I started learning Go, like, 4 hours ago).
I would ...
1
vote
2answers
91 views
Producer-Consumer using low level synchronization
I saw a tutorial from a site where it showed the use of ArrayBlockingQueue as a thread-safe concurrent data-structure . Just for learning purposes , i tried to build something similar using ...
2
votes
2answers
69 views
Testing an Executor
I have written the following Executor:
/**
* <p>This executor guarantees that there is never more than one element waiting to be executed. If an element is
* submitted for execution and ...
3
votes
1answer
122 views
Unit test an ExecutorService in a deamon
To execute tasks sequentially with a timeout I use ExecutorService.submit() and Future.get(). As I don't want to block calling clients, I implement producer–consumer pattern with a queue into a Thread ...
3
votes
0answers
90 views
How can this simple coroutine implementation be improved?
This is a quick and dirty implementation of coroutines that implements yield by saving and restoring the stack to and from the heap. Here's an earlier version, which does the most naive possible ...
1
vote
2answers
188 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 ...
4
votes
1answer
215 views
Self-taught Pythonista: Any criticism welcome for this concurrent word count script!
I've been teaching myself Python - my first programming language - for about two years now.
I recently discovered the concurrent.futures module and wanted to do something with it. What do you think ...
1
vote
2answers
2k 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 ...
1
vote
1answer
70 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
...
2
votes
1answer
65 views
Sleepsort in Go
I implemented sleepsort in Go. I am new to channels, and I'd like to get some advice on them, especially on how to close channels after N messages have been sent on them. Currently I use a counter and ...
1
vote
2answers
624 views
ReentrantReadWriteLock lock upgrade method
I have a question about lock upgrading.Specifically what bothers me is between readlock.unlock() and following writelock.lock()...
I am providing a nearly complete implementation for a sample cache.I ...