multithreading

WPF Frame in separate thread?

I have an application where when a person types or selects a listbox there's a portion of the screen that dynamically updates to a new view. The problem is since WPF runs everything in a single thread the displaying of the view can interfer with typing or navigating making the app less responsive. What i'd like to do is run the view por...

Performance counters for current threads

Hi, I am building a .NET windows service which is using an unmanaged C++ dll. both of my service and the c++ dll are using multi threading. I am running out of memory after some time (hours) while processing. I tried to measure the number of threads using "Performance counters" and I monitors the following values: # of current logical T...

Does a static variable takes only one memory location for all running threads?

Given that a static variable of a class takes only one memory location, is it shared by all threads of process? Or is one memory location for such a variable created for each of the running threads? Also, if all threads share the same memory location, how can we ensure mutual exclusion? ...

What is unsafe in this extreme simple thread Monitor implementation?

I am new in thread syncronization. I was reading many implementations of conditional variables, like boost::threads and pthread for win32. I just implemented this quite simple monitor with wait/notify/noifyall, and i guess that there are many hidden problems with it, that I would like to discover from more experienced people. Any suggest...

What is the context switching time ?

I have a doubt in context switching. In multi threading, when the context switching occurs, what will be the time between two context switches? Is it fixed time interval? ...

Availability of windows form during processing

I'm doing an application that does some sort of scanning (it checks availability of URL's through a short list) and depending on the result, it adds to one or another listbox. if it exists, it goes to lstOK, else, it goes to lst404. The issue is that these web checks take time (specially when it is OK), it takes an awfully long time, an...

asp.net ThreadPool - long running operation.

My application is a asp.net 3.5 running on iis 6 (windows 2003) This application is serving 1000's of users daily (100-500 users online). I want to send an email newsletter to customers weekly. Around 200,000 emails every time. This is the code im using: ThreadPool.QueueUserWorkItem(new WaitCallback(AsyncProcessMailerQueue), null);...

Processor Affinity on Linux

Hi all, Thanks for all the answers so far! I am having a Dual Core processers and I would like to have all the processes running on core1 but one. I know now that I can use taskset to set all currently running to be bound to processor 1 for example. Now I would like that my OWN application is scheduled for execution on processor 2 inst...

Is python a serious option for concurrent programming

Hi just considering starting to learning python but I have one concern before I invest more time. Let me phrase this as a statement followed by a concern for others to comment on as perhaps the assumptions in the statement are invalid: I have read about GIL and the consensus seems to be if you require concurrent solutions in python you...

What happens to other thread when one thread get blocked?

In Linux, if two threads are created and both of them are running, when one of them calls recv() or any IO syscall that blocks when no data is available, what would happen to the whole process? Will the other thread block also? I guess this depends on how threading is implemented. If thread library is in user space and kernel totally u...

if timer is elapsed.; i want to run some codes but error return?

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Timers; using System.IO; namespace TimerApp4 { class Program { public static int k; static void Main(string[] args) { Timer t = new Timer(1000); t.Elapsed += new ElapsedEventHandler(S...

Process.waitFor(), threads, and InputStreams

In pseudocode, here's what I'm doing: Process proc = runtime.exec(command); processOutputStreamInThread(proc.getInputStream()); processOutputStreamInThread(proc.getErrorStream()); proc.waitFor() However, sometimes processOutputStreamInThread doesn't see any output and sometimes it does. Roughly, the method creates a BufferedInputStre...

Can I get C's pthread.h to compile in Windows?

If I try to compile a program with #include <pthread.h> in it, I get the error: pthread.h: No such file or directory Is it possible to get this to compile in a Windows environment? I am using Vista with the latest mingw I do not want to use the Microsoft Windows Services for UNIX Version 3.5 as I will have to move this to a Unix en...

.net Hashtable insert failed. Load factor too high.

Hello, I'm getting this error: Hashtable insert failed. Load factor too high. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: Hashtabl...

Do you expect that future CPU generations are not cache coherent?

I'm designing a program and i found that assuming implicit cache coherency make the design much much easier. For example my single writer (always the same thread) multiple reader (always other threads) scenarios are not using any mutexes. It's not a problem for current Intel CPU's. But i want this program to generate income for at leas...

For C++ MacOSX app, what threading library to use?

I'm on MacOSX, writing an app in C++. What threading library should I use? pThreads? or is there something else? Thanks! ...

GL rendering thread on the iphone, is it worth it?

I am new to iphone and haven't done any threading on it at all. It seems that calls to drawElements are taking a big chunk of my processing time, so it makes me think that a large amount of rendering is being done before the code is allowed to continue past the call. does anyone know how the parallelism of openGL works? or how it works ...

How do I replace an executable with a mock executable in a test?

Can I replace an executable (accessed via a system call from ruby) with an executable that expects certain input and supplies the expected output in a consistent amount of time? I'm mainly operating on Mac OSX 10.6 (Snow Leopard), but I also have access to Linux and Windows. I'm using MRI ruby 1.8.7. Background: I'm looking at doing sev...

Why is windows select() not always notifying thread B's select() when thread A closes its end of a socket pair?

Hi all, A situation I have under Windows XP (SP3) has been driving me nuts, and I'm reaching the end of my tether, so maybe someone can provide some inspiration. I have a C++ networking program (non-GUI). This program is built to compile and run under Windows, MacOS/X, and Linux, so it uses select() and non-blocking I/O as the basis f...

java.util.concurrent : calculating primes

Hi all, I'm new to the package java.util.concurrent. I've created the following program testing if a number is a prime using a multi and a monothreaded strategy. import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class IsPrime implements Runnable { private static final long UPPER...