libcr | a coroutine lib for C users , in non-intrusive mode | Reactive Programming library

 by   lichuang C Version: Current License: BSD-3-Clause

kandi X-RAY | libcr Summary

kandi X-RAY | libcr Summary

libcr is a C library typically used in Programming Style, Reactive Programming applications. libcr has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

a coroutine lib for C users,in non-intrusive mode.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              libcr has a low active ecosystem.
              It has 54 star(s) with 18 fork(s). There are 6 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 1 open issues and 0 have been closed. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of libcr is current.

            kandi-Quality Quality

              libcr has no bugs reported.

            kandi-Security Security

              libcr has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              libcr is licensed under the BSD-3-Clause License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              libcr releases are not available. You will need to build from source code and install.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of libcr
            Get all kandi verified functions for this library.

            libcr Key Features

            No Key Features are available at this moment for libcr.

            libcr Examples and Code Snippets

            No Code Snippets are available at this moment for libcr.

            Community Discussions

            QUESTION

            Atomic operation propagation/visibility (atomic load vs atomic RMW load)
            Asked 2020-Feb-21 at 10:34

            Context

            I am writing a thread-safe protothread/coroutine library in C++, and I am using atomics to make task switching lock-free. I want it to be as performant as possible. I have a general understanding of atomics and lock-free programming, but I do not have enough expertise to optimise my code. I did a lot of researching, but it was hard to find answers to my specific problem: What is the propagation delay/visiblity for different atomic operations under different memory orders?

            Current assumptions

            I read that changes to memory are propagated from other threads, in such a way that they might become visible:

            1. in different orders to different observers,
            2. with some delay.

            I am unsure as to whether this delayed visibility and inconsistent propagation applies only to non-atomic reads, or to atomic reads as well, potentially depending on what memory order is used. As I am developing on an x86 machine, I have no way of testing the behaviour on weakly ordered systems.

            Do all atomic reads always read the latest values, regardless of the type of operation and the memory order used?

            I am pretty sure that all read-modify-write (RMW) operations always read the most recent value written by any thread, regardless of the memory order used. The same seems to be true for sequentially consistent operations, but only if all other modifications to a variable are also sequentially consistent. Both are said to be slow, which is not good for my task. If not all atomic reads get the most recent value, then I will have to use RMW operations just for reading an atomic variable's latest value, or use atomic reads in a while loop, to my current understanding.

            Does the propagation of writes (ignoring side effects) depend on the memory order and the atomic operation used?

            (This question only matters if the answer to the previous question is that not all atomic reads always read the most recent value. Please read carefully, I do not ask about the visibility and propagation of side-effects here. I am merely concerned with the value of the atomic variable itself.) This would imply that depending on what operation is used to modify an atomic variable, it would be guaranteed that any following atomic read receives the most recent value of the variable. So I would have to choose between an operation guaranteed to always read the latest value, or use relaxed atomic reads, in tandem with this special write operation that guarantees instant visibility of the modification to other atomic operations.

            ...

            ANSWER

            Answered 2019-Mar-10 at 23:49
            Is atomic lock-free ?

            First of all, let's get rid of the elephant in the room: using atomic in your code doesn't guarantee a lock-free implementation. atomic is only an enabler for a lock-free implementation. is_lock_free() will tell you if it's really lock-free for the C++ implementation and the underlying types that you are using.

            What's the latest value ?

            The term "latest" is very ambiguous in the world of multithreading. Because what is the "latest" for one thread that might be put asleep by the OS, might no longer be what is the latest for another thread that is active.

            std::atomic only guarantees is a protection against racing conditions, by ensuring that R, M and RMW performed on one atomic in one thread are performed atomically, without any interruption, and that all other threads see either the value before or the value after, but never what's in-between. So atomic synchronize threads by creating an order between concurrent operations on the same atomic object.

            You need to see every thread as a parallel universe with its own time and that is unaware of the time in the parallel universes. And like in quantum physics, the only thing that you can know in one thread about another thread is what you can observe (i.e. a "happened before" relation between the universes).

            This means that you should not conceive multithreaded time as if there would be an absolute "latest" across all the threads. You need to conceive time as relative to the other threads. This is why atomics don't create an absolute latest, but only ensure a sequential ordering of the successive states that an atomic will have.

            Propagation

            The propagation doesn't depend on the memory order nor the atomic operation performed. memory_order is about sequential constraints on non-atomic variables around atomic operations that are seen like fences. The best explanation of how this works is certainly Herb Sutters presentation, that is definitively worth its hour and half if you're working on multithreading optimisation.

            Although it is possible that a particular C++ implementation could implement some atomic operation in a way that influences propagation, you cannot rely on any such observation that you would do, since there would be no guarantee that propagation works in the same fashion in the next release of the compiler or on another compiler on another CPU architecture.

            But does propagation matter ?

            When designing lock-free algorithms, it is tempting to read atomic variables to get the latest status. But whereas such a read-only access is atomic, the action immediately after is not. So the following instructions might assume a state which is already obsolete (for example because the thread is send asleep immediately after the atomic read).

            Take if(my_atomic_variable<10) and suppose that you read 9. Suppose you're in the best possible world and 9 would be the absolutely latest value set by all the concurrent threads. Comparing its value with <10 is not atomic, so that when the comparison succeeds and if branches, my_atomic_variable might already have a new value of 10. And this kind of problems might occur regardless of how fast the propagation is, and even if the read would be guaranteed to always get the latest value. And I didn't even mention the ABA problem yet.

            The only benefit of the read is to avoid a data race and UB. But if you want to synchronize decisions/actions across threads, you need to use an RMW, such compare-and-swap (e.g. atomic_compare_exchange_strong) so that the ordering of atomic operations result in a predictable outcome.

            Source https://stackoverflow.com/questions/55079321

            QUESTION

            Mpich2 - hydra_pmi_proxy: error while loading libraries: libcr.so.0
            Asked 2018-Sep-01 at 19:48

            I am trying to connect multiple virutalbox linux systems with mpich2. What i allready did:

            1. Install mpich-3.1.4
            2. Copy public key to every node
            3. install nfs server on every node.
            4. test if shared map works ( it does)
            5. added paths on Master

              export PATH=/share/mpich2/bin:$PATH export LD_LIBRARY_PATH="/mirror/mpich2/lib:$LD_LIBRARY_PATH"

            i also aded this to: ./bashrc

            1. install build-essential

            But at the end when i want to start program (mpiexec -f hosts -n 4 ./mpi_test ), i get error:

            hydra_pmi_proxy: error while loading libraries: libcr.so.0:cannot open shared object file: No souch file or directory

            ...

            ANSWER

            Answered 2018-Sep-01 at 19:48

            From http://jahanzebnotes.blogspot.com/2013/07/hydrapmiproxy-error-while-loading.html

            If you encounter this error while running mpich, then install this:

            Source https://stackoverflow.com/questions/46874609

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install libcr

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/lichuang/libcr.git

          • CLI

            gh repo clone lichuang/libcr

          • sshUrl

            git@github.com:lichuang/libcr.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Consider Popular Reactive Programming Libraries

            axios

            by axios

            RxJava

            by ReactiveX

            async

            by caolan

            rxjs

            by ReactiveX

            fetch

            by github

            Try Top Libraries by lichuang

            Lua-5.1.4-codedump

            by lichuangC

            qnode

            by lichuangC++

            libraft

            by lichuangC++

            AOI

            by lichuangC++