|
Hi,
is there any difference between Windows Job and Scheduled Tasks?
I have used the win32_ScheduledJob class for monitoring the scheduled tasks.
But it doesn't return anything even that task in running state.
Please let me know how to create a windows job manually for testing and which win32 class to be used for monitoring?
Thanks
|
|
|
|
|
|
If possible what is the easiest way to reduce the connect inital timeout value from 3 seconds to 1 second or less? The excerpt below reduced the retries which is not good enough for my purposes.
Any suggestions would be appreciated.
Thanks
"Now, the initial timeout value - before the first connection attempt - is 3 seconds. After each retry, the amount of time to wait is doubled (3 seconds, 6 seconds etc.). The number of retries can be configured via the 'TcpMaxConnectRetransmissions' parameter in the registry - the default is set to 3 for Windows NT and 2 for Windows 2000. Thus, the first solution to the connection timeout problem is, to adjust this parameter via the Registry. However, changing the registry is a global change, affecting all applications that use Winsock and/or TCP/IP. The following Knowledge Base article (http://support.microsoft.com/default.aspx?scid=kb;en-us;120642) provides detailed information. Nevertheless, one should be careful while playing with these parameters."
|
|
|
|
|
Alan Kurlansky wrote: what is the easiest way to reduce the connect inital timeout value from 3 seconds to 1 second or less
There is no 3 second timeout for connect() function. You need to implement your own timeout mechanism or use a socket library that does. It's a short answer, hope it helps.
/M
|
|
|
|
|
On a windows(XP) machine i'm trying to inject mouse/keyboard messages (for some remote control; kind of soft-KVM-switch), which works fine as long as a user is logged in. Once the workstation is locked or no user is logged in, the injected messages seem to be ignored. I have tried both mouse_event and SendInput (unsuccessful) as well as to connect the app (runs as nt-service, userinteraction allowed) with the logon-desktop, which (regarding to api-returns) should work, but still no success. Can anyone give me an advice?
|
|
|
|
|
There is [input data] <---- object ----> [output data] program structure.
Input data is processed in a for loop with specific object (class or struct) which takes chunk of input data performs computation and saves results to output data array.
To convert it to OpenMP should I have as many object references allocated as presumed number of threads will be running to avoid its simultaneous access from multiple threads?
It will not be possible to lock the object for a single thread as the multithreading nature dissapears since only one thread at a time will be allowed to perform computation with that object.
Чесноков
|
|
|
|
|
It depends on what your object is. If the object doing the processing is a stateless functor (ideally) then just make one per thread and don't worry about locking it. However if it's got state that's relevant across the whole operation of your program you're going to have to share the object and lock it.
Cheers,
Ash
|
|
|
|
|
I'm running that code on i7 computer with 4 cores and 8 threads
N = 10000;
...
#pragma omp parallel for
for (i = 0; i < N * N; i++)
vec3[i] = vec1[i] * vec2[i];
...
Setting number of threads with omp_set_num_threads to 2, 4 and 8 the performance increase compared to omp_set_num_threads(1) is not consistent: x1.4, x1.55, x1.58
Should be we expect the rates to be: x2, x4, x8 instead?
Чесноков
|
|
|
|
|
If you have 4 cores, the highest ratio that you can theoretically expect is 4; using a number of threads higher thatn the number of cores don't produce significant advantages and can reduce the performances because to execute all of them the system has to switch the thread context a lot of times and this will waste time.
The real speed improvement could be less than expected due to the times required to create the threads at the beginning of the parallel construct and destroy them when the parallel construct terminates; if this is the case, by increasing N the rates should became better (e.g. try N = 1000000 )
|
|
|
|
|
Hi Sauro,
the i7 the original poster is using can run 8 threads simultaneously. There are 4 cores and each core is hyperthreaded.
Cheers,
Ash
|
|
|
|
|
Ops...
|
|
|
|
|
The HyperThreading performance is not actually double the normal performance though, many parts of the CPU are shared competitively between the two threads running on a single core.
|
|
|
|
|
Yep, and that's why I said that each extra core for hyperthreading is worth somewhere between 0.2 and 0.5 a processor for the style of coding he's doing.
Cheers,
Ash
|
|
|
|
|
Yep, and that's why I said that each extra core for hyperthreading is worth somewhere between 0.2 and 0.5 a processor for the style of coding he's doing.
Cheers,
Ash
PS: No I didn't, should have done! Thanks for pointing that out.
|
|
|
|
|
I wouldn't expect a linear scaling of performance with number of threads but I'd expect a bit better performance than that. When manually scheduling my own threads I can get about 4 times the performance on an i7 with 8 hardware execution units for the same sort of problem.
How does OpenMP interleave the memory accesses? There might be a lot of cache contention going on that's causing the slowdown. With my manually scheduled version it's running out of cache that slows mine down.
Looking at it N is fairly small. What happens when you use 10,000,000?
Cheers,
Ash
PS: Another reason you might not be getting as much speed up when you're running more cores is that the i5 and i7 throttle down when running more threads to keep the thing cool. Or as the advertising goes it overclocks up when running fewer threads and is able to keep its' temperature down. My results were with turbo boost (as the marketroids call it) disabled so that might be why my processor's response was a bit more linear.
|
|
|
|
|
It is N*N loop aready with N=10000 it is 10,000*10,000 = 100,000,000 operations.
That already takes 170 ms to process.
I need to optimize code that performs even less operations.
Чесноков
|
|
|
|
|
Missed that. I need glasses
Ash
|
|
|
|
|
I used RegisterHotKey API to provide hot keys for certain events.
If i dont close my application and if i run another then CTRL + C is not working cause i am using it in my application. What shall i do?
Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|
|
I think you are confusing between hotkeys and accelerators: the first one are system-wide key escapes, the second one are limited to the application.
|
|
|
|
|
Oh, so what do we do if we want the key using registerhotkey to be local to the application and not all other applications... or how do we use accelerators like hotkeys... i have not yet experimented accelerators. can you give me an online reference so that i can go through that and use it. thank you.
Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|
|
Accelerators are quite easy to use; the steps required are the following:
- create a new resource of type accelerator table inside your .rc file, then add the entries that you want to that table using the resource editor
- load the accelerator table using the
LoadAccelerators function - inside the message loop of the window that you want to process the accelerators, use the
TranslateAccelerator function to dispatch them
You can read the documentation about accelerator here[^] on the MSDN.
Note: if you are using MFC and your application is based on the document/view architecture, then the project wizard alerady creates an accelerator table for you, and that table is already loaded and used by your frame window (see Managing Menus, Control Bars, and Accelerators (MFC)[^] on the MSDN). If your application is an MFC dialog based one, you should manually add the code to load the accelerator table (you can call LoadAccelerators in the constructor of your CDialog derived class) and to dispatch the accelerators, by overriding the PreTranslateMessage virtual method and calling TranslateAccelerator .
|
|
|
|
|
Wow, thats a nice explanation.
Thank you.
Let me play with those functions and let me try to accomplish my task.
http://vikku.info/
Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|
|
How to get the Selected Item from CListControl
when scrolling through key board arrow keys.
I want to know the selected item no when scrolling through keyboard.
Using mouse click I can able to get the selected item no.
|
|
|
|
|
CListCtrl::GetSelectionMark[^] doesn't work for you?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I know its not correct.
-> But can a pointer, to a class which contains only member functions and absolutely no data members, be used to invoke its member functions?
int func_2(int i, float j)
{
cout << i << j << endl;
return i;
}
class ABC
{
public:
int func_1(int i, float j)
{
return func_2(i, j);
}
};
[1] ABC *pObj;
[2] int i = 10;
[3] float f = 20.50f;
[4] int r = pObj->func_1(i, f);
When the above code is executed using VC++2003(version 7.1) following error occurs at line[4]:
Run-Time Check Failure #3 - The variable 'pObj' is being used without being defined.
but even if the error is ignored\ continued then also every thing work properly.
Please suggest :
->Whether this method of using uninitialized pointer is acceptable in any condition?
->Will this work on different platforms?(could not try this, since I do not have accesses to other platform)
->Any pitfalls?
->Your Valuable suggestions.
Thanks in advance.
|
|
|
|