I'm trying to gain a better understanding of how multi-core processors work and how as a programmer I can take advantage of them.
Let's say I have a standard .net console app. It doesn't do any multithreading. Does it only run on 1 of the cores? If so which core does it run on and is it the same one everytime?
Now let's say I have anot...
Guys,
I have a C# program that executes a thread. Inside this thread, I have the following code:
string strDropDownValue = (string)ddlVersion.SelectedItem;
I am trying to retrieve the selected value from the drop down list. This line works, obviously, in a single threaded application. Because I'm doing this from a thread though, I ge...
I'm studying delegates and simple threading, I tried it in a ComboBox control, and experimented in a DataGridViewComboBoxColumn (cause I thought it would be the same) but it seems there's no Invoke property for this kind.
How can I set DataGridViewComboBoxColumn properties in a thread?
Please see my code, this works for setting the prop...
With the code below, how will I know if my thread is already done doing tasks? My purpose is to kill that thread in order to free memory. Or how should I do it?
private delegate void DelegateSetProperties(DataTable dataSource, string valueMember, string displayMember);
Thread thread1;
DelegateSetProperties delegateSetProperties...
In my application, I use ExecutorService a lot for making async calls.
ExecutorService executorService = Executors.newFixedThreadPool(10);
And I shutdown the executorService only when the app (web based) shuts down. Recently when debugging some issues I was looking through this code and wondering whether there can be cases during the...
I use the following code for handling an async response:
private static void RespCallback(IAsyncResult ar)
{
// Get the RequestState object from the async result.
RequestState rs = (RequestState)ar.AsyncState;
// Get the WebRequest from RequestState.
WebRequest req = rs.Re...
I am writing a multi threaded server app that requires stability and high performance. I'm looking at using Boost for some data structures I need.
Is an intrusive data structure better or worse for something that should be thread safe and needs fast access, insertion, etc:::: ?
...
I've developed a Webbapp that makes an extensive use of threads. We need to monitor some resources at fixed intervals and then act.
To achieve this, we've developed a ThreadManager that wraps one ScheduledThreadPoolExecutor. We allow any of the methods of the executor, we only use this manager to make sure everybody uses the same instan...
I think this might be a fairly easy question.
I found a lot of examples using threads and shared variables but in no example a shared variable was created inside a thread. I want to make sure I don't do something that seems to work and will break some time in the future.
The reason I need this is I have a shared hash that maps keys to ...
lets say you are adding a feature to an old and running windows form application now the whole application is running in one thread and the application is really big and have many forms so you cant refract it to run in multithreads, now the application gui freeze everytime you make a process , is there is any way to have an indicator tha...
I have a program that does the following:
Call webservice (there are many calls to the same web service)
Process the result of 1.
Insert result of 2. in a DB
So I think it should be better to do some multithreading. I think I can do it like this:
one thread is the master (let's call it A)
it creates some thread which calls the webs...
I'm experimenting with some multithreading constructions, but somehow it seems that multithreading is not faster than a single thread. I narrowed it down to a very simple test with a nested loop (1000x1000) in which the system only counts.
Below I posted the code for both single threading and multithreading and how they are executed.
The...
I have a windows forms program with a form MainForm. On a button press I start a code that runs (pulses) on every 0.5secs on another thread. I want to modify many things, like labels, progressbars on my MainForm, from the Pulse method. How is this possible?
So I would like to know, how to interract with variables, values, in that thread,...
Can I set the Visual Studio debugger to break on thread creation?
(Note this is not the same as breaking on context switch as asked for in this other question: http://stackoverflow.com/questions/3048064/can-i-set-a-breakpoint-in-visual-studio-c-to-break-on-a-thread-context-switch)
...
My scenario is :
I've an excel sheet. Some threads need to modify it at the same time.
I need to implement this and I'm looking for a best practice solution.
synchronizedmethod could be a solution? If yes, then wouldn't it create starvation problem or every thread may have to wait for long time?
Is any other way round?
...
The code below is going to be called from a website so having a static dictionary object in a non static class needs to be threadsafe. Basically the purpose of the code is to encapsulate logic and to maintain the life-time of the perfmon counter(s), which are stored in an instance of CounterContainer. The constructor is called passing ...
First a little background. I got a warning in NetBeans told me not to start a new thread in a constructor. I have read that the reason for that is because the new thread might start and try to reference the object started the thread before the constructor is actually done making the object.
1.) For the sake of experimentation instead...
I am testing a simple threadpool solution before I put it in my application, but the results I am seeing do not make sense for me. I have a simple form with one button on it. This button starts the following loop:
private void button1_Click(object sender, EventArgs e)
{
MyTestThread oTask = new MyTestThread ();
MyThreadInfo oTa...
If I have a pool object with 2 processors for example:
p=multiprocessing.Pool(2)
and I want to iterate over a list of files on directory and use the map function
could someone explain what is the chunksize of this function:
p.map(func, iterable[, chunksize])
If I set the chunksize for example to 10 does that means every 10 files s...
I saw a stackoverflow member suggest using Thread.join() to have a "main" thread wait for 2 "task" threads to complete.
I will frequently do something different (shown below) and I want to know if there are any problems with my approach.
final CountDownLatch latch = new CountDownLatch(myItems.length);
for (Item item : myItems) {
/...