Some exchanges (CME?) limits each client to 30 orders per second. If you have a burst of order to send , I can see two common solutions 1) upstream queuing 2) multiple sessions
- upstream queuing is a hard requirement in many contexts. I think this is similar to TCP flow control.
- MOM? Possible but not the only choice
- an exchange can allow 100+ FIX sessions for one big client like a big ibank.
- Note a big exchange operator like nsdq can have dozens of individual exchanges.
Q: is there any sender flow control in intranet FIX?
A: not needed.
Q: When would main() call ..join() vs ..exit()?
I would call ..join() if main thread needs to do something after child threads completes.
I would call ..exit() if main thread has nothing to do and should leave the child threads running.
- recursive/reentrant lock is more permissive on the owner thread
- reader-writer lock is more permissive on the reader threads
- try-lock doesn’t block
- a counting semaphore is more permissive until we use up all permits
Most advanced locks help with liveness (deadlock..) and efficiency.
“Liunx kernel thread cannot run user programs”, as explained in [[UnderstandingLinuxKernel]].
Removing ‘Linux’ … Other Unix variants do use kernel threads to run both 1)user programs and 2)kernel routines. This is my understanding from reading about JVM…
Removing ‘kernel’… Linux userland threads do run user programs.
Removing ‘thread’… Linux kernel processes or interrupt routings could possibly run under user process pid.
Google c++style guide has numerous *practical* tips such as
- Do not design for shared ownership without a very good reason.
- I used to take shared ownership as my default design!
- transferring (rather than sharing) ownership can be simpler
See  j^c++^c# churn/stability…
C++ has survived more than one wave of technology churn. It has lost market share time and time again, but hasn’t /bowed out/. I feel SQL, Unix and shell-scripting are similar survivors.
C++ is by far the most difficult languages to use and learn. (You can learn it in 6 months but likely very superficial.) Yet many companies still pick it instead of java, python, ruby — sign of strength.
C is low-level. C++ usage can be equally low-level, but c++ is more complicated than C.
Suppose you have just one function being called recursively. (2-function scenario is similar.) Say it has 5 parameters. Create a struct named FRAME (having 5 fields + possibly a field for lineNo/instructionPointer.)
Maintain a stack holding the Frame instances. Each time the recursive algorithm adds to the call stack, we add to our stack too.
Wiki page on inorder tree walk has very concise recursive/iterative algos. https://github.com/tiger40490/repo1/blob/py1/py/tree/iterative_InOrderWalk.py is my own attempt that’s not so simple. Some lessons:
- Differentiate between popping vs peeking the top.
- For a given node, popping and printing generally happen at different times without any clear pattern.
- the sequence of pop() is probably a pre-order tree walk
- the sequence of print is an in-order tree walk
Optiver $450M profit, 700 employees. IMC is another options HFT with 500 employees. These specialist shops do in-house theoretical pricing, whereas the fastest HFT shops usually do not. Apparently, there’s still some nice profits for smaller hft shops despite the arms race!
Simon Ma of CVA team showed me this simple technique.
https://github.com/tiger40490/repo1/blob/cpp1/cpp1/miscIVQ/tokenLinked_Friend.cpp is my first usage of it.
- I only needed half of all matrix cells (excluding the diagonal cells) because relationships are bilateral.
- Otherwise, if graph edges are directed, then we need all (N-1)(N-1) cells since A->B is not same as B->A.