multithreading

Way to synchronize two cores in simulation

Hi guys, I have to build a dual-core processor simulator in C (it's actually a multilevel memory simulation, cache L1/L2, block substitution, etc). Thing is, I'm having a hard time figuring a way to synchronize the cores (which I'm programming as threads). Any ideas how I could do a global clock? Should I change from threads to child pro...

Is it possible to change the priority of garbage Collector thread?

Java garbage collector runs with priority 1, due to which it is not guaranteed that System.gc() will actually execute if called. Is there any way to change its priority? This shall enable me to run if I want. ...

waveOut (Win32API) and multithreading

Hi I cannot find any information about the thread-safety of the waveOut API. After i creating new waveOut handle, i have those threads: Thread 1: Buffers handling. Uses those API functions: waveOutPrepareHeader waveOutWrite waveOutUnprepareHeader Thread 2: Gui, Controller thread. Uses those API functions: waveOutPause waveOutRes...

Typical usage scenario to using the ReaderWriterLockSlim property count fields.

I've recently upgraded to ReaderWriterLockSlim for an app i'm writing from the much fatter ReaderWriterLock and apparently more prone to deadlock situations. I see for the new slim lock, there are a number of count properties which can show current read counts, waiting write count, waiting read count. Is their is standard usage scenar...

Portable thread-safe lazy singleton

Greetings to all. I'm trying to write a thread safe lazy singleton for future use. Here's the best I could come up with. Can anyone spot any problems with it? The key assumption is that static initialization occurs in a single thread before dynamic initialisations. (this will be used for a commercial project and company is not using boo...

Can i start a thread in a catch in JAVA

I am trying to solve the collatz conjecture. I am using HashMap and Vector classes. I have to iterate the loop 2 147 483 648 times, but after I store 8,438,409 values in HashMap I'm getting an OutOfMemoryError. I'm running the program in Eclipse and have set -Xmx1024m option, but it didn't help. So, I'm catching the above error and try...

waiting for results if necessary

hi, i'm creating a web page which contains a few dynamically generated images. in my page request handling i create all of the images and store them in a memory cache until they are subsequently requested by the browser. public class CachedImage { byte[] data; Date created; } currently, my image cache is essentially a HashMa...

What is the difference between corePoolSize and maxPoolSize in the Spring ThreadPoolTaskExecutor

I have to send out massEmails to all users of a website. I want to use a thread pool for each email that is sent out. Currently I have set the values to : <property name="corePoolSize" value="500" /> <property name="maxPoolSize" value="1000" /> What is the difference between the two and will it scale. Currently I have approx. 10000 us...

HTTP request using threading from iphone

Can anyone point out a turorial which explains threading?? In my application, i'm uploading some data (even large sized images) to the servelet. The uploading process may take quite a large time depending on the bandwidth, as usual. So i need to implement threading in it so that the uploading process takes place in the background. Any ex...

How to start/stop/restart a thread in Java?

I am having a real hard time finding a way to start, stop, and restart a thread in Java. Specifically, I have a class Task (currently implements Runnable) in a file Task.java. My main application needs to be able to START this task on a thread, STOP (kill) the thread when it needs to, and sometimes KILL & RESTART the thread ... My firs...

Looking for an example of a custom SynchronizationContext

I need a custom SynchronizationContext that: Owns a single thread that runs "Posts" and "Sends" delegates Does the send in the order they are send in No other methods are needed I need this so I can unit test some threading code that will talk to WinForm in the real application. Before I write my own, I was hoping that someone coul...

Producer Consumer With AutoResetEvent

I'm trying to use the producer consumer pattern to process and save some data. I'm using AutoResetEvent for signalling between the two therads here is the code I have Here is the producer function public Results[] Evaluate() { processingComplete = false; resultQueue.Clear(); for (int i = 0; i < data.Length...

Checking Mutex release

I have a multithreaded application written in C++. And I'm using mutex for file writes. I have a suspicion that somewhere during the execution of the program, the mutex isn't being released. So I was wondering if there was a way to check for mutex locks and releases on a file, programmatically or otherwise. I'm running the code on SuseLi...

how to implement logging in multithreaded ASP.NET web application (asmx web service)

I'm developing a time-critical ASMX web service and I'm currently using own class with static methods to write lines to shared log file. Logging is not guarded by locks/Monitors because application writes log quite a lot. I don't know what happens if a thread is scheduled out while in static method writing a line and another thread sched...

A better threading model for this class?

Hi, I have a simple class called Job with a public ctor and public function called Run(). Run() will do some work including making a request to a 3rd party vendor which cost some $$$. Before it makes the request, it first checks the SQL Server DB to see if the data is already there. After making the request, it puts the data in the DB....

Standalone, OS-independent, Architecture-neutral, Multi-threaded Library

What multi-threaded C++ library can be used for writing Linux, Windows, Solaris, and iPhone applications? Such as: TBB Boost OpenMP ACE POCO Any others? ...

Where is the MSDN documentation on multi-process window ownership for win32? (chrome uses this)

where is the MSDN documentation that describes how multiple processes can control and own other windows in other processes like Google chrome? ...

How to call a C function from random places inside another function ?

Can anyone tell me how to insert a function call (say Yield() ) at random places inside a C function , so that each time the code is run , Yield() gets called from different parts of the code ? I am faced with such a requirement as I'm using 2 threads in a cooperative threading environment , where unless the running thread yields the pr...

Return value from thread

How do I get a thread to return a tuple or any value of my choice back to the parent in Python? ...

Synchronized list for threaded application

I'm using active object design pattern. I need a list, which holds user defined objects of the same type. Multiple writers push the objects to the list and readers can wait on the queue in a timed manner. I know I can wrap an STL list, but maybe there ready solution in boost? I just can't find it. UPD: The application runs on Linux ...