Skip to main content

Posts

Showing posts from March, 2025

FIX : Custom messages and fields

 Defining custom FIX protocol messages and custom fields involves extending the standard FIX protocol with your own message types and fields. These customizations are often necessary to support specific business requirements that are not covered by the standard FIX specification. Here’s a detailed guide on how to define both custom messages and fields in the FIX protocol: 1. Defining Custom FIX Protocol Fields Steps to Define Custom Fields: Choose a Custom Tag Number: The FIX protocol assigns tag numbers to fields, with the range 5000 and above typically being used for custom or proprietary fields. Ensure that the tag number you choose does not conflict with the standard FIX field tags (i.e., 1–4999). Define the Field Name and Description: Field Name: A descriptive name for the field (e.g., CustomOrderID , TraderNote ). Tag Number: The number associated with the custom field (e.g., 5500). Data Type: Specify the data type of the field (e.g., String, Integer, D...

Misc Questions

  Misc Interview Questions Size of shared_ptr The size of std::shared_ptr is typically 16 bytes or more on a 64-bit system. The size consists of an 8-byte pointer to the object and 8+ bytes for the control block that handles reference counting. The actual size can vary depending on the platform, architecture, and standard library implementation, so you can use sizeof to check it for your environment. Diamond problem The diamond problem in C++ (and other object-oriented languages that support multiple inheritance) refers to an ambiguity that arises when a class inherits from two classes that both inherit from the same base class. This situation can cause issues with inheritance and method resolution, specifically when the derived class is unsure which path to take to access the base class's methods or members. To solve the diamond problem, C++ introduces virtual inheritance . Virtual inheritance ensures that the base class is shared between all the derived classes. what is array...

Virtual constructor

 A virtual constructor is not a concept that is explicitly supported by C++ in the same way as other special functions like destructors, copy constructors, or constructors. However, the term virtual constructor is often used informally to refer to a design pattern that mimics the behavior of creating objects via polymorphism or inheritance, as constructors themselves cannot be virtual in C++. The idea behind a "virtual constructor" is to create an object using polymorphism, where you can instantiate an object of a derived class based on a runtime decision, but in a way that still respects object-oriented principles. Why Can't Constructors Be Virtual in C++? Constructors cannot be virtual in C++ because the constructor of a class is called when an object is created, and the type of the object (its class) is already determined at compile-time. Virtual functions rely on the dynamic dispatch mechanism, which works based on the actual type of the object at runtime. Howeve...

What would you do when one process on your linux is deadlocked

 When one of your processes on Linux is deadlocked, it means that the process (or processes) is stuck in a state where it is waiting for resources held by another process, which is itself waiting for resources that the first process holds. This typically results in a situation where neither process can proceed, causing a deadlock. Deadlocks are problematic because they lead to the system hanging or experiencing reduced performance. Here are the steps you can take to deal with a deadlocked process on a Linux system: 1. Identify the Deadlocked Process The first step is to identify the deadlocked process . There are several ways to check which process is deadlocked: Use ps or top to check process state: ps aux | grep D – The D state indicates that a process is in uninterruptible sleep (waiting on I/O or waiting for some resource). top – In the top command, you can look for processes that are in the "D" state, which indicates they are waiting for resources. Use ...