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

learn more… | top users | synonyms (5)

0
votes
3answers
220 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 ...
0
votes
2answers
171 views

How other thread can show the incremented value unless the 1st thread reaches the return statement?

My code is given below. In the for loop I am getting unexpected output i.e. before completing the execution of for loop by 1st thread the 2nd thread comes in for loop and shows incremented value. ...
0
votes
2answers
108 views

When one thread out of four is executing first line in run() then at the same time what will remaining three threads do?

I have four thread instances and they are executing run() code given below: public void run (){ System.out.println("1st line :"+Thread.CurrentThread().getName()); System.out.println("2nd line ...
1
vote
1answer
623 views

When should I use ZeroMQ and when should I use Akka?

My understanding of Akka is that it allows you to define groups of mini-threads ("Actors") and then have them communicate with each other (and do work) using events. My understanding of ZeroMQ is ...
1
vote
1answer
519 views

WCF service - best way to accept requests from a client and do background work?

For a project at work, I was tasked to create a WCF service that will receive email messages from client and queue them on a database, while at the same time the service will check the DB every 30 ...
3
votes
1answer
157 views

Can the possibility of a data race be ignored in some cases? (while having concurrent threads) [duplicate]

I am programming a game engine as a hobby project, and I would like to separate physics and drawing into two separate threads. The position vectors of entities are subject to modifications by the ...
0
votes
1answer
299 views

Export to Excel - threading

I am working on an ASP.NET application. One requirement by the users is they are capable of exporting to Excel of some UIs. I have worked on them using the Infragistics library, and I have supplied ...
0
votes
0answers
66 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
1answer
166 views

Using a progress dialog and multi threading

My .NET Windows desktop application creates an HTML report, and has 3 main phases. It may create multiple reports. I show a progress bar so the user knows (estimates) how long it will take (as well ...
0
votes
0answers
442 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
1answer
114 views

Use of separate threads or singe thread

In my project, on a security system, I was using a socket to get the details of the client and then store it in a database (his IP and port he connected from and service he accessed). I was wondering ...
0
votes
1answer
425 views

Do threads delete themselves?

Let's say I was working on a Swing application. Most of it is run on the EDT using SwingUtilities.invokeLater() inside the main method, because I heard (please correct me if I'm wrong) that that's ...
1
vote
1answer
70 views

Good strategy to implement a listener processing tasks provided by the database

Let's assume this conceptual scenario: The database is constantly populated with "a ton" of tasks named PleaseSendAnEmail. A scheduler/listener in background is aimed to handle those tasks. Of ...
0
votes
2answers
99 views

Locking techniques

Delphi RAD libraries implement many thread friendly objects in a way which forces one to declare another object for storing the reference returned by that object's locking method. The object thus ...
0
votes
1answer
32 views

Difference between TSimpleRWSync's BeginWrite and BeginRead methods?

I have recently switched to TSimpleRWSync from TRTLCriticalSection. The methods BeginRead and BeginWrite confuse me as wherever I read help, they seemingly do the same thing i.e. acquire the critical ...
17
votes
4answers
3k views

Programs that claim they are not “multi-core” friendly

You see this phrase or similar kicked around from time to time, generally referring to a program that claims they were not designed to take full advantage of multi-core processors. This is common ...
0
votes
0answers
19 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, ...
1
vote
1answer
594 views

Running a process multiple times at the same time

I have a c++ program with opencv library which takes an image as input and perform pose estimation,color detection,phog. When I run this program from the command line it takes around 4-5sec to ...
1
vote
3answers
213 views

Is it possible to perform mutual exclusion of threads without OS support?

I suppose you could adapt distributed mutual exclusion algorithms (Ricart/Agrawala, etc), but aside from these more exotic approaches, are you required to use primitives provided by the OS in order to ...
1
vote
1answer
117 views

Non-Recursive vs Recursive Locks?

I am thinking of using non-recursive locks; I have found them to be having performance superiority over the standard recursive locks (e.g. SimpleRWSync). I have mainly been using critical sections but ...
0
votes
0answers
204 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 ...
3
votes
6answers
462 views

Why are threads called threads?

I understand that a process a unit of resource ownership and executable instructions. Threads allow a process to share its resources with multiple executions, and it's easier for an OS to schedule ...
1
vote
2answers
166 views

Emulating communication between Android and microcontroller using threads or services or… other?

I am not sure what is the best way for the tasks below: threads, AsyncTasks, Loopers, services? Why? Are there other candidates? I need threads/Tasks/Services/other for: Plotting data, (refreshing ...
2
votes
2answers
309 views

Should I lock a list of objects while a socket is receiving messages?

I have a scenario where I will be receiving messages through a socket connection. I also need to keep a list of 100 messages (such as List) and periodically toss out old messages from the list when a ...
-2
votes
1answer
244 views

Extracting data from log files

I will be extracting certain bits from log files using regular expressions to filter out bit of data. Initially I was going to do this with Python. I later started to think about the fastest way I can ...
0
votes
0answers
600 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 ...
12
votes
1answer
3k views

Are go-langs goroutine pools just green threads?

The commentator here offers the following criticism of green threads: I was initially sold on the N:M model as a means of having event driven programming without the callback hell. You can write ...
0
votes
0answers
107 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 ...
3
votes
1answer
1k views

Database design/relationship for threading messages

What's the database design or business logic for creating an app for messaging between users? I am having difficulties with choosing how to approach the relationship between each Conversation of User ...
2
votes
2answers
2k views

How Stack and Heap is allocated for threads under the same process in Windows?

Stack for different thread is different.but what about Heap. If Heap is different for different threads, then how they share objects?
2
votes
1answer
271 views

Transactional Memory vs Mutex and Locks

Just found out that Intel processors now have Transactional Memory support !!!! I learned about Transactional operations in my dB/OS class, it is a very simple concept: entire operation is executed or ...
15
votes
1answer
769 views

How can I tell if I am overusing multi-threading?

I currently feel like I am over-using multi-threading. I have 3 types of data, A, B and C. Each A can be converted to multiple Bs and each B can be converted to multiple Cs. I am only interested in ...
1
vote
1answer
130 views

Optimising news fetching

I have a web scraper for scraping news from different sources in wp7. My current appraoch for doing this is: load newspapers information from xml file. go to the specified sections and fetch the ...
0
votes
2answers
181 views

Why would Java app make RPC call to itself?

I am working with a multithreaded homegrown multi-module app in my new job. We use the the Thrift protocol to communicate RPC calls between different stand-alone applications in a distributed system. ...
2
votes
0answers
136 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 ...
2
votes
3answers
210 views

How do I limit the resources available to a program?

I'm delving into multi-threaded programming with Java, but I'm finding it hard to test my program for bugs. My computer simply has too many resources and cores, making it hard to see how my program ...
0
votes
10answers
957 views

Why does the instruction “do” require a “while”? [closed]

Since this statement is so common: while (true) (Java) or while (1) (C) or sometimes for (;;) Why is there not a single instruction for this? I could think that an instruction that could do it ...
0
votes
0answers
556 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 ...
0
votes
1answer
760 views

C# Design for SQL connection and commands

Currently I'm working on system that works with database, and I would like to have it done elegant way. So I have abstracted DBConnection into one class, DBCommands into another class. (DBCommands : ...
1
vote
1answer
999 views

c++ web with nginx - Do I have to worry about thread safety?

I am currently developing my website with c++. I know that nginx handles connections with multiple threads to provide high performance. And not all c++ code is thread safe. What's the relationship ...
3
votes
1answer
130 views

Do you have to ban atomics to get good tool support for race detectors?

It seems that Helgrind treats atomics the same way as normal read/write operations. So, using atomics will result in lots of false positives. I don't know exactly how ThreadSanitizer deals with ...
6
votes
1answer
2k views

Sleeping Barber Problem (with multiple barbers)

The Sleeping Barber Problem is a classical synchronization problem that many of you may be familiar with or at least heard of. It's based on the premise that a barber (a thread) sleeps when there ...
4
votes
2answers
807 views

Managing threads in Java with a good pattern

This morning I began writing a minimal chat using Java socket and threads but it took some minutes for me to experience a lot of problems in the MVC management. Currently I have 3 classes: Main, ...
0
votes
2answers
654 views

Memory allocation of Classes that don't have any global data and locks

static void Main(string[] args) { var c2 = new Class2(); var c3 = new Class3(); var c1 = new Class1(c2, c3); c1.Method1(); } class Class1 { ...
-1
votes
2answers
205 views

When will be safe to choose Multi-thread design without dead lock? [closed]

Sometime we really need to choose a multi-threaded design, because single-threading will block the UI or block another thread. But sometimes using multiple threads is just one of the choices, for ...
1
vote
2answers
223 views

What are the different aspects to consider when porting code from a single threaded environment to a multi threaded environment or vice versa?

I want to provide some library functionality and a reference application, which will run on a fully-featured, POSIX-compliant platform. The app and library will need bi-directional serial port ...
3
votes
1answer
112 views

Are mutexes assigned to specific regions of memory?

I'm currently reading C++ Concurrency in Action by Anthony Williams and I'm facing an obstacle in thought. First he describes deadlocks as when two threads lock simultaneously (at least, that's how I ...
-2
votes
2answers
265 views

What is the point of double check locking?

I have been reading the Wikipedia article on double check locking and one thing that's not clear from it (at least to me) is what the pattern achieves. What is the reason for making the two checks ...
4
votes
1answer
775 views

Design patterns for multi-threaded messaging server

I'm designing an instant messaging server as a personal exercise to improve my understanding and application of multi-threading and design patterns in Java. I'm still designing, there's no code yet. ...
2
votes
1answer
390 views

Python multithreading and utilizing modern processors - what is the downside?

CPython implementation detail: In CPython, due to the Global Interpreter Lock, only one thread can execute Python code at once (even though certain performance-oriented libraries might overcome ...