multithreading

how to set a infinite loop and break it. (Java threads)

i have set a thread and i want to run it using a loop. so this thread should run in the loop and break in a certain time and again run the loop. please i have no clue how to do this. can someone guide me. ...

tomcat multithreading problem

Hi all I'm writing a java application that runs in Tomcat, on a multi-core hardware. The application executes an algorithm and returns the answer to the user. The problem is that even when I run two requests simultaneously, the tomcat process uses at most one CPU core. As far as I understand each request in Tomcat is executed in separate...

SDLJava joystick events in a thread

I have a class which uses SDLJava to process events from multiple joysticks. When I put a 'main' in the class and run the file, all the joysticks are correctly detected and all events at received and processed in the class. When I add a 'run' method (which does the same as 'main') and run the class as a thread, all joysticks are detect...

silverlight. Wait end async method in sync method.

Hello guys. I've got strange issue. I want wait end async call at sync function call. At other projects I successfully use ResetEvents, but in sl it don't seem to be working. //Sync call save some value in storage public static void SaveValue(string key, object value, bool encrypted) { if (encrypted) { ...

Will Multi threading increase the speed of the calculation on Single Processor

On a single processor, Will multi-threading increse the speed of the calculation. As we all know that, multi-threading is used for Increasing the User responsiveness and achieved by sepating UI thread and calculation thread. But lets talk about only console application. Will multi-threading increases the speed of the calculation. Do we g...

Optimize code performance when odd/even threads are doing different things in CUDA

I have two large vectors, I am trying to do some sort of element multiplication, where an even-numbered element in the first vector is multiplied by the next odd-numbered element in the second vector... and where the odd-numbered element in the first vector is multiplied by the preceding even-numbered element in the second vector. For e...

When Should I Use Threads?

As far as I'm concerned, the ideal amount of threads is 3: one for the UI, one for CPU resources, and one for IO resources. But I'm probably wrong. I'm just getting introduced to them, but I've always used one for the UI and one for everything else. When should I use threads and how? How do I know if I should be using them? ...

How to pass around event as parameter in c#

Am writing unit test for a multi-threading application, where I need to wait until a specific event triggered so that I know the asyn operation is done. E.g. When I call repository.add(something), I wait for event AfterChange before doing any assertion. So I write a util function to do that. public static void SyncAction(EventHandle...

Safe to update separate regions of a BufferedImage in separate threads?

I have a collection of BufferedImage instances, one main image and some subimages created by calling getSubImage on the main image. The subimages do not overlap. I am also making modifications to the subimage and I want to split this into multiple threads, one per subimage. From my understanding of how BufferedImage, Raster and DataBu...

What run-time issues are present when using thread-level memory-protection/paging?

Okay, so we support per-process memory paging/protection today. I've been wondering for years what sort of benefit is gained by offering page-level protections to what is arguably the smallest execution unit our OSes support today: threads. This question on Software Transactional Memory brought it back to the forefront for me. Benef...

Actor pool in scala

I have a project that is actor-based and for one part of it I must use some actors that receive message after that one actor assigns to each request separately and each actor is responsible for doing its message request, so I need something like a thread pool for actors of my project, are there any features in Scala that is useful for my...

VS2008 Suspending all threads upon hitting breakpoint

I must be missing something.. (I'm used to using eclipse) Visual Studio 2008 appears to suspend all threads when I hit a breakpoint - is this normal? If so, is there an option that will only suspend the thread on which the breakpoint has hit? ...

What is the difference between `Synclock syncroot` and `SyncLock Me`?

vb.Net multithreading question: What is the difference between SyncLock syncRoot ''# Do Stuff End SyncLock -and- SyncLock Me ''# Do Stuff End SyncLock ...

How does lock(syncRoot) make sense on a static method?

The following code is excerpted from the (Windows Identity Foundation SDK) template that MS uses to create a new Security Token Service Web Site. public static CustomSecurityTokenServiceConfiguration Current { get { var key = CustomSecurityTokenServiceConfigurationKey; var httpAppState = HttpContext.Curren...

Problems with Threading in Python 2.5, KeyError: 51, Help debugging?

I have a python script which runs a particular script large number of times (for monte carlo purpose) and the way I have scripted it is that, I queue up the script the desired number of times it should be run then I spawn threads and each thread runs the script once and again when its done. Once the script in a particular thread is fini...

WPF: issue updating UI from background thread

My code launches a background thread. The background thread makes changes and wants the UI in the main thread to update. The code that launches the thread then waits looks something like: Thread fThread = new Thread(new ThreadStart(PerformSync)); fThread.IsBackground = true; fThread.Start...

Stopping function on event in vb.net

I have a vb.net application which does some processing. This processing can take a while. The application doesn't respond until the processing has ended and then it handle all events (such as click on buttons) that the user has done during the processing. I'd like to add a "Stop" button so that the user can stop the processing at some po...

Is SynchronizationContext.Post() threadsafe?

This is a pretty basic question, and I imagine that it is, but I can't find any definitive answer. Is SynchronizationContext.Post() threadsafe? I have a member variable which holds the main thread's context, and _context.Post() is being called from multiple threads. I imagine that Post() could be called simultaneously on the object. Sho...

iphone dev - loading table content asynchronously

My app has a navigation controller which push and pop a series of views. One of the tableViews loads .xml file from URL and it takes 4-5 seconds. If I click the back button on the navigation bar, it will only respond after the content of the table finish loading. Is there an easy way to load the content asynchronously so that the app wil...

Can't get past 2542 Threads in Java on 4GB iMac OSX 10.6.3 Snow Leopard (32bit)

I am running the following program trying to figure out how to configure my JVM to get the maximum number of threads my machine can support. For those that might not know, Snow Leopard ships with Java 6. I tried starting it with defaults, and the following command lines, I always get the Out of Memory Error at Thread 2542 no matter what...