Multi-threading related questions including technique, structure, and safety issues.

learn more… | top users | synonyms (3)

2
votes
2answers
171 views

Implementation strategies for atomic counter

I basically have a counter variable that is decremented and frequently polled. There are three options to implement that, that I can think of: Number 1: private volatile int count; public void ...
0
votes
2answers
141 views

MVC pattern synchronisation

I am facing a problem in synchronizing my model and view threads I have a view which is table. In it, user can select a few rows. I update the view as soon as the user clicks on any row since I don't ...
1
vote
1answer
58 views

Should CountDownLatch be used for waiting for an event?

I have a situation here, where I have a loop that loops x amount of times. The value x is determined by the user. Everytime it loops, I want it to wait for a button click before continuing the loop. ...
2
votes
0answers
132 views

Scheduling a few CPU-intensive tasks

I need to schedule a small number of CPU-intensive tasks to run every so often, reading from shared data and writing to dedicated buffers. I don't necessarily want to roll my own scheduling, but am ...
2
votes
0answers
107 views

How can I make a universal construction more efficient?

A "universal construction" is a wrapper class for a sequential object that enables it to be linearized (a strong consistency condition for concurrent objects). For instance, here's an adapted ...
1
vote
0answers
105 views

Alternatives to Pessimistic Locking in Cluster Applications

I am researching alternatives to database-level pessimistic locking to achieve transaction isolation in a cluster of Java applications going against the same database. Synchronizing concurrent access ...
1
vote
0answers
436 views

Java UDP Multithread Server

I have multiple threads. Each thread receives data and sends to client an acknowledge packet. Each thread takes aprox. 531ms from start to finish. While capturing packets with wireshark. I was ...
1
vote
0answers
99 views

Thread safety IDE warnings

I wonder, would it not be possible for an IDE to detect any shared mutable objects that are used in multiple threads? You could flag types as either [ThreadSafe] or [Immutable] using attributes in ...
0
votes
0answers
28 views

API providing function to be run in a thread vs. thread that runs this function

I'm writing a Python library which exposes a certain event listener interface. The user can register callbacks to handle different types of events. There is also a function which handles the actual ...
0
votes
0answers
34 views

Why is sem_post pthread_mutex_lock protected while sem_wait is not?

All the pthread semaphore examples I have seen protect the sem_post call with a pthread_mutex_lock, but the sem_wait is left unprotected! It seems to me that sem_wait also should be protected in some ...
0
votes
0answers
63 views

Primes and multi-threading

I use to compute primes using linear code which took a long time. As I've an 8 cores processor I thought about multi-threading. At first I use to put a huge number of int in a vector then share the ...
0
votes
0answers
323 views

Make a java program use more processors

I am running a program that is supposed to solve a problem with the brute force approach. My computer has a quad-core CPU. When I run the program clearly java uses only one core, because in my ...
0
votes
0answers
17 views

Threading and async intterupting on same process and thread, along with related

So, I'm trying to understand threads. I realize they are a mix of hardware and OS decisions. I also know that a thread, or process, has a set of register/stack variables and functions. In each thread, ...
0
votes
0answers
153 views

Managing child worker thread list

After so much research, I thought I should ask the experts. I am working on a project for my corporate employer, we have android and iPhone mobile apps that make request to a web service, the request ...
0
votes
0answers
467 views

Best method for async initialization of view model in MVVM pattern (WPF)

I'm working on a business application (C#, WPF, EF, MVVM). I need to load a bunch of items from database, create view models for them and put them in a window. Is there a way to create the view model ...
0
votes
0answers
101 views

Why user threads are mapped to Kernel threads

Since user threads are mapped to kernel threads, why don't we create all threads as kernel threads that is a process with zero user thread. Doesn't mapping of user thread to kernel thread create ...