multithreading

Multithreaded application in a multicore processor

Hi All, This is a somewhat generic question. Suppose that I am creating a simple application in Java or VC++ which creates two threads and I run the application in a multicore system. Without any specific directive for which core to run, will the application itself will distribute the threads across various cores? Thanks. ...

Java: Multiple threads vs. sockets

I've written a simple application in Java where there are two nodes, each with a ServerSocket open to a port listening for incoming connections. The nodes run two threads each, sending 1000 messages to the other node through a persistent TCP socket created when sending the first message. However, the nodes do not receive all 1000 message...

SynchronizationContext.Post(...) in transport event handler

We have a method which, due to threading in the client application requires the usage of SynchronizationContext. There is a bit of code which one of my colleagues has written which doesnt "feel" right to me, and a performance profiler is telling me that quit a lot of processing is being used in this bit of code. void transportHelper_Su...

What is the case against F#?

Straightforward C#/Java code is extremely difficult to parallelize, multi-thread, etc. As a result, straightforward C#/Java code will use less and less of the total processing power on a box (because everything is now going to be multi-core). Solving this problem in C# and Java is not simple. Mutability and side effects are key to get...

How do threaded systems cope with shared data being being cached by different cpus?

I'm coming largely from a c++ background, but I think this question applies to threading in any language. Here's the scenario: We have two threads (ThreadA and ThreadB), and a value x in shared memory Assume that access to x is appropriately controlled by a mutex (or other suitable synchronization control) If the threads happen to run ...

What type of diagram is best suited for visualizing threading issues such as contentions?

While debugging an issue with our system, I have discovered a thread contention that is causing a bottleneck. I need to explain the phenomenon to other people involved in handling this issue. Some of them are not from development team (yet, they are reasonably technical). So what type of diagrams can be used to depict threading issues...

Will multi threading provide any performance boost?

Hello everyone, I am new to programming in general so please keep that in mind when you answer my question. I have a program that takes a large 3D array (1 billion elements) and sums up elements along the various axis to produce a 2D array of a projection of each side of the data. The problem here is that it is very ram intensive as th...

Best code to generate 1,000,000 files from Database

Using C#, I want to generate 1,000,000 files from DB, each record in separate file. What is the best way to generate this files in minimum time? Here is my code without threading : AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit); // to calculate the execution time in case of using threading SqlCom...

Why does Flex use a single threaded model?

Over the past few weeks I have been building a prototype application using a Flex front end connected to a J2EE backend using blazeDS. The prototype is an experiment to learn flex and see what its suitability is for a complex trading application requiring a large number of dynamic updates (i.e > 20 a second) via a pub sub type model. D...

How are threads executed on multiple processors on Windows?

I am on Windows (Windows 7, XP and Vista). If I create a multi-threaded program, will the threads be executed on all available cores? Is it automatic? Is it guaranteed? For example, if I have four threads and four processors, will the threads be executed one on each processor/core? ...

WinForms UI responsiveness when dealing with "heavy" data.

I'm modifying a windows form to allow data to be loaded in the background while the UI remains responsive. The data takes noticeable time to both retrieve and bind. Ideally, I would do both in the background, but there is some ambiguity about what kind of UI updates I should be doing in the background (as in outside the main thread). ...

Is using synchronized on a Java DAO going to cause issues?

Is using the 'synchronized' keyword on methods in a Java DAO going to cause issues when used by a web application? I ask because I have a multi-threaded stand alone application that needs the methods to by synchronized to avoid resource conflict, as seen here. java.util.concurrent.ExecutionException: javax.persistence.PersistenceExcept...

Handling Thread Exceptions in WCF

Our WCF services occaisionally spawn a worker thread to handle something that the client doesn't care about. The worker threads do not report any status back to the client. In fact, the service has probably already returned results to the client by the time the thread finishes. One of these background threads recently caused an except...

Utility to view threads in a Java process

I've got a java application on a windows machine which pins the CPU from time to time. Would like to run a utility to get an idea of how many threads etc that application is creating. Is there such a utility? ...

How do I create and show WPF windows on separate threads?

Hello, I need to create two (or more) WPF windows from the same process. But the windows must be handled by separate threads because they should not be able to block each other. How do I do this? In WinForms this is achieved by: Start a new thread Create a form from the new thread Call Application.Run with the form as parameter But...

Java - Multiple selectors in multiple threads for nonblocking sockets

Hi there, I'm writing a Java application that will instantiate objects of a class to represent clients that have connected and registered with an external system on the other side of my application. Each client object has two nested classes within it, representing front-end and back-end. the front-end class will continuously receive da...

Swing Thread Callbacks

Any suggestions on how I can cleanup the following code pattern that repeats multiple times in my app. new Thread(new Runnable() { public void run() { // Do some work here SwingUtilities.invokeLater(new Runnable() { public void run() { // Update the Swing Interface to reflect the change } }); } }).st...

How to create a thread in Delphi?

Hello, I use the following function to show controls on my form: class procedure TFormMain.FadeControls(ctrl:Array of TwinControl); var element:TwinControl; begin for element in ctrl do begin PrepareForAnimation(element); element.Visible := true; AnimShowControl(element,250); end; end; However,it slows down with 250...

Threading Building Blocks (TBB) for Qt-based CD ripper?

I am building a CD ripper application in C++ and Qt. I would like to parallelize the application such that multiple tracks can be encoded concurrently. Therefore, I have structured the application in such a way that encoding a track is a "Task", and I'm working on a mechanism to run some number of these Tasks concurrently. I could, of ...

Synchronizing events based one com objects

Hello everyone. I am using API that originally was written with native code and wrapped with .net interops. The API is work asynchronic way when each operation raises event when it finished. All my logic is synchronic so I want to synchronizing the operations. I doing it with EventWaitHandle. here the code Stock stock; private System.T...