multithreading

Design Pattern for multithreaded observers

In a digital signal acquisition system, often data is pushed into an observer in the system by one thread. example from Wikipedia/Observer_pattern: foreach (IObserver observer in observers) observer.Update(message); When e.g. a user action from e.g. a GUI-thread requires the data to stop flowing, you want to break the subject-o...

Do Delphi class vars have global or thread local storage?

My guess is that class variables ("class var") are truly global in storage (that is, one instance for the entire application). But I am wondering whether this is the case, or whether they are thread in storage (eg similar to a "threadvar") - once instance per thread. Anyone know? Edit: changed "scope" to "storage" as this is in fact t...

Has anyone tried transactional memory for C++?

I was checking out Intel's "whatif" site and their Transactional Memory compiler (each thread has to make atomic commits or rollback the system's memory, like a Database would). It seems like a promising way to replace locks and mutexes but I can't find many testimonials. Does anyone here have any input? ...

What programming paradigm will be most successful in future multi-core computers?

Many of us have two or more CPU cores on our desktop today. Most applications work quite similarly to what they did when we had only one core. But what when a typical desktop machine has 1000+ cores? What programming paradigms will we use then. Our current threading and synchronization solutions seldom scale well to that many cores. ...

How do I prevent static variable sharing in the .NET runtime?

I'm working on a game (C#) that uses a Robocode-like programming model: participants inherit a base Class and add strategic behaviors. The game then loads instances of participants' Classes and the competition begins. Unfortunately, participants can "cheat" by sharing static variables between instances of their competitor Class. How do ...

calling thread.start() within its own constructor

is it legal for a thread to call this.start() inside its own constructor? and if so what potential issues can this cause? I understand that the object wont have fully initialized until the constructor has run to completion but aside from this are there any other issues? ...

Can I make Perl ithreads in Windows run concurrently?

I have a Perl script that I'm attempting to set up using Perl Threads (use threads). When I run simple tests everything works, but when I do my actual script (which has the threads running multiple SQL*Plus sessions), each SQL*Plus session runs in order (i.e., thread 1's sqlplus runs steps 1-5, then thread 2's sqlplus runs steps 6-11, e...

Does the unmodifiable wrapper for java collections make them thread safe?

I need to make an ArrayList of ArrayLists thread safe. I also cannot have the client making changes to the collection. Will the unmodifiable wrapper make it thread safe or do I need two wrappers on the collection? ...

switch to parallel coding

we all writing code for single processor. i wonder when we all are able to write code on multi processors? what do we need (software tools, logic, algorithms) for this switching? edit: in my view, as we do many task parallely, same way we need to convert those real life solutions(algorithms) to computer lang. just as OOPs coding did fo...

How do I create a thread dump of a Java Web Start application

Is it possible to get a thread dump of a Java Web Start application? And if so, how? It would be nice if there were a simple solution, which would enable a non-developer (customer) to create a thread dump. Alternatively, is it possible to create a thread dump programmatically? In the Java Web Start Console I can get a list of threads b...

How can I write a lock free structure?

In my multithreaded application and I see heavy lock contention in it, preventing good scalability across multiple cores. I have decided to use lock free programming to solve this. How can I write a lock free structure? ...

SQL Compact Edition 3.5 SP 1 - LockTimeOutException - how to debug?

Intermittently in our app, we encounter LockTimeoutExceptions being throw from SQL CE. We've recently upgraded to 3.5 SP 1, and a number of them seem to have gone away, but we still do see them occasionally. I'm certain it's a bug in our code (which is multi-threaded) but I haven't been able to pin it down precisely. Does anyone have any...

Safe to use TAdsSettings object in the main thread, and AdsQuery objects in other threads?

I have a Win-CGI application I am currently converting to ISAPI. The application uses the TDataset descendants for Extended Systems Advantage Database Server. As there can be only one instance of a TAdsSettings object, this must be in the main thread. TAdsQuery objects are needed in the request threads. Will this work - that is, wil...

time.sleep -- sleeps thread or process?

In Python for the *nix, does time.sleep() block the thread or the process? ...

How to implement thread safe reference counting in C++

How do you implement an efficient and thread safe reference counting system on X86 CPUs in the C++ programming language? I always run into the problem that the critical operations not atomic, and the available X86 Interlock operations are not sufficient for implementing the ref counting system. The following article covers this topic,...

When is multi-threading not a good idea?

I was recently working on an application that sent and received messages over Ethernet and Serial. I was then tasked to add the monitoring of DIO discretes. I throught, "No reason to interrupt the main thread which is involved in message processing, I'll just create another thread that monitors DIO." This decision, howeve...

How to abort a thread in a fast and clean way in java?

Here is my problem: I've got a dialog with some parameters that the user can change (via a spinner for example). Each time one of these parameters is changed, I launch a thread to update a 3D view according to the new parameter value. If the user changes another value (or the same value again by clicking many times on the spinner arrow)...

What is the best way to have synchronized a collection of objects between various threads in .Net?

What is the best way to have synchronized a collection of objects between various threads in .Net? I need to have a List or Dictionary accessed from different threads in a trhead safe mode. With Adds, Removes, Foreachs, etc. ...

When should I consider changing thread priority

I once was asked to increase thread priority to fix a problem. I refused, saying that changing it was dangerous and was not the root cause of the problem. My question is, under what circumstannces should I conider changing priority of threads? ...

VB.Net (or C#) 2008 Multi Threaded Import

I am looking to build a multi-threaded text import facility (generally CSV into SQL Server 2005) and would like to do this in VB.NET but I am not against C#. I have VS 2008 trial and just dont know where to begin. Can anyone point me in the direction of where I can look at and play with the source of a VERY simple multi-threaded appli...