multithreading

iPhone multi-threaded AddressBook manipulation

Hi, I have been using the AddressBook api of the iPhone for some time now. But doing some refactoring to improve application performance I have decided to "reuse" the ABAddressBookRef returned by AddressBookCreate because I noticed there are large performance improvements doing that. However, I am getting EXEC_BAD_ACCESS errors now ra...

Are indivisible operations still indivisible on multiprocessor and multicore systems?

As per the title, plus what are the limitations and gotchas. For example, on x86 processors, alignment for most data types is optional - an optimisation rather than a requirement. That means that a pointer may be stored at an unaligned address, which in turn means that pointer might be split over a cache page boundary. Obviously this c...

What is a good way to test that a Java method is synchronized?

I have several classes that implement some interface. The interface has a contract, that some methods should be synchronized, and some should not, and I want to verify that contract through unit tests for all the implementations. The methods should use the synchronized keyword or be locked on this - very similar to the synchronizedColl...

C# BackgroundWorker's culture

Hi, I woudl like to set the culture for my whole application. I tried the following : Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(wantedCulture); Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(wantedCulture); Application.CurrentCulture = CultureInfo.CreateSpecificCulture(wantedCul...

Static method to be accessed by multiple threads, Java

Hi, I am using a third party library to do hand evaluation of 7 card poker hands. The method evaluate in this library is declared as public static and I believe it alters some global static arrays within the class. The problem I have is that as I am doing an enumeration algorithm of about 10m enumerations I want to parallelize it, there...

Java thread pools - thread number in logs

I am using a networking library which uses a thread pool for delegating tasks to specialized request handlers. In the logs of the library I see the following: [05.03.2010 16:11:27] [pool-3-thread-9] DEBUG ... [05.03.2010 16:11:27] [pool-1-thread-447] DEBUG ...... [05.03.2010 16:11:27] [pool-1-thread-447] DEBUG .... [05.03.2010 16:11:27]...

Thread Quantum?

What is a thread quantum, and how can I identify it on my system? ...

What is the best way of achieving this threading/event behaviour in Java?

I have a thread (Runnable) that starts a number of other threads (Runnables). When each child thread finishes it needs to raise an event (or something similar) and return a notification to the parent thread. I can't see any events in Java (ala C#) - I had hoped I could just subscribe in the parent to the child object's 'I'm finished even...

Can I spread out a long running stored proc accross multiple CPU's?

[Also on SuperUser - http://superuser.com/questions/116600/can-i-spead-out-a-long-running-stored-proc-accross-multiple-cpus] I have a stored procedure in SQL server the gets, and decrypts a block of data. ( Credit cards in this case. ) Most of the time, the performance is tolerable, but there are a couple customers where the process is...

Need help understanding _set_security_error_handler()

So , I've been reading this article: http://msdn.microsoft.com/en-us/library/aa290051%28VS.71%29.aspx And I would like to define my custom handler.However, I'm not sure I understand the mechanics well.What happens after a call is made to the user-defined function ( e.g. the argument of _set_security_error_handler() ) ? Does the program...

Is Java ArrayList / String / atomic variable reading thread safe?

Hi all, I've been mulling this over & reading but can find an absolute authoritative answer. I have several deep data structures made up of objects containing ArrayLists, Strings & primitive values. I can guarantee that the data in these structures will not change (no thread will ever make structural changes to lists, change references...

Do spurious wakeups affect Thread.sleep?

Do spurious wakeups affect calls to Thread.sleep(x)? Obviously, the timer is not 100% precise (leading to minor inaccuracies in wakeup times), but is it affected by the spurious wakeup problem? ...

Logging in worker threads spawned from a pylons application does not seem to work

I have a pylons application where, under certain cirumstances I want to spawn multiple worker threads to process items in a queue. Right now we aren't making use of a ThreadPool (would be ideal, but we'll add that in later). The main problem is that the worker threads logging does not get written to the log files. When I run the code ou...

Running function from an unmanaged dll inside a C# thread.

Here's my problem: I have an unmanaged dll that I made.I'm calling one of this dll's functions in my C# code, using PInvoke. Under certain conditions, in the dll function, I want to be able to terminate the thread that is running the function.How would I achieve that? Sorry if it is a stupid question, but I'm a total noob when it comes ...

Processing long-running operations from a windows service.

Edit (again): Let me simplify my problem. I have a Windows Service that exposes some WCF endpoints with methods like: int ExecuteQuery(string query) { // asynchronously execute query that may take 1 second to 20 minutes return queryId; } string GetStatus(int queryId) { // return the status of the query (# of results so far, e...

Ruby multithreading / multiprocessing readings.

Can anyone recommend any good multithreading / processing books / sites which go into detail about the intricacies of Ruby multithreading / multiprocessing? I tried using ruby threading and basically in deadlock-free code on 1.9vm it ran into deadlocks in jruby. Yes I realize the differences are drastic (jruby has no GIL) but I wanted t...

What multithreading paradigm is described here?

A snippet from Managed Threading Best Practices on MSDN: Don't control the execution of worker threads from your main program (using events, for example). Instead, design your program so that worker threads are responsible for waiting until work is available, executing it, and notifying other parts of your program when finished. If you...

Understanding CUDA grid dimensions, block dimensions and threads organization (simple explanation)

How threads are organized to be executed by a GPU? ...

Access a thread to notify it from another method (Android application)

Hi everybody, I'm developping an android application and trying to deal with threads without really knowing a lot about them... (Yeah bit stupid of me, I know) I'll try to explain it properly and quite quickly. In the onCreate method of my activity, I'm calling an AlertDialog to make the user choose to either load data from the internet...

Changing GUI from a thread that's not the main thread?

My idea is to have a view that is showing the user when something is calculated behind the scenes. It is a view with a height of 30px containing an UIActivityIndicatorView and an UILabel showing what is beeing calculated right now. I tried to implement it by having a ActivityHandler with these methods: - (void)newActivityStarted{ [...