Giter Site home page Giter Site logo

packtpublishing / building-low-latency-applications-with-cpp Goto Github PK

View Code? Open in Web Editor NEW
353.0 15.0 108.0 30.06 MB

Building Low Latency Applications with CPP by Packt Publishing

License: MIT License

C++ 3.52% CMake 0.05% Shell 0.05% Jupyter Notebook 0.03% HTML 96.36%

building-low-latency-applications-with-cpp's Introduction

Building Low Latency Applications with C++

Building Low Latency Applications with C++

This is the code repository for Building Low Latency Applications with C++, published by Packt.

Develop a complete low latency trading ecosystem from scratch using modern C++

What is this book about?

C++ is meticulously designed with efficiency, performance, and flexibility as its core objectives. However, real-time low latency applications demand a distinct set of requirements, particularly in terms of performance latencies.

This book covers the following exciting features:

  • Gain insights into the nature of low latency applications across various industries
  • Understand how to design and implement low latency applications
  • Explore C++ design paradigms and features for low latency development
  • Discover which C++ features are best avoided in low latency development
  • Implement best practices and C++ features for low latency
  • Measure performance and improve latencies in the trading system

If you feel this book is for you, get your copy today!

https://www.packtpub.com/

Instructions and Navigations

All of the code is organized into folders. For example, Chapter02.

The code will look like the following:

main:
.LFB1
   Movl $100, %edi
   Call _Z9factorialj

Following is what you need for this book: This book is for C++ developers who want to gain expertise in low latency applications and effective design and development strategies. C++ software engineers looking to apply their knowledge to low latency trading systems such as HFT will find this book useful to understand which C++ features matter and which ones to avoid. Quantitative researchers in the trading industry eager to delve into the intricacies of low latency implementation will also benefit from this book. Familiarity with Linux and the C++ programming language is a prerequisite for this book.

With the following software and hardware list you can run all code files present in the book (Chapter 1-15).

Software and Hardware List

Chapter Software required OS required
1 C++ 20 Linux
2 GCC 11.3.0 Linux

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. Click here to download it.

Related products

Get to Know the Author

Sourav Ghosh has worked in several proprietary high-frequency algorithmic trading firms over the last decade. He has built and deployed extremely low latency, high throughput automated trading systems for trading exchanges around the world, across multiple asset classes. He specializes in statistical arbitrage market-making, and pairs trading strategies for the most liquid global futures contracts. He works as a Senior Quantitative Developer at a trading firm in Chicago. He holds a Masters in Computer Science from the University of Southern California. His areas of interest include Computer Architecture, FinTech, Probability Theory and Stochastic Processes, Statistical Learning and Inference Methods, and Natural Language Processing.

building-low-latency-applications-with-cpp's People

Contributors

packt-itservice avatar packt-nithya avatar sghoshusc avatar shrutit1108 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

building-low-latency-applications-with-cpp's Issues

Which course is it ?

Hi,
Sorry for writing an issue, I did not know how to contact you.
Which course on Udemy does this repo belong to ?
Thank you !

Random allocate and deallocate objects in memory pool in chapter 4?

I want to know how to deal with randomly allocate and deallocate in in memory pool in chapter 4. For example, I initialized a memory pool with initial size is 10. Then I allocate six objects. The memory pool will look as bellow:

index object_ is_free_
0 o1 false
1 o2 false
2 o3 false
3 o4 false
4 o5 false
5 o6 false
6 empty true
7 empty true
8 empty true
9 empty true

Then I deallocated the 3rd and 5th elements as bellow:

index object_ is_free_
0 o1 false
1 o2 false
2 empty true
3 o4 false
4 empty true
5 o6 false
6 empty true
7 empty true
8 empty true
9 empty true

If I allocate 4 objects it would as bellow:

index object_ is_free_
0 o1 false
1 o2 false
2 empty true
3 o4 false
4 empty true
5 o6 false
6 o7 false
7 o8 false
8 o9 false
9 o10 false

The the memory pool is full now. But it's 2, 4 index position is free. It the memory pool is large it will left many holes.

My question is:

  1. Is my understanding is right or not?
  2. If my understanding is right how to solve this problem?

resource leak in socket creation?

For the createSocket() in common/socket_utils.h, the for loop in the code is iterating over the linked list of addrinfo structures returned by getaddrinfo(). In each iteration of the loop, a new socket is created and the socket_fd is overwritten. If the loop iterates more than once, the previous socket file descriptors will be lost and the sockets will not be closed, which can lead to resource leaks.

I don't know if I am missing something and I would appreciate if anyone can help me with this. Thanks.

In the LF_Queue, the getWriteIndex() might not be thread safe

In lf_queueu.h, the following function might not be thread-safe because the updateWriteIdx() is called after calling getNextToWriteTo()

auto getNextToWriteTo() noexcept {
      return &store_[next_write_index_];
}

This might lead to two threads accessing the same write location. The same thing applies to reads as well. Let me know if there is anything wrong with my understanding. Should we use a CAS-based lock-free queue, however, it will have to spin. Or we should atomically increment the next_write_index_ with modulus.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.