Questions tagged [thread-synchronization]

In a multi-threaded environment thread synchronization is used to coordinate access to shared resources such as file handles, network connections, and memory

In a multi-threaded environment thread synchronization is used to coordinate access to shared resources such as file handles, network connections, and memory

References

645 questions
0
votes
1 answer

Incorrect synchronization inside a "while" loop (occuring only in Release mode)

I have a kernel with a "while" loop, which iteratively updates elements of an array using information about neighbors (only one neighbor in the sample code below). This loop stops when no element is changed at the current iteration. Unfortunately,…
0
votes
1 answer

Multithreaded - One Writer And One Reader - Do We Need To Use Lockers?

In any multithreaded application, that has one writer thread and one reader thread, Do we need to use lockers ? For example: public void example::increase() { counter++; } public int example::getValue() { return counter; } In this example,…
Azil
  • 457
  • 2
  • 5
  • 10
0
votes
3 answers

Thread Synchronization in Linux in C

I am having issue synchronizing the threads so each thread can run one job first, then another thread start the same job, and so on. Below is my code: #include #include #include #include #include…
Rain Man
  • 1,163
  • 2
  • 16
  • 49
0
votes
1 answer

How to write in global memory from different threads CUDA

I have a kernel that is searching in different arrays (one thread per array), I need that always that one thread find a match, the result will be written in a global memory array. The problem is that how can access to this global array without write…
superpichon
  • 92
  • 1
  • 8
0
votes
2 answers

Multiple agents thread synchronization

I have a java code, that should be read by multiple agents, which were created by the JADE platform. Each agent has his own thread of execution. Therefore, all my agents run my java code concurrently, but not simultaneously. I've tried using the…
0
votes
0 answers

Synchronization technique to wait till all objects have been processed

In this code, I am first creating a thread that keeps running always. Then I am creating objects and adding them one by one to a queue. The thread picks up object from queue one by one processes them and deletes them. class MyClass { public: …
Atul
  • 3,778
  • 5
  • 47
  • 87
0
votes
6 answers

Implementing thread waiting

I need to write a java program that creates a thread to print integers 1 - 3 inclusive. When 2 is printed, the thread waits until a second thread has finished before printing 3. The second thread prints the letter z three times. possible outputs…
Ruth l
  • 13
  • 1
0
votes
1 answer

Fortran and C++ threading

I have the following Fortran code that calls a C++ function parallel_klu. parallel_klu creates eight threads (to execute another function called factor) every time it is called and after it returns to Fortran the threads are destroyed. program…
Anas
  • 359
  • 1
  • 5
  • 14
0
votes
2 answers

multiple buffers using threads

I need some algorithm help with a multithreaded program I'm writing. It's basically the cp command in unix, but with a read thread and a write thread. I'm using semaphores for thread synchronization. I have structs for buffer and thread data defined…
0
votes
1 answer

Connecting to external webservice fail to response on Android

I'm trying to connect to a external webservice from an Android app, but currently it crashes on the XML response, please help me notice if the call structure is built incorrectly or any the response code is crashed. Here is my code: public class sri…
Luiggi
  • 1
  • 1
0
votes
1 answer

Java notifyAll() doesnt have a queue of itself

Here is a code block from a thread: synchronized(lock) { lock.notifyAll(); System.out.println("waking other threads up with lock:"+lock.hashCode()); } This is called four times and still cannot wake other threads. Other threads having this…
huseyin tugrul buyukisik
  • 11,469
  • 4
  • 45
  • 97
0
votes
1 answer

Calling method in Jframe from external class and thread to set label values

I have two classes, one JFrame, and one external class that implements runnable. The external class I would like to run in its own thread until given an order to stop. I would also like it to update values on the JFrame in the background in its…
justynnuff
  • 461
  • 1
  • 6
  • 20
0
votes
3 answers

java thread communication, independent file reading and wiriting

Java. I have two threads. one will be continuously monitoring for some events and based on the events, it will be updating (addition or deletion) a file. the other thread which is a timer task event, will be updating the same file in regular…
Arun
  • 21
  • 1
  • 6
0
votes
1 answer

Java multi-thread matrix multiplication

Trying to get a multi-threaded matrix multiplication to work in Java. It is given a (m x n) matrix, a (n x k) matrix and 't' threads to perform the operation on. My program works when the matrices are square and t == n. When running with t < n, the…
Jake
  • 13
  • 4
0
votes
1 answer

Is there any better alternative to busy waiting in this case?

I have a Manager class that encapsulates a (rather) low-level facility (e.g. database) and serves as a factory for Worker instances, which use Manager's underlying facility (database) reference Manager from each instance are used concurrently can…
tkroman
  • 4,811
  • 1
  • 26
  • 46