multithreading

How to design multi-threaded GUI-network application?

I'm working on a small utility application in Python. The networking is gonna send and recieve messages. The GUI is gonna display the messages from the GUI and provide user input for entering messages to be sent. There's also a storage part as I call it, which is gonna get all the network messages and save them in some kind of database...

Get unique identifier of a Thread in Java 1.4

In Java 1.4, is there any better way of getting a Thread's ID than using Thread.getName()? I mean, getName() in unit tests returns something like "Thread-1", but in WebLogic 10 I get "[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'.xml". ...

Create new threads or get more work for threads

I've got a program I'm creating(in C#) and I see two approaches.. 1) A job manager that waits for any number of X threads to finish, when finished it gets the next chunk of work and creates a new thread and gives it that chunk or 2) We create X threads to start, give them each a chunk of work, and when a thread finishes a chunk its as...

Operating System Scheduling Algorithms

What is the best algorithm to use for scheduling an application that will support 10K concurrent threads with heavy I/O but low CPU usage? Links to papers are appreciated. ...

How to know if other threads have finished?

I have one object that have one method named StartDownload(), that starts three threads. How do I make to get a notification when each thread as finished the execution? Is there a way to know in one of the threads if one of the other two is finished or is still executing? ...

How the best solution to solve Vehicle Tracking GPS collecting data in C#?

I have several vehicles that send a data to server each minute. The server should be listening and decode the data to store in the database. There will be thousands of entries per minute. What is the best approach to solve that problem? ...

Using Core Graphics/ Cocoa, can you draw to a bitmap context from a background thread?

I'm drawing offscreen to a CGContext created using CGBitmapContextCreate, then later generating a CGImage from it with CGBitmapContextCreateImage and drawing that onto my view in drawRect (I'm also drawing some other stuff on top of that - this is an exercise in isolating different levels of variability and complexity). This all works f...

Alternative for volatiles with cheapest performance hit

I want to implement the usual cooperative mechanism for canceling a thread. However the java memory model was only fixed in JDK5 while I'm in a pre-JDK5 environment. I understand, this means that doing something like this, as espoused in SCIP, will not be correct. class Worker implements Runnable { private volatile boolean _canceled...

.Net: Retrieving data from threads

This is an Easy Q, but great help: Under title" Retrieving data from threads MSDN (Here) introduces a way to get data from a child thread by using callback method which is encapsulated by a delegate passed from main thread to the child thread - who has the data. You can see that clearly ( the last Example in the MSDN page) My Q is, si...

ThreadPool, QueueUserWorkItem and Deadlock on Shutdown

I just implemented a thread pool like described here Allen Bauer on thread pools Very simple implementation, works fine, but my application no longer shuts down. Seems that two worker threads (and one other thread, I guess the queuing thread) stuck in the function ntdll.ZwRemoveIoCompletion I remember to have read something about IO...

Objective-C Asynchronous Web Request with Cookies

I am writing a program in Objective-C and I need to make web requests to web server, but asynchronously and I am fairly new on mac, I am very good at windows technologies, but I need to know that if I use NSOperation (introduced in 10.5, i am assuming that it will not run in 10.4 MAC?), or if it was implemented such that it utilizes syst...

How to stop worker threads in a multithreaded Windows service on service stop

I have a Windows service that uses the producer/consumer queue model with multiple worker threads processing tasks off a queue. These tasks can be very long running, in the order of many minutes if not hours, and do not involve loops. My question is about the best way to handle the service stop to gracefully end processing on these work...

How to pass parameters to a Thread object?

I'm working with a C++ class-library that provides a Thread base-class where the user has to implement a run() method. Is there a recommended way on how to pass parameters to that run() method? Right now I prefer to pass them via the constructor (as pointers). ...

Compare Function and Multithreading

Assume a multi-threaded environment and a (properly synchronized) class that has one particular procedure procedure SortKeyList (KeyList : TList <Integer>; Inverted : Boolean); that takes a list of keys and sorts it. The procedure uses the RTL quicksort implementation TList.Sort: KeyList.Sort (TComparer <Integer>.Construct (CompareKe...

Progress bar not showing until after task is completed

I have been trying to get a progressbar set to marquee to keep moving while another function is running. After this function runs, I message would display (for this example) The only way I was able to get this working was with a background worker and then have a Do Loop until condition that runs in the main form until the operation i...

Attach UncaughtExceptionHandler to a TimerTask

Hi Is it possible to attach an UncaughtExceptionHandler to a TimerTask? (Other than by calling Thread.setDefaultUncaughtExceptionHandler()) Cheers Rich ...

Using threads and recursion in Java to calculate Fibonacci numbers

I'm relatively new in the Java world and I have a problem which I don't understand. I have a Class (to get the fibonacci row): class Fib { public static int f(int x){ if ( x < 2 ) return 1; else return f(x-1)+ f(x-2); } } The task now is to start f(x-1) and f(x-2) each in a separate Thread. One tim...

Is the Win32 Registry 'thread safe'?

If I have two processes accessing a given registry key (off of HKLM), is it a good idea to wrap the logic in a Mutex? ...

.Net PropertyGrid Thread-safety

I have a PropertyGrid in my application that is used for editing arbitrary objects. I need to be able to run an arbitrary subroutine on another thread that also looks at these objects (search functionality, if you're curious). The obvious issue is that a user could be editing one of these objects at the same time my search thread is re...

Multiprocessor and Performance

Hi! I'm facing a really strange problem with a .Net service. I developed a multithreaded x64 windows service. I tested this service in a x64 server with 8 cores. The performance was great! Now I moved the service to a production server (x64 - 32 cores). During the tests I found out the performance is, at least, 10 times worst than i...