Considering the Chaos Monkey in Designing and Architecting an Embedded Systems [closed] - c++

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I work on embedded systems with limited memory and throughput. Making a system more robust requires more memory, and time on the processor. I like the idea of the Chaos Monkey to figure out if your system is fault tolerant, however with limited resources I'm not sure how feasible it is to just keep adding code to it. Are there certain design considerations whether in the architecture or otherwise that would improve the fault handling capabilities, without necessarily adding "more code" to a system?
One way I have seen to help in preventing writing an if then statement in c (or c++) that assigns rather then compares a static value, recommends writing that on the left hand side of the comparison, this way if you try to assign your variable to say the number 5, things will complain and you're likely to find any issues right away.
Are there Architectural or Design decisions that can be made early on that prevent possible redundancy/reliability issues in a similar way?

Yes many other techniques can be used. You'd do well to purchase and read "Code Complete".
Code Complete on Amazon

Related

C++: Is it alright to keep creating new variables? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am new to C++ and I have a general question. In order to solve any question in the exercises of the book I am learning from, while I am able to successfully solve the questions, I usually end up creating a lot of new variables within functions in addition to the ones that I have already initialised. For some reason, this worries me because I feel that I am writing inefficient code that might hog resources if I follow this practice for more complex programmes. Am I wrong in thinking this way? Are there any best practices regarding initialising and declaring new variables?
EDIT: I forgot to add, before resolving any question, I tend to convert the solution into plain English and then attempt to draw the program structure.
Normally compilers do liveness analysis of variables during the compilation of your code. Variables are considered live only starting from their assignment till their last use - optimizing compilers are capable of reducing the amount of local storage on the stack that is required by sequentially used variables (sometimes they even can eliminate their use entirely or keep them in registers only for a short period of time).

Memory and performance in C++ Game [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm still new to C++ but I catch on quick and also have experience in C#. Something I want to know is, what are some performance safe actions I can take to ensure that my game runs efficiently. Also, in which scenario am I likely to run out of memory on. 2k to 3k bullet objects on the stack, or heap? I think the stack is generally faster, but I heard that too much causes a stack overflow. That being said, how much is too much exactly?
Sorry for the plethora of questions, I just want to make sure I don't design a game engine in which it relies on good PCs in order to run well.
Firstly, program your game safely and only worry about optimizations like memory layout after profiling & debugging.
That being said, I have to dispel the myth that the stack is faster than the heap. What matters is cache performance.
The stack generally is faster for small quick accesses, because the stack usually already is in the cache. But when you are iterating over thousands of bullet objects on the heap, as long as you store them contiguously (e.g. std::vector, not std::list), everything should be loaded into the cache, and there should be no performance difference.

Is managed code slower than unmanaged code? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Its just a question out of my curiosity. Though generally considering the Framework and the steps involved in Execution, i'd say yes. Still i would also like to consider the factors like Memory/Disc access and networking which limit the performance of unmanaged code.
Quoting Herb Sutter
"First, JIT compilation isn’t the main issue. The root cause is much more fundamental: Managed languages made deliberate design tradeoffs to optimize for programmer productivity even when that was fundamentally in tension with, and at the expense of, performance efficiency."
There’s always an inescapable and fundamental difference between “prevention” and “cure” — when it comes to performance optimization, C++ always chooses “prevention,” and managed languages choose “cure” with the above-mentioned heroic efforts and many more. But the old ounce/pound saying is inescapable; you can’t beat prevention (in part because you can always add the cure after first doing the prevention, but not the reverse), and if you care about performance and control primarily then you should use a language that is designed to prioritize that up front, that’s all.
You can refer this article for more clarity
http://www.i-programmer.info/professional-programmer/i-programmer/4026-the-war-at-microsoft-managed-v-unmanaged.html

Ocaml and Algorithmic Trading [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I'm completely new to the Algorithmic Trading domain. I've just completed a course that was Ocaml based, and read about Jane Street. Obviously they are a huge company with a large amount of resources, but is it feasible to use Ocaml for small time algorithmic trading?
I know that probably seems like a stupid question, but (from what i've found) there aren't any trading APIs for Ocaml. This would mean one would have to written from scratch correct?
Any insight would be greatly appreciated guys, like I said I am a complete noob to this domain.
Thanks!
I've recently noticed this package in Opam that could provide a starting point for a trading API:
"IBX is a pure OCaml implementation of the Interactive Brokers Trader Workstation API (TWS API) built on top of Jane Street's Core and Async library."
As for open source trading algorithms in general this project started recently:
http://scarcecapital.com/hft/
I think this question is probably too open-ended for the Stack Overflow environment to be useful to you. Stack Overflow is for when you have a specific problem you're trying to solve.
But being opinionated, I can't help but say that OCaml might be pretty good for algorithmic trading. The strong typing system and immutable data tend to help avoid errors while allowing you to code quickly. This, at least, is what I've found. But you'd need to plug OCaml in to your data sources and your trade execution channel, which would be extra work. Knowing nothing about this area, I don't know if there are libraries for other languages.
Most likely the folks who are actually doing this have an incentive to keep their secrets to themselves. But that would be true regardless of the language.

Security patterns of firewalls/antiviruses [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
I`m curious why sometimes my antivirus sees my programs as threats for my computer. I thin kit has to do with memory allocations.
-does anyone know why and how to avoid something like that?
-why would otherwise the reason be?
Traditional detection of viruses have been fingerprint based. However, with polymorphic and metamorphic viruses and the sheer increase in new viruses, AV vendors have started moving towards behavior-based detection. Your program may be targeted because it exhibits 'virus-like' behavior. For instance, your program may be attempting to read files from disk that it may not have permissions to, modifying other executables or important system settings present on the system, automatically sending email or starting network traffic, or changing system startup actions in abnormal volumes.
Unfortunately, how to work around a specific vendor's detection is a bit of a black-box. I would check if your AV product has a whitelisting mechanism.