multithreading

Running multiple background parallel jobs with Rails

On my Ruby on Rails application I need to execute 50 background jobs in parallel. Each job creates a TCP connection to a different server, fecths some data and updates an active record object. I know different solutions to perform this task but any of them in parallel. For example, delayed_job (DJ) could be a great solution if only it c...

Send SMS at a same point of time

Hi, Previously I posted a question regarding multithreading. Actually my intension is to send SMS for 1000 (or more) people at a same point of time (Ex: 12:00 AM sharp) by using c# and asp.net application. Is it ok to choose multithreading concept to achieve this? ...

How to identify memory consuming requests in ASP.Net

The IIS http log tells me the time taken, so it's easy to identify long-running requests. But how can I identify the memory consumption of each request thread? From within the process code I can easily get the size of the workingset for the entire process, but not of a request thread itself. IIS 6 + Framework 3.5 Nick ...

Word Tearing on x86

Under what circumstances is it unsafe to have two different threads simultaneously writing to adjacent elements of the same array on x86? I understand that on some DS9K-like architectures with insane memory models this can cause word tearing, but on x86 single bytes are addressable. For example, in the D programming language real is a...

onApplicationEnd - Is CF actually shutting down?

Hi all I need to use onApplicationEnd() as part of Application.cfc to execute a call on a 3rd party Java object to close a connection to another device on the network. The code I have worked perfectly if I call it as a normal request, but when I place it in the onApplicationEnd() method I'm running into some errors. These errors sugg...

Can a shutdown hook rely on another thread?

In a shutdown hook method, I need it to send a message to another process to say it has shutdown. My current message handling code requires that the message be written into a queue, this queue is processed by another thread and sent on to wherever it is going. In this case, to be written into a pipe file by another thread. In a shutdown...

.Net: Threadify heavy API calls

I have a email queue with email to be send. A webservice calls a SOAP webservice that processes the queue one by one. We send email using an external vendor using their REST API. My problem is that calls to this API can take from 0.1ms to 12s. We sent thousands of emails to customer that subscribe to our notices and it important that i...

Is it possible to create a real nondetached (joinable) thread in iPhone OS?

I wonder what would happen when I create a joinable thread for writing some big data to "disk". Now, the docs say I can do so by using POSIX threads. Nice! But: Another guy at Apple said, that an app has like 5 seconds or so to quit when the user presses the home button. So for my understanding a "real" nondetached thread has the sense t...

How to scale a TCP listener on modern multicore/multisocket machines....

I have a daemon to write in C, that will need to handle 20-150K TCP connections simultaneously. They are long running connections, and rarely ever tear down. They have a very small amount of data (rarely exceeding MTU even.. it's a stimulus/response protocol) in transmit at any given time, but response times to them are critical. I'm ...

How can I effectively test (unit/integration) concurrent code in Java?

I saw this post on SO already but it still begs the question, at least for Java. It seems that this should be a pressing issue for any app (i'm testing a web app for this use case) that's multi-threaded. How have you guys dealt with it in a way that allows your threads to interleave -- inherently meaning testing random thread behavior. ...

What exactly is considered to be called the "Run Loop" here?

Before keeping on reading in the docs, my brain got stuck at this point: - (void)threadMainRoutine { BOOL moreWorkToDo = YES; BOOL exitNow = NO; NSRunLoop *runLoop = [NSRunLoop currentRunLoop]; // is this THE run loop? // some stuff... while (moreWorkToDo && !exitNow) { // or is THIS the run loop? // some stu...

WCF ConcurrencyMode.Multiple Connection best practices and Caching

I've got a WCF service with the following settings: NetNamedPipeBinding ConcurrencyMode.Multiple InstanceContextMode.Single Now I've got a client that accesses to this WCF service in a multi-threaded fashion. As far as I understand I have to open a new connection to the service for each thread to avoid threads to block each others. ...

Which requests cause a w3wp process to grow considerably?

On a production environment, how can one discover which Asp.Net http requests, whether aspx or asmx or custom, are causing the most memory pressure within a w3wp.exe process? I don't mean memory leaks here. It's a good healthy application that disposes all it's objects nicely. Microsoft's generational GC does it's work fine. Some reques...

glutPostRedisplay in a different thread

I have a standard glut implementation. The display function redraws each object, but I need a constant update on certain values of each object. As it is, the only way I can think to do this is to spawn a thread to handle the updating. However, I can't use glutPostRedisplay() from a different thread to get glut to refresh the window. What...

How to implement thread library ?

Is writing a code for implementing the thread library a part of kernel code ? Is the function implementation of pthread_create() et al a part of kernel ? ...

How to join one thread with other in java?

I have one main thread that starts 10 other threads. I want that the main thread will be finished only after all other threads stopped. So should I call join() on other 10 threads before starting or after starting them. For instance: // in the main() method of Main thread Thread [] threads = new Thread[10]; for(int i = 0; i < 10; i++) {...

How to stop threads in Java?

I have made a java program with GUI and I want a stop button functionality in which when a user clicks on the stop button, the program must be stopped. In my program, the main thread starts other 10 threads and I want that whenever the stop button has been clicked all the 10 threads must be stopped before the main thread. Second, I als...

How to log into separate files per thread with Log4Net?

My application uses several threads with well-defined names (i.e. not a thread pool with 'anonymous' threads). Right now, all of these threads send their log messages to one file - and although the thread ID is part of the log line, this makes it very hard to analyse the application behaviour. Thus, I want each thread to log into its own...

run time detection of processor type - atomic operations

I am implementing some speed critical multithreaded code. I can avoid having some critical sections if I know for certain that some basic write operations are atomic. I just read an academic paper in which I saw the following: "Writes of the basic types size t, int, float and pointer must be atomic. Writes by one thread must be seen by ...

Lock in properties, good approach?

Hi, In my multithreading application I am using some variables that can be altered by many instances in the same time. It is weird but it has worked fine without any problem..but of course I need to make it thread-safe. I am just beginning with locks so I would appretiate your advice: When client connects, class Client is created where ...