Multi threaded application on server slower than single threaded (unlike in JUnit tests)
By : user2933180
Date : March 29 2020, 07:55 AM
To fix the issue you can do I don't know exactly what the problem was, but it seems that it was caused by a bad implementation of the Executor interface. I'm now using code :
ExecutorService executor = Executors.newFixedThreadPool(nThreads);
Thread.sleep(100);
|
JAVA consumer-producer multi-threaded application - flow of code
By : munixpx
Date : March 29 2020, 07:55 AM
This might help you I was practicing this famous application and have a question. I found there are 4000 Q/A on this topic in this site, but none of them is related to this point and hence asking this question. , You asked
|
Multi-threaded managed application that calls native code
By : PaB
Date : March 29 2020, 07:55 AM
I hope this helps you . Do you need a shared buffer? If the buffer is only ever used on one thread, you save yourself a lot of trouble. Managed threads do not map to native threads 1:1, but I'm not sure if that has any effect on your scenario. You need to fix the buffer, and keep it fixed the whole time the native code has a pointer to it - releasing is the least of your worries, the .NET memory is moved around all the time. This is done using the fixed block. Fixing managed memory: code :
byte[] theBuffer = new byte[256];
fixed (byte* ptr = &theBuffer[0])
{
// The pointer is now fixed - the GC is prohibited from moving the memory
TheNativeFunction(ptr);
}
// Unfixed again
|
Timer in reusable code in a multi-threaded application
By : dwolf248
Date : March 29 2020, 07:55 AM
it helps some times You can use pthread_kill which let you signal a given thread. You can then use a daemon thread that calls sleep and pthread_kill in a controlled loop to clock your given thread. If you care about global process timers interactions with sleep, then you can use usleep (or nanosleep).
|
How to measure code performance in a multi threaded application?
By : Slava Auer
Date : March 29 2020, 07:55 AM
|