
Tag Archives: multithreading


C++ multithreading much easier now
C++ multithreading much easier now
Read this use the std (standard_ since C++ v 11. http://stackoverflow.com/questions/266168/simple-example-of-threading-in-c
http://www.cplusplus.com/reference/thread/thread/
So why use PThread now? http://www.tutorialspoint.com/cplusplus/cpp_multithreading.htm
Should virtual functiosn be used here? Â http://www.cplusplus.com/doc/tutorial/polymorphism/
Join my FREE newsletter to learn which C++ tricks are used for high frequency tradingÂ
NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!
TBB vs Fastflow for C++ parallel multithreading? Next steps for you
I have posted a detail series of next step I intend to take with deploying a live trading systematic model using code generation from Matlab Simulink to hopefully a fully automated trading C++ enabled system.
TBB vs Fastflow for C++ parallel multithreading? Next steps
Â
Yes I have come down to the selection of C++ with Matlab to enable this deployment with Oanda as the chosen broker for simple forex trading!
Read more hereÂ
TBB vs Fastflow for C++ parallel multithreading? Next steps
Don’t forget about my next non trading techie talk. I like to open this up to retail traders:
Let’s talk non techie trading stuff MEETUP
Monday, May 11, 2015
7:00 PM
I got some non techie trading ideas I want to talk about. Let’s do that to share your investment ideas.
Login Details here:
1. Â Please join my meeting, May 11, 2015 at 7:00 PM Eastern Daylight Time.
https://global.gotomeeting.com/join/450975573
2. Â Use your microphone and speakers (VoIP) – a headset is recommended. Â Or, call in using your telephone.
Dial +1 (224) 501-3212
Access Code: 450-975-573
Audio PIN: Shown after joining the meeting
Meeting ID: 450-975-573
GoToMeeting®
Online Meetings Made Easy®
Not at your computer? Click the link to join this meeting from your iPhone®, iPad®, Android® or Windows Phone® device via the GoToMeeting app.
Let’s end this email here so thanks for reading
Bryan

Youtube video demo on Inline assembly with c or c++ with spinlock multithreading for lowest latency HFT system
Youtube video demo on using inline assembly within c or c++ and spinlock for multithreading for lowest latency possible in a HFT system
Want to learn more? Join my FREE newsletter to get daily info
http://www.codeproject.com/Articles/15971/Using-Inline-Assembly-in-C-C
http://stackoverflow.com/questions/11959374/fastest-inline-assembly-spinlock
http://stackoverflow.com/questions/1456225/spinlocks-how-much-useful-are-they?rq=1
NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

I can confirm FastFlow v2 does have a NVIDIA CUDA C++ GPU example for multithreading
I can confirm FastFlow v2 does have a NVIDIA CUDA C++ GPU example for multithreading
Download from and follow instructions at:
http://sourceforge.net/scm/?type=svn&group_id=282605
Question is if this is a stable release?
Find out what I plan to do with this thing in my upcoming high frequency trading platformÂ
NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!
Exciting developments for my HFT platform with 30 min video overview of CUDA support for new multithreading C++ library
Hi there
Just in the last 24 hours:
2. I made a 30 minute overview of my thoughts on this exciting multithreading C++ library I discovered. The next version appears to  support for FPGA, CUDA, GPU, etc.
3. I also posted a video from last night’s webinar on the latest historical database service called TAQTIQA.
SO, is there any more I need to say?
–>. You know what to do if you want to get into the exciting next generation in trading? <–
Got questions or comments, let me know.
Thanks
Bryan
NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!LMAX has a unique Java disruptor for multithreading latency for quant development. Now C++ and C# versions exists
LMAX has a unique Java disruptor for multithreading latency for quant development. Now C++ and C# versions exists
Here the links you should know about this:
http://stackoverflow.com/questions/6943569/lmaxs-disruptor-pattern-is-there-a-port-to-c
http://www.2robots.com/2011/08/13/a-c-disruptor/
From LMAX In Java:
http://code.google.com/p/disruptor/
C++ version:
http://code.google.com/p/disruptor-cpp/
http://www.infoq.com/presentations/LMAX
NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!
Simplest C++ Multithreading with Thread classes, mutex, set, wait, lock, unlock defined
Simplest C++ Multithreading with Thread classes, mutex, set, wait, lock, unlock defined
I have searched high and low for the best and simplest multi threading explained within C++. As you know, I have already posted some articles on Linux processes and how deadlocks work. Theoretically, we are trying to prevent the Dead Diamond of Death syndrome. Both Java and C++ have potential solutions but Java has all these features built in natively. C++ needs a new set of classes defined which includes a specialized Thread class.
Using a set of mutex method, we can lock certain processes from subsequent messing up the state of a current thread. An example of mutex locking a storage block of code, look at:
int g_iStorage = 0;
CMutexClass MyMutex;
void StoreValue( int *pInt )
{
MyMutex.Lock(); //the gate keeper. only one thread
//allowed in at a time
g_iStorage = *pInt; //protected data, critical code section
MyMutex.Unlock(); //unblocks, allowing another thread to
//access g_iStorage
}
There are some other methods which work the same way Java’s Threading class and methods. These methods are explained below:
void Set() Sets an event state to signaled, notifying the blocked thread.
BOOL Wait() Places the calling thread in a blocked state until the event state is set to signaled. Returns TRUE on success, FALSE on failure.
void Reset() Resets a signaled event to unsignaled.
event object being used by a receiving thread::
CEventClass event;
.
.
//thread code
.
.
while(bContinueRunning)
{
event.Wait(); // wait for an event to occur
// perform some task
.
.
event.Reset(); // reset the event to un-signaled
}
.
.
Example of an event object used by one thread signaling another:
EventClass event;
.
.
// change some data
.
.
event.Set(); // notify thread that an event has occured,
// set event to signaled
There is more detailed info you could go into. I do believe if you know enough of above, you should be able to show some rudimentary knowledge in multithreading within C++. I would recommend following through with the link below as it is fairly close representation of how Java works.
To download and better understand how all this Thread classes work, go to http://www.codeproject.com/KB/threads/threadobject.aspx
It also contains a very good end to end set of source files to generate your own Thread classes which include the mutexes explained.
c++ interview questions on XML, quant, and multithreading
XML
You have to manually parse HTTP call whereas SOAP library parses the XML for you and provides methods to get the header and body information.
Quant based:
Describe a CDS to a layman.
What is Z spread?
Difference between a forward and a future?”
Find the error code sample:
Find the error and fill in the blanks, what is the output?
i=0;
i++ || ++i || i–;
printf(“%d\n”,i);
by Scofield:
i++ and I — negate each other, so ++i
i =1
i == 2
i++ is post-increment, when the first operator || gets the value it will still be zero.
++i is pre-increment, so the second operator || will get 2
The || operator will shortcut with:
0 || 2
so the final ++i will not be executed.
Multithreading:
How can you lock a portion of a file and how to use it ?
man -S 2 fcntl
The lockf() function shall lock sections of a file with advisory-mode locks. Calls to lockf() from other threads which attempt to lock the locked file section shall either return an error value or block until the section becomes unlocked.
Say you have a multithreaded network I/O bound server that is single-threaded, under a load of tens of thousands of connections. What is the most expensive operation encountered in processing data, and how would you minimize the impact of the operation?
The most expensive operation is the read from the network socket. You would minimize its impact by using non-blocking sockets and reading as much as you could in one go; this would allow a minimal number of read operations to obtain the contents of the stream.