When did the concept of multi-threading come into the picture (as in time frame)? The basis of any multi threading app for performance improvement is the number of cores/processors and the idea of having multiple cores/processors is relatively new thanks to intel/amd, so how was multi-threading implemented in ancient times?
...
I am confused by a code listing in a book i am reading, C# 3 in a Nutshell, on threading.
In the topic on Thread Safety in Application Servers, below code is given as an example of a UserCache:
static class UserCache
{
static Dictionary< int,User> _users = new Dictionary< int, User>();
internal static User GetUser(int id)
{...
Hi All
I have a Runnable running inside a ThreadPoolExecutor long polling on an http request using the HttpClient .
So I am doing the request in a very way :
httpClient = new HttpClient(new MultiThreadedHttpConnectionManager());
clientParams.setSoTimeout(timeout);
HttpMethodBase method = new GetMethod(request.toString());
...
I'm trying to create a Stats counter (similar to the one in ostrich for scala by Twitter) but having a hard time making sure that all my threads have access to this. My Stats class is defined like this:
class Stats
@@counters = {}
.. accessors ..
def self.incr(counter, amt = 1)
if !@@counters[counter]
@@counters[coun...
What are the disadvantages of creating my own threads inside a managed environment like a weblogic application server?
I have always used managed threads (using the WorkManager api) whenever i am working inside an application server.
However I am unclear on the disadvantages or issues that might be caused by using non-managed threads ins...
Hi,
I'm trying to write a simple video manipulator, so several times a second I need to start a new thread (currently implementing Runnable) to process the current frame but I have no guarantee how long each thread will take to finish and as such I want to limit the number of threads that can run at once to the number of processors on...
I'm using a ThreadSafeClientConnManager to perform simultaneous requests in background threads on Android, set up with:
HttpParams params = new BasicHttpParams();
HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
HttpProtocolParams.setContentCharset(params, HTTP.DEFAULT_CONTENT_CHARSET);
HttpProtocolParams.setUseExpectContinu...
Have a 1MB pipe:
if (0 == CreatePipe(&hRead,&hWrite,0,1024*1024))
{
printf("CreatePipe failed\n");
return success;
}
Sending 4000 bytes at a time (bytesReq = 4000)
while ((bytesReq = (FileSize - offset)) != 0)
{
//Send data to Decoder.cpp thread, converting to human readable CSV
if ( (0 == WriteFile(hWrite,
...
We have an Windows32 application in which one thread can stop another to inspect its
state [PC, etc.], by doing SuspendThread/GetThreadContext/ResumeThread.
if (SuspendThread((HANDLE)hComputeThread[threadId])<0) // freeze thread
ThreadOperationFault("SuspendThread","InterruptGranule");
CONTEXT Context, *pContext;
Context.ContextFla...
I am trying to create a Pacman AI for the iPhone, not the Ghost AI, but Pacman himself. I am using A* for pathfinding and I have a very simple app up and running which calculates the shortest path between 2 tiles on the game board avoiding walls.
So running 1 function to calculate a path between 2 points is easy. Once the function reach...
Hi all,
I have a hi-lo Id generator which I use in a multi-threaded environment. The generator can be called up to 100k times per second per thread
I have a reasonably good (and safe) implementation which works fine. IdAllocator is the object that fetches the next "batch" of ids. You can assume this is threadsafe. I also set the ba...
I am getting an EXC_BAD_ACCESS error after I return from a thread method in which I have set up an NSAutoreleasePool. The place of failure is at a call to NSRunLoop. I am trying to wrap a 3rd party library consisting mainly of a class (let's call it the Connection class) and its delegate such that it will behave synchronously instead o...
So I'm running a Java server and in one class I have a static Timer. Then I have another class which has many instances being created and destroyed throughout the life of the program, each with their own TimerTask (using the static Timer). When an instance is destroyed, it calls cancel() on the TimerTask.
The problem is, I'm not sure ...
Have a 1MB pipe:
if (0 == CreatePipe(&hRead,&hWrite,0,1024*1024))
{
printf("CreatePipe failed\n");
return success;
}
Sending 4000 bytes at a time (bytesReq = 4000)
while ((bytesReq = (FileSize - offset)) != 0)
{
//Send data to Decoder.cpp thread, converting to human readable CSV
if ( (0 == WriteFile(hWrite,
...
I am trying to execute lots of tasks using a ThreadPoolExecutor. Below is a hypothetical example:
def workQueue = new ArrayBlockingQueue<Runnable>(3, false)
def threadPoolExecutor = new ThreadPoolExecutor(3, 3, 1L, TimeUnit.HOURS, workQueue)
for(int i = 0; i < 100000; i++)
threadPoolExecutor.execute(runnable)
The problem is that I...
Hi guys,
I'm stuck on a problem for hours now and having read everything about this on stackoverflow (and apply every advices found), I'm now officially in need for help. ;o)
Here is the context :
In my iPhone project, I need to import data on the background and insert it in a managed object context. Following the advices found here, ...
Hi guys,
I need somebody with high skills in threading and event raising.
I have an abstract class A and two concrete classes C1, C2 (e.g plugins).
Since I need them to communicate between each other, like "plugin-application" "plugin-plugin" communication, I have a method ExecuteCommand in the abstract class which should accomplish...
Consider a process which is creating multiple application domains. Do these Application domains share same thread pool? If yes, how is it coordinated between multiple application domains?
...
I need to create a function which appends a value to a vector and returns the index of the value that was just appended.
Example:
int append(std::vector<int>& numbers, int number){
int retval = numbers.size();
// what if some other thread calls push_back(number) in between these calls?
numbers.push_back(number);
return retval;
...
Hi
Firstly, I've never used threads, but have found lots of examples on the internet about their use but nothing that obviously answers my question.
I have a class that loads and manipulates a file(s). It is fairly CPU intensive so I intend to put it in its own thread so that the GUI remains responsive. However, I would also like to us...