multithreading

Out of Process COM Server - function calls and threads

When you have an out of process COM Server and you call a function from a Client inside this server from Thread X inside the client, then how this function get executed in the COM Server? In the thread its currently executing on, or on its main thread? ...

Is a shared list between multiple threads a race condition?

I've got some multi threaded code that typically runs great, but every so often it will break. I'm trying to pinpoint the problem, but using OpenMP is making that more difficult (the problem does not occur in serial). I know that multiple access to a variable (race conditions) often crashes a program. I've got a list shared between the ...

Design for fastest page download

I have a file with millions of URLs/IPs and have to write a program to download the pages really fast. The connection rate should be at least 6000/s and file download speed at least 2000 with avg. 15kb file size. The network bandwidth is 1 Gbps. My approach so far has been: Creating 600 socket threads with each having 60 sockets and us...

Measuring CPU time per-thread on Windows

I'm developing a long-running multi-threaded Python application for Windows, and I want the process to know the CPU time that each of its threads has taken. I can get the overall times for the entire process with os.times() but I need to know the per-thread times. I know that there are external tools such as the Sysinternals Process Ex...

Multidimensional Array Initialization: Any benefit from Threading?

say I have the following code: char[5][5] array; for(int i =0; i < 5; ++i) { for(int j = 0; j < 5; ++i) { array[i][j] = //random char; } } Would there be a benefit for initializing each row in this array in a separate thread? Imagine instead of a 5 by 5 array, we have a 10 by 10? n x n? Also, this is done once, d...

Does this variable need to be declared volatile?

Does the out variable in the MyThread class need to be declared volatile in this code or will the "volatility" of the stdout variable in the ThreadTest class carry over? import java.io.PrintStream; class MyThread implements Runnable { int id; PrintStream out; // should this be declared volatile? MyThread(int id, PrintStrea...

How to improve multi-threaded access to Cache (custom implementation)

I have a custom Cache implementation, which allows to cache TCacheable<TKey> descendants using LRU (Least Recently Used) cache replacement algorithm. Every time an element is accessed, it is bubbled up to the top of the LRU queue using the following synchronized function: // a single instance is created to handle all TCacheable<T> elem...

how to update UI controls in cocoa application from background thread

following is .m code: #import "ThreadLabAppDelegate.h" @interface ThreadLabAppDelegate() - (void)processStart; - (void)processCompleted; @end @implementation ThreadLabAppDelegate @synthesize isProcessStarted; - (void)awakeFromNib { //Set levelindicator's maximum value [levelIndicator setMaxValue:1000]; } - (void)dealloc {...

Difference between performSelectorInBackground and NSOperation Subclass

I have created one testing app for running deep counter loop. I run the loop fuction in background thread using performSelectorInBackground and also NSOperation subclass separately. I am also using performSelectorOnMainThread to notify main thread within backgroundthread method and [NSNotificationCenter defaultCenter] postNotificationN...

Qt cross thread call

I have a Qt/C++ application, with the usual GUI thread, and a network thread. The network thread is using an external library, which has its own select() based event loop... so the network thread isn't using Qt's event system. At the moment, the network thread just emit()s signals when various events occur, such as a successful connecti...

can a python script know that another instance of the same script is running... and then talk to it?

I'd like to prevent multiple instances of the same long-running python command-line script from running at the same time, and I'd like the new instance to be able to send data to the original instance before the new instance commits suicide. How can I do this in a cross-platform way? Specifically, I'd like to enable the following behav...

Polling servers at the same port - Threads and Java

Hi there. I'm currently busy working on an IP ban tool for the early versions of Call of Duty 1. (Apparently such a feature wasn't implemented in these versions). I've finished a single threaded application but it won't perform well enough for multiple servers, which is why I am trying to implement threading. Right now, each server ha...

How to share a dictionary between multiple processes in python without locking

I need to share a huge dictionary (around 1 gb in size) between multiple processs, however since all processes will always read from it. I dont need locking. Is there any way to share a dictionary without locking? The multiprocessing module in python provides an Array class which allows sharing without locking by setting lock=f...

How can I access values on the UI thread?

I have no issues invoking actions on UI controls through BeginInvoke and such, however, that's a void method. I need to get a value from a textbox for use in a different thread. How can I accomplish this? ...

Form gets disposed somehow

I have a client-server application, in which I use classic Sockets and threads for receiving/sending data and listening for clients. The application works fine, but after some random time I get the ObjectDisposedException: System.ObjectDisposedException: Cannot access a disposed object. Object name: 'MainForm'. at System.Windows.For...

WPF BackgroundWorker Execution

Hi All, I've been programming C# for a while now (I'm a Computer Science major), and have never had to implement threading. I am currently building an application for a client that requires threading for a series of operations. Due to the nature of the client/provider agreement, I cannot release the source I am working with. The code ...

Caveats to be aware of when using threading in Python?

I'm quite new to threading in Python and have a couple of beginner questions. When starting more than say fifty threads using the Python threading module I start getting MemoryError. The threads themselves are very slim and not very memory hungry, so it seems like it is the overhead of the threading that causes the memory issues. Is t...

Java CountDownLatch used to wait for JFrame to dispose

I have referenced this previous question as well as other sources, but cannot get CountDownLatch to work correctly. Background: mainFrame creates new Frame called dataEntryFrame. When dataEntryFrame "Submit" button is clicked, record added to database and dataEntryFrame disposed. At this point, mainFrame should clear and reload a jL...

C# Add class instance with internal timer to a static List, is it safe?

My program has a static list of type classA. ClassA implements a threading timer that executes a task. The list may contain as many instances of classA as desired. Is this technique causing threading issues where the class instances can block each other? It that is the case how can I solve the that problem. ex: static List<MyClassType> ...

Understanding CLR 2.0 Memory Model

Joe Duffy, gives 6 rules that describe the CLR 2.0+ memory model (it's actual implementation, not any ECMA standard) I'm writing down my attempt at figuring this out, mostly as a way of rubber ducking, but if I make a mistake in my logic, at least someone here will be able to catch it before it causes me grief. Rule 1: Data dependence ...