141,057 questions
-6
votes
0
answers
73
views
Undesired Pulsating in Rendering and Cumulative Slowdown When Implementing Fixed Physics Timestep in Multithreaded Physics [closed]
INTRO
I am getting unwanted pulsing and slowing down in rendering 2d particles, which should be drawn faintly (low alpha) and leave a fading trail under the influence of gravity. Below is a ...
0
votes
0
answers
17
views
Actix-web + Tokio: Server hangs when using tokio::spawn with Arc<Mutex> loop
I am facing an issue where my Actix-web server starts correctly, but the moment I hit the /upload_chunk endpoint from my frontend, the request hangs forever.
After some debugging, I found that the ...
1
vote
0
answers
111
views
How is a non-parallelized for loop inside an OpenMP parallel section executed?
Consider the following code:
#pragma omp parallel
for (int run = 0; run < 10; run++)
{
std::vector<int> out;
#pragma omp for
for (int i = 0; i < 1'000'000; i++)
{
...
}
}
...
Advice
1
vote
13
replies
104
views
C# - lock multiple methods or entire class to single thread execution
I am trying to ensure that methods in my class can only be called by a single thread.
So far tried to use ReaderWriterLockSlim to achieve this effect but this can cause potential issues if it is not ...
4
votes
4
answers
571
views
Pure Swift concurrency [closed]
All the libraries I have come across that provide Swift concurrency functionality either depend on an Objective-C library or are wrappers around the C based GCD. (iOS and OS X)
I'm just wondering if ...
Best practices
0
votes
3
replies
64
views
Is there anyway to get physical disk Idle time without 1 second wait needed for PerformanceCounter.NextValue function?
I trying to develop user-friendly program that do not block physical disk with 100% usage (so even entering My Computer takes around 10 seconds).
My program calculate hash for many (180k) small files ...
0
votes
2
answers
121
views
compare_exchange_strong failed to update the expected value
I am trying to implement a lock-free multiple-producer-single-consumer ring buffer in C++. Here is the full definition and the test code.
#include <iostream>
#include <memory>
#include <...
232
votes
5
answers
173k
views
Are lists thread-safe?
I notice that it is often suggested to use queues with multiple threads, instead of lists and .pop(). Is this because lists are not thread-safe, or for some other reason?
0
votes
1
answer
315
views
Can external IO operations be considered as if seq_cst operations in the reasoning of multithreaded programs?
Consider this example:
// thread A:
start_transaction();
update_mysql();
commit_transaction(); // remove "key" from mysql tables
remove_redis_cache("key");
// thread B:
std::...
1
vote
1
answer
126
views
Why does my multithreading/pointers code print random values?
My code should print the numbers given as command line arguments. Instead it prints random-looking values.
What is going on and how can I fix it?
#include <stdio.h>
#include <pthread.h>
#...
2
votes
1
answer
63
views
Opening a pop-up window when error from a worker running in Qthread occurs completely freezes the program
I was trying to create a little Python program with a GUI using Pyside6. I ran into a problem when creating a thread for a worker to do a task (check files with a certain condition and then copy them ...
0
votes
0
answers
250
views
multithreading java and neural network : reading 2 csv files at the same time
I'm working with a neural network project that requires to run two instance of the neural network program with different training set specifically two at the same time. For that I'm using ...
21
votes
4
answers
18k
views
main.async vs main.sync() vs global().async in Swift3 GCD
Example A: This causes the app to crash.
DispatchQueue.main.async {
let url = URL(string: imageUrl)
do {
let data = try Data(contentsOf: url!)
DispatchQueue....
0
votes
0
answers
106
views
How efficient are pipes and threads in C compared to regular function calls or pure sequential code? [closed]
I’m currently studying Operating Systems at college, and my professor has started teaching us about threads and pipes in C.
His teaching style is very practical — he expects us not only to understand ...
10
votes
2
answers
8k
views
Thread BLOCKED on org.apache.log4j.Category.callAppenders, but not waiting for any lock
My web application(delpoyed on weblogic) went down, when I check the jstack info, I found most threads are BLOCKED on a org.apache.log4j.spi.RootLogger. The thread owning this lock is also BLOCKED and ...
855
votes
26
answers
414k
views
What is the volatile keyword useful for?
I came across the volatile keyword in Java. Not being very familiar with it, I found this explanation.
Volatile variables are a simpler -- but weaker -- form of synchronization than locking, which in ...
4
votes
1
answer
699
views
Multithreaded Server with AsynchronousServerSocketChannel
I have to implemented a server which should accept more connections. Without any deeper thoughts I decided to use the new JAVA NIO.2 classes.
My current approach is:
final Semaphore wait = new ...
48
votes
2
answers
17k
views
Is there a way to have a Rust closure that moves only some variables into it?
I have a general struct with settings and an extra variable setting that I want to tune and play around with.
For all possible values in an integer range, I want to start a (scoped) thread with ...
0
votes
2
answers
59
views
Calculate byte positions to split ndjson files into chunks
Below is the code extracted from this repo:
import os.path, io
filename = ""
n_chunks = 12 # Number of processes to use -- will split the file up into this many pieces
def ...
8
votes
4
answers
5k
views
C++11: Is std::thread on linux depending on pthread library?
I read that pthread is C library and is not compatible with C++ object model, especially when talking about exception handling.
So I wish to know on linux system, how gcc/clang implements std::thread,...
0
votes
0
answers
43
views
How to set up multi-thread logging to different loggers using QueueListener and QueueHandler
I have a Python application that runs multiple tasks in parallel using ThreadPoolExecutor. I want all threads to log safely without race conditions. I also need two loggers:
Console logger (prints ...
0
votes
2
answers
10k
views
Multithreaded file copy for Linux needed
I have a "large" amount of data that needs to be copied every day. (6TB)
It is 15 disks presented from a SAN over Fibre Channel and being copied to a local array consisting of 22 spindles.
sources ...
5
votes
2
answers
25k
views
Specify default MaxDegreeOfParallelism in Parallel.ForEach?
We would like to optionally control the number of "threads" on our parallel loops to avoid overwhelming a web service (for example).
Is it possible to specify a custom MaxDegreeOfParallelism on a ...
1
vote
2
answers
2k
views
python asyncio: how to best use lock threads?
Let's imagine I have a thread with an asyncio event loop and other threads running.
I may have to deal with synchronisation between threads with the lock mecanism for instance. But the lock may block ...
8
votes
4
answers
10k
views
Loading Ad (adMob) on Background Thread
I want to load my add on a background thread cause it makes the SlidingMenu laggy upon opening and closing. Should I use a Thread/Handler? Or AsyncTask?
String MY_AD_UNIT_ID = "----";
AdView ...