Boost.Asio – The Powerful C++ Asynchronous I/O library

_banner

Boost.Asio – The Powerful C++ Asynchronous I/O library

Description

Any program may perform I/O operations in various forms like a file, a network , serial port or simple console operation. particularly in case of networking, sometimes individual I/O operation takes long time to complete. This poses its own kind of challenges: application development in managing CPU cycles and longer execution time etc. One option that comes to mind is to make a program multi-threaded and give the long running I/O operation to a thread. However, there is another solutions to the same problem and this is to perform I/O operations asynchronously.

There are few things to notice about asynchronous I/O over thread

  • With Asynchronous code, it is known where the control will shift from one task to another; hence race conditions are harder to arrive. In case of multi-threaded program, the code needs to be safe to control race conditions. The I/O part of threaded code is comparatively easy but managing the shared state of critical section between threads (using locks/queues/etc) without race conditions is what makes it challenging. Using an asynchronous model means you have less activities going on at the same time so races can be easily avoided.

Publications

  • With asynchronous approach, whole code shares the same process stack and it is kept small by continuos stack unwinding between tasks. Each thread will consume at least one memory page of stack, plus some unknown amount of memory for other data structures related to that thread’s state.

To read more, download the copy   arrows-new

To download this resource

Fill in the details below





    I have read and understand the Privacy Policy By submitting this form, I acknowledge that I have read and understand the Privacy Policy

    I wish to be contacted by eInfochips I wish to be contacted by eInfochips

    For all career related inquiries, kindly visit our careers page or write to career@einfochips.com

    Description

    Any program may perform I/O operations in various forms like a file, a network , serial port or simple console operation. particularly in case of networking, sometimes individual I/O operation takes long time to complete. This poses its own kind of challenges: application development in managing CPU cycles and longer execution time etc. One option that comes to mind is to make a program multi-threaded and give the long running I/O operation to a thread. However, there is another solutions to the same problem and this is to perform I/O operations asynchronously.

    There are few things to notice about asynchronous I/O over thread

    • With Asynchronous code, it is known where the control will shift from one task to another; hence race conditions are harder to arrive. In case of multi-threaded program, the code needs to be safe to control race conditions. The I/O part of threaded code is comparatively easy but managing the shared state of critical section between threads (using locks/queues/etc) without race conditions is what makes it challenging. Using an asynchronous model means you have less activities going on at the same time so races can be easily avoided.
    • With asynchronous approach, whole code shares the same process stack and it is kept small by continuos stack unwinding between tasks. Each thread will consume at least one memory page of stack, plus some unknown amount of memory for other data structures related to that thread’s state.

    Publications

    To read more, download the copy

    arrows-new-1

    To download this resource

    Fill in the details below





      I have read and understand the Privacy Policy By submitting this form, I acknowledge that I have read and understand the Privacy Policy

      I wish to be contacted by eInfochips I wish to be contacted by eInfochips

      For all career related inquiries, kindly visit our careers page or write to career@einfochips.com

      Fill in the details below





        I have read and understand the Privacy Policy By submitting this form, I acknowledge that I have read and understand the Privacy Policy

        I wish to be contacted by eInfochips I wish to be contacted by eInfochips

        For all career related inquiries, kindly visit our careers page or write to career@einfochips.com