multithreading

What's the maximum number of threads in Windows Server 2003?

Does anyone know? And a bigger question is what happens when you encounter this maximum? Is this the same number with other Windows OSs such as Vista, XP etc.? ...

How many threads is too many?

I am writing a server, and I branch each action off into a thread when the request is incoming. I do this because almost every request is a database query. I am using a threadpool library to cut down on construction/destruction of threads. My question is though - what is a good cutoff point for I/O threads like these? I know it would ju...

Beginner-level Python threading problems

As someone new to GUI development in Python (with pyGTK), I've just started learning about threading. To test out my skills, I've written a simple little GTK interface with a start/stop button. The goal is that when it is clicked, a thread starts that quickly increments a number in the text box, while keeping the GUI responsive. I've go...

Programmatically limit CPU Usage of a Thread running inside a Service

I'm using VB9 (VS2008). I've created a Windows Service that indexes some folders regularly. Is there a way I can put an upper limit on the CPU usage depending upon the current system state, i.e., if the system is idle, the thread can use the CPU as much as it needs, but if there are other programs/processes running then it should use t...

Memory leak while using Threads

Hello. I appear to have a memory leak in this piece of code. It is a console app, which creates a couple of classes (WorkerThread), each of which writes to the console at specified intervals. The Threading.Timer is used to do this, hence writing to the console is performed in a separate thread (the TimerCallback is called in a seperate t...

Reader / Writer Lock with timeout using conditional variable

How to write a Reader/Writer lock with timeout, using conditional variables in C/C++? ...

Task manager shows 9MB Mem Usage while the thread performing Service function is Sleeping

I'm developing a Desktop Search Engine in VB9 (VS2008). Is it normal for a Service to take up 9MB of Memory while the only Thread involved in the Service is sleeping? The code includes following import statements... Imports System Imports System.IO Imports Microsoft.Win32 Imports System.Threading There are a few class variables in t...

How to lock a file on different application levels?

Here's the scenario: I have a multi threaded java web application which is running inside a servlet container. The application is deployed multiple times inside the servlet container. There are multiple servlet containers running on different servers. Perhaps this graph makes it clear: server1 +- servlet container +- application1 ...

Is there any way for executing a method multiple times, but managing connections/threads? (.NET)

I have a method that uses a connection (e.g. a method that downloads a page). I have to execute this method multiple times (e.g. download 1000 pages). Doing it the synchronous and sequential way takes a long time. I have limited resources ( 8 max threads and/or 50 max simultaneous connections ) I want to use all resources to accelerate ...

Single-Threaded Apartments vs Multi-Threaded Apartments

All ThreadPool threads are in the multithreaded apartment. --As per the MSDN What does that mean? I am really concerned with what the difference between the multi vs single threaded apartment model is. Or what does the apartment model mean? I have read the MSDN on it, and it doesn't really make sense to me. I think I may have an ...

Is it possible to put an event handler on a different thread to the caller?

Lets say I have a component called Tasking (that I cannot modify) which exposes a method “DoTask” that does some possibly lengthy calculations and returns the result in via an event TaskCompleted. Normally this is called in a windows form that the user closes after she gets the results. In my particular scenario I need to associate so...

Is WPF Dispatcher the solution of multi threading problems ?

Hi, I have a very bad feeling about using lock in my code but now the Dispatcher of WindowBase exists and I want to use it everywhere. For example I use a multi thread singleton WCF service who publish events on the EventAggregator of PRISM, the payload is immutable (it is just data) and every thread with a dispatcher can retrieve the...

What is an analog for win32 file locking in boost::interprocess?

What sync mechanism should I use to give exclusive access to the text file in boost? The file will likely be accessed by threads from only one process. ...

Equivalent of "pthread_rwlock_timedrdlock()" and "pthread_rwlock_timedwrlock()" in MSVC/Windows

What is the equivalent of following POSIX timed Reader/Writer locks in windows(MSVC)? pthread_rwlock_timedrdlock() pthread_rwlock_timedwrlock() ...

Client Server programming in python?

Here is source code for multithreaed server and client in python. PROBLEM: In the code client and server closes connection after the job is finished. I want to keep the connections alive and send more data over the same connections to avoid overhead of closing and opening sockets everytime. What is the best way to do this? I am new to...

RMI Thread terminating due to java.lang.OutOfMemoryError: Java heap space

Hi All, I am working on a comp based application. In this application there are n number of containers that communicate to each other via rmi services they provide to each other. At a certaion point One rmi thread conneccted to my container is lost the connection due to out of memory error ,but all other RMI thred connected to my contai...

How to create multiple thread

Hi I want to create multiple thread in my game. One thread is for timer and other for touch event. Because when i am running this game on iphone timer conflict the touch events so touch event will not be detected. Its working smooth on iphone simulator but on iphone or on itouch its became very slow. So i m using thread for touch and ...

Is it safe to construct Swing/AWT widgets NOT on the Event Dispatch Thread?

I've been integrating the Substance look and feel into my application and ran into several problems regarding it's internal EDT (Event Dispatch Thread) checking routines. Substance absolutely refuses to construct UI classes outside of the EDT. I've done plenty of Swing/AWT and I know most of the rules regarding the EDT. I use SwingWorker...

Timeout on a Python function call

I'm calling a function in Python which I know may stall and force me to restart the script. How do I call the function or what do I wrap it in so that if it takes longer than 5 seconds the script cancels it and does something else. Thanks ...

Question about best practice to implement static functoin that gives unique value on simultaneous access

A staticfunction retUnique() return me a unique value. My question is that if there are many users who are using the same function at a given point of time, what happens? Is there a best practice to make sure that each users accessing this static function simultaneously get a unique value and also do not face threading issues. Can one...