multithreading

Please point me the tools or the way to monitor which thead in running in the millisecond level

Hi , Please point me the tools or the way to monitor which thead in running in the millisecond level? Thanks. Suppose I have 3 thread running , and I want infomation like below: 0 - 20ms thread1 20 - 40ms thread2 40 - 50ms thread1 50 - 70ms thread3 NOTES: I perfer to solve this problem without hacking into kernel. EDIT : ...

Keeping a UISegmentedControl (among others) responsive

I have a segmented control being used as a toggle. When toggled, I switch a bunch of contents around in a table view which takes a tiny but noticeable amount of time (inserting/deleting sections in the table view, animating the change, etc). I want the segmented control to respond to the selection immediately. So in my action handlin...

JDBC unwanted statement close

Hello I have a Java JDBC application that uses multiple threads to retrieve information from an Oracle data base. Each thread si supposed to periodically execute a statement that executes a select on a specific table (the table is different for each row). The threads are instances of a class that extends the Thread class. This class ha...

How hard do operating systems try to minimize TLB flushes?

I wonder if there is a common mechanism implemented in operating systems to minimize TLB flushes, by for instance grouping threads in the same process together in a "to be scheduled" list. I think this is an important factor when deciding between using processes against threads. If OS doesn't care whether the next thread is in the same ...

How to Find CPU Utilization of a Single Thread within a Process

Hi All, I am looking a Tool on How to Find CPU Utilization of a Single Thread within a Process in VC++. It would be great full if any one could provide me a tool. Also it could be better if you guys provide how to do programmatically. Thank you in Advance. ...

Non-threadsafe file I/O in C/C++

While troubleshooting some performance problems in our apps, I found out that C's stdio.h functions (and, at least for our vendor, C++'s fstream classes) are threadsafe. As a result, every time I do something as simple as fgetc, the RTL has to acquire a lock, read a byte, and release the lock. This is not good for performance. What's ...

How can you abort a thread and have code still executing in that thread?

A book as the following example and explains that you won't see the line "DoWork has ended": ...because the thread was aborted while DoWork was executing Thread.Sleep That makes sense, but what is odd is that if you change the first sleep to 6000 to give the DoWork thread time to get done with its 5000 sleep, then the DoWork th...

How do I tell the Hotspot JVM whether to use single or multi-processor thread-synchronization?

The Machine is Dual-Core, the OS uses a Multi-Processor kernel. In order to run some performance assessments, I want to set the thread-affinity of the JVM to a single core. However, I am worried that I will get skewed performance measurements as the JVM may be unaware that it is now constrained to a single core, but still using multi-pro...

Does a variable accessed by multiple threads in a java servlet need to be declared volatile?

In the book Java Servlet Programming, there's an example servlet on page 54 which searches for primes in a background thread. Each time a client accesses the servlet, the most recently found prime number is returned. The variable which is used to store the most recently found prime is declared as such: long lastprime = 0; Since this...

Getting multiple Java pop3 clients to work with GMail.

Hello, I have written a nice program in Java that connects to a gmail account and download atachments sent to it. Once an attachment has been downloaded, it is marked as read and is not downloaded ever again. This program will have to run in multiple instances with each program downloading unique attachments so that a single attachment i...

performSelectorInBackgroundThread and NSTimer

For a game I'm developing, I call an expensive method from one of the touch processing routines. In order to make it faster, I decided to use performSelectorInBackgroundThread, so instead of: [gameModel processPendingNotifications]; I switched to: [gameModel performSelectorInBackground:@selector(processPendingNotifications) withObje...

TcpListener: How can I detect a client disconnect ?

How can I detect when a client disconnects from the TcpListener ? Each of my clients is handled in a separate thread. ...

Throttling CPU/Memory usage of a Thread in Java?

I'm writing an application that will have multiple threads running, and want to throttle the CPU/memory usage of those threads. There is a similar question for C++, but I want to try and avoid using C++ and JNI if possible. I realize this might not be possible using a higher level language, but I'm curious to see if anyone has any idea...

How is Java's ThreadLocal implemented under the hood?

How is ThreadLocal implemented? Is it implemented in Java (using some concurrent map from ThreadID to object), or does it use some JVM hook to do it more efficiently? ...

wpf threading, backgroundworker, dispatcher

I am new to wpf threading, now that we have backgroundworker and dispatcher classes, classic winforms threading issues are no longer a problem? ...

Update integrated progress bar in original activity

Hi, I've been trying to get my progress bar view to work in my file scanner application, and I'm thoroughly stumped by the proper combination of Activities, Services, Threads, and Handlers. Here's the structure: My Activity contains a Horizontal-styled ProgressBar. On menu item click, I spawn a Service which, onCreate(), which is where ...

How to Invoke on background thread

Is there a way to invoke a method on a background thread ? I am aware of BackgroundWorker/Creating a thread or use ThreadPool.QueueUserWorkItem etc but that's not the answer i am looking for for e.g. the SCSF has attributes to ensure the method is invoked on a background or a UI thread I'd like to do something similar for a small app ...

Why isn't the thread stopping?

My service spawns a new thread, and stops it according to the typically recommended java method of interrupt()'ing. When I stop the service, I stop the thread in onDestroy(). The service is stopped, and the interrupt code is reached. However, soon enough the thread restarts from the beginning of the Runnable. public class DoScan extends...

best way to handle multiple threads in a Win Forms Application

We have an application with multiple subsystems running in different threads (ie one thread monitors the GPS, another monitors a RFID reader etc). The threads are started and monitored by a service registry which is seperate from the win forms part. The initial release of the App just had a single form which would run on an update tim...

Thread creating BackgroundWorkers seems to queue up the Completed events

I am noticing some strange behaviour with BackgroundWorkers and the events they're firing where the events seem to be queuing up in one thread while the CPU isn't actually being used. Basically the design of the system is that, based on user interaction, a thread is created to send off a web request to fetch some data. Based on the res...