multithreading

Selection between ACE & Boost for learning

Hi everyone, I am an intermediate c++ programmer and done some work using ACE, now I want to learn one of those Libraries thoroughly to progress in to my career. That why I need your kind help to make a decision, that what should I learn first. And also please consider my destinations are to be an expert network programmer and Protocol d...

Java: synchronized method

Dear all, we have two threads accessing one list via a synchronized method. Can we a) rely on the run time to make sure that each of them will receive access to the method based on the order they tried to or b) does the VM follow any other rules c) is there a better way to serialize the requests? Many thanks! ...

Actor based development - implementation questions

Hello, it's my first message here and I'm glad to join this community. It looks like that everything is now going towards multi-thread development. Big fishes say that it won't take longer to reach hundreds of cores. I've recently read about actor based development and how wonderful message passing is to handle concurrent programming. ...

Thread to receive data from an ip and port

I would like to write a program to receive some data using tcpClient from a specified ip and port number. First time I did it using while(true). Friend of mine told me to use thread instead of while loop. So I did as he said. public static void receiveThread() { TcpClient tcpClient = new TcpClient(); try { tcpClient....

What does .NET add to Windows/Linux processes and threads?

As far as I know, .NET uses Windows processes. What extra state information & functionality does it add to information contained in Windows thread/process descriptors? And what is different in Linux (on Mono)? ...

Object serializing performance

Let's say I have a simple tcp server generating an array inside a thread, serializes it and sends it to a client over tcp connection and when it reaches the client, the client deserializes it and performs something...ie. continuous calculation. Well it's a pretty straight forward process but I would like to know if the process has any pe...

Threading mechanism: preparing and releasing a cache in the background

Preface: This has become a quite a long post. While I'm not new to programming, I have close to zero practice around threading and could need some help here... This is probably a common problem that could be described in shorted words, but I'm a bit overwhelmed with it. Some background first... I'm writing code for the iPhone where I ...

Delphi: Threaded list of thread jobs - queueing

Hi, I have some operations which are based on TThreads. Now I need to create the thread containing the list of jobs to be done, then firing each one as soon as the previous finishes... How should I write it? I can't allow the threads to be ran simultaneously as there might be over 10 000 operations to be done. It is quite hard to find ...

How do I make one Java thread return before some of its child threads finish?

I have 2 nested threads. First thread starts multiple instances of second thread. Each second thread has to sleep for some time (5 seconds). I want to start the first thread and return a message to user immediately, but it seems my first thread waits until all the children of second thread to finish. How can I achieve this? Any help? ...

Is it better to use TThread's "Synchronize" or use Window Messages for IPC between main and child thread?

I have a rather simple multi-threaded VCL gui application written with Delphi 2007. I do some processing in multiple child threads (up to 16 concurrent) that need to update a grid control on my main form (simply posting strings to a grid). None of the child threads ever talk to each-other. My initial design involved calling TThread's "S...

C# - Multithreading - Sharing Data

Is it possible for threads to share data (Global Variables) in same process. ...

Why is Thread.interrupt() acting like this?

This is a modification of code from the Java tutorial on Concurrency package threads; public class SimpleThreads { static void threadMessage(String msg) { String threadName = Thread.currentThread().getName(); System.out.format("%s: %s%n", threadName,msg); } private static class MessageLoop implements Runnable{ @Override pub...

Multithreaded Java server: allowing one thread to access another one

Hopefully the code itself explains the issue here: class Server { public void main() { // ... ServerSocket serverSocket = new ServerSocket(PORT); while (true) { Socket socket = serverSocket.accept(); Thread thread = new Thread(new Session(socket)); thread.start(); } // .. } public...

Synchronizing on two or more objects (Java)

I have code similar to following: public class Cache{ private final Object lock = new Object(); private HashMap<Integer, TreeMap<Long, Integer>> cache = new HashMap<Integer, TreeMap<Long, Integer>>(); private AtomicLong FREESPACE = new AtomicLong(102400); private void putInCache(TreeMap<Long, Integer> tempMap, int fileNr){ i...

Adding a child to Viewport3D asynchronously gives "This API was accessed with arguments from the wrong context."

When I try to add 3D-content to a Viewport3D, asynchronously, this results in "This API was accessed with arguments from the wrong context." in a TargetInvocationException. The 3D-content is generated from the data of a 3D-scanning device. The communication&calculations needed for that are done in a separate thread. First, I tried to a...

Performance impact of Processes vs Threads

Clearly if performance is critical it makes sense to prototype and profile. But all the same, wisdom and advice can be sought on StackOverflow :) For the handling of highly parallel tasks where inter-task communication is infrequent or suits message-passing, is there a performance disadvantage to using processes (fork() etc) or threads...

Extending FutureTask, how to handle cancel

I've extended FutureTask from java.util.concurrent to provide callbacks to track the execution of tasks submitted to an ExecutorService. public class StatusTask<V> extends FutureTask<V> { private final ITaskStatusHandler<V> statusHandler; public StatusTask(Callable<V> callable, ITaskStatusHandler<V> statusHandler){ sup...

Algorithm should I create a new thread?

Is there an algorithm that checks whether creating a new thread pays off performance wise? I'll set a maximum of threads that can be created anyway but if I add just one task it wouldn't be an advantage to start a new thread for that. The programming language I use is python. Edit 1# Can this question even be answered or is it to gener...

Synchronization on the local variables

Hi community! I have a multithreaded Java code in which: several threads read stateful objects from the synchronized shared storage (i.e. as a result of this, some threads may reference the same objects); each thread then invokes a method process() and passes its object there; process() processes objects in some way, which may result ...

C# Threads - Interruption

Normally will we interrupt a thread which is in "WaitSleepJoin" state or "Running" state? ...