multithreading

Multithreaded image processing in C++

I am working on a program which manipulates images of different sizes. Many of these manipulations read pixel data from an input and write to a separate output (e.g. blur). This is done on a per-pixel basis. Such image mapulations are very stressful on the CPU. I would like to use multithreading to speed things up. How would I do th...

Benchmark problems for testing concurency

For one of the projects I'm doing right now, I need to look at the performance (amongst other things) of different concurrent enabled programming languages. At the moment I'm looking into comparing stackless python and C++ PThreads, so the focus is on these two languages, but other languages will probably be tested later. Ofcourse the c...

Forcing threads in a service to wait for another thread to finish

I'm writing a service that has five different methods that can take between 5 seconds and 5 minutes to run. The service will schedule these different methods to run at different intervals. I don't want any of the methods to run concurrently, so how do I have the methods check to see if another method is running and queue itself to run ...

Writing Multithreaded Exception-Safe Code

What are the tensions between multithreading and exception-safety in C++? Are there good guidelines to follow? Does a thread terminate because of an uncaught exception? ...

Parallelizing the "Reduce" in "MapReduce"

I understand how Map is easily parallelizable - each computer/CPU can just operate on a small portion of the array. Is Reduce/foldl parallelizable? It seems like each computation depends on the previous one. Is it just parallelizable for certain types of functions? ...

CherryPy for a webhosting control panel application

For quite a long time I've wanted to start a pet project that will aim in time to become a web hosting control panel, but mainly focused on Python hosting -- meaning I would like to make a way for users to generate/start Django/ other frameworks projects right from the panel. I seemed to have found the perfect tool to build my app with i...

Cocoa Threadsafe Mutable Collection Access

I'm creating a KVC/KVO-compliant mutable array on one of my objects the recommended way: @interface Factory { NSMutableArray *widgets; } - (NSArray *)widgets; - (void)insertObject:(id)obj inWidgetsAtIndex:(NSUInteger)idx; - (void)removeObjectFromWidgetsAtIndex:(NSUInteger)idx; @end Clearly this is a tricky thread-safety issue. In ...

Windows threading: _beginthread vs _beginthreadex vs CreateThread C++

What's a better way to start a thread? I'm trying to determine what are the advantages/disadvantages of _beginthread, _beginthreadex and CreateThread. All of these functions return a thread handle to a newly created thread, I already know that CreateThread provides a little extra information when an error occurs (it can be checked by c...

Are singleton classes thread-safe in IIS?

I have an ASP.NET webpage running under IIS that uses a common assembly that contains a singleton class. Should I implement a locking mechanism on the singleton to make it thread-safe? Or, will any connection to the webserver use the same instance of the singleton? Hopefully I'm asking this coherently. ...

Threadsafe UITableView

I'm using a UITableView to show some data from an array. This array can be changed at any time by other threads. (I believe that whether the array is mutable, or just replaced entirely, doesn't make a difference.) Access to the array itself is threadsafe. What's the proper way to ensure thread safety with regard to the tableview? I'm wo...

Use of threads in C++

Hi friends. Can you tell me how can I use threads in C++ programs, and how can I compile it as it will be multithreaded? Can you tell me some good site where I can start from root? Thanks ...

Parallelization: What causes Java threads to block other than synchronization & I/O?

Short version is in the title. Long version: I am working on a program for scientific optimization using Java. The workload of the program can be divided into parallel and serial phases -- parallel phases meaning that highly parallelizable work is being performed. To speed up the program (it runs for hours/days) I create a number of t...

Avoid connection timeout when using multiple threads and connection pool

I'm splitting up a readonly database operation into multiple chunks, (Each of which reads a subset of a very large amount of data, analyzes it and writes the results to a disk file). Each chunk performs a Select (into a datatable) on a new .net thread (using a delegate and BeginInvoke) There are more subsets of the data than there are ...

c# contextswitchdeadlock

Hi Whilst debugging my program in VS 2008 I have come across the following error: The CLR has been unable to transition from COM context 0x34fc1a0 to COM context 0x34fc258 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation wi...

In C# what is the recommended way of passing data between 2 threads?

I have my main GUI thread, and a second thread running inside it's own ApplicationContext (to keep it alive, even when there is no work to be done). I want to call a method on my 2nd thread from my GUI thread, but if I just call thread.Method(); it seems to be running on my main GUI thread and causes my GUI to become unresponsive. What i...

How to display progressbar if waithandle is used.

Somewhere in the code, a waitHandle is used to perfom some actions. However the thing with waithandle is that the form freezes while waiting for some action to complete. So the following code would not work: frmProgressBar.show(); int successOrFail = PerformSynchronousActionUsingWaitHandle(); frmProgressBar.close(); frmMainScreen.show()...

"Step over" when debugging multithreaded programs in visual studio

One thing that annoys me when debugging programs in visual studio (2005 in my case) is that when I use "step over" (by pressing F10) to execute to the next line of code, I often end up reaching that particular line of code in a totally different thread than the one I was looking at. This means that all the context of what I was doing was...

Help me with that CrossThread?

This code is executed by many way. When it's executed by the form button it works (the button start a thread and in the loop it call this method = it works). BUT it doesn't work when I have a call to that method from my BackgroundWorker in the form. With the following code: private void resizeThreadSafe(int width, int height) { if...

How can I create and start a parameterized thread in .NET 1.1?

.NET 1.1 lacks ParameterizedThreadStart (I have to use 1.1 because it's the last one supporting NT 4.0) In .NET 2.0, I would simply write: Thread clientThread = new Thread(new ParameterizedThreadStart(SomeThreadProc)); clientThread.Start(someThreadParams); How can I create equivalent .NET 1.1 code? ...

Python subprocess.call() fails when using pythonw.exe

I have some Python code that works correctly when I use python.exe to run it, but fails if I use pythonw.exe. def runStuff(commandLine): outputFileName = 'somefile.txt' outputFile = open(outputFileName, "w") try: result = subprocess.call(commandLine, shell=True, stdout=outputFile) except...