shiyanhui / libcsp Goto Github PK
View Code? Open in Web Editor NEWA concurrency C library 10x faster than Golang.
Home Page: https://libcsp.dev
License: MIT License
A concurrency C library 10x faster than Golang.
Home Page: https://libcsp.dev
License: MIT License
I just read a project which is also quite nice. https://github.com/YingshuLu/libcask.
Go's select statement: can a co-routine wait for multiple events (read from channels) at the same time, and process them in order they arrive? Thus achieving highest performance...
Here's an example: https://stackoverflow.com/a/20607625/15239054
Website (implicit) is down, null, segafaulted. Also, is this project maintained?
What is the cost of coroutine? Can 8 coroutines run on 8 CPUs at the same time in multicore environment?
pretty attractive, is there any documents for explain its design details?
waiting for good answer
Will there be any support for CPU pinning? I know it may need some more scheduling extensions, but this would be a very useful need for some sort of workloads where locality inside a NUMA node matters.
I’m not very familiar with Linux, and not very familiar with “C”, so perhaps the problem is caused by my unfamiliarity.
I believe that I followed the installation instructions, however I was unable to install libcsp. The following are the steps that I took. (No ./configure file) :
On Ubuntu 20.04 LTS.
I ran “sudo apt install gcc- ….” as per the instructions, and that completed OK.
I downloaded libcsp but there was no option for “.tar.gz”, so I used “.zip”, and extracted the download to libcsp-master.
I was unable to run ./configure because it is not in the libcsp directory. The directory contents are as follows:
drwxrwxr-x 2 brian brian 4096 Jul 7 16:39 benchmarks
-rw-rw-r-- 1 brian brian 2083 Jul 7 16:39 configure.ac
drwxrwxr-x 5 brian brian 4096 Jul 7 16:39 docs
drwxrwxr-x 2 brian brian 4096 Jul 7 16:39 examples
-rw-rw-r-- 1 brian brian 1023 Jul 7 16:39 LICENSE
-rw-rw-r-- 1 brian brian 2551 Jul 7 16:39 Makefile.am
drwxrwxr-x 2 brian brian 4096 Jul 7 16:39 plugin
-rw-rw-r-- 1 brian brian 493 Jul 7 16:39 README.md
drwxrwxr-x 2 brian brian 4096 Jul 7 16:39 src
drwxrwxr-x 2 brian brian 4096 Jul 7 16:39 tests
-rw-rw-r-- 1 brian brian 6 Jul 7 16:39 VERSION
Looking forward to trying libcsp.
Ubuntu 20.10 (in Virtual Box), gcc-10.
make produces
/usr/bin/ld: src/.libs/monitor.o:(.bss+0x0): multiple definition of `csp_core_pools'; src/.libs/corepool.o:(.bss+0x0): first defined here
/usr/bin/ld: src/.libs/sched.o:(.bss+0x20): multiple definition of `csp_core_pools'; src/.libs/corepool.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:530: libcsp.la] Error 1
after installing the gcc-plugin-dev and unpacking libcsp-0.0.1.tar.gz
and running configure, I get the following error from Ubuntu 18.04/gcc 7.5
libcsp-0.0.1$ make
make all-am
make[1]: Entering directory '/home/donp/projects/v/libcsp-0.0.1'
depbase=`echo plugin/plugin.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/bash ./libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I `gcc -print-file-name=plugin`/include -O3 -MT plugin/plugin.lo -MD -MP -MF $depbase.Tpo -c -o plugin/plugin.lo plugin/plugin.cpp &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I /usr/lib/gcc/x86_64-linux-gnu/7/plugin/include -O3 -MT plugin/plugin.lo -MD -MP -MF plugin/.deps/plugin.Tpo -c plugin/plugin.cpp -fPIC -DPIC -o plugin/.libs/plugin.o
In file included from plugin/plugin.cpp:22:0:
plugin/proc.hpp: In function ‘std::__cxx11::string csp::get_callee_name(tree)’:
plugin/proc.hpp:83:49: error: ‘TDF_VOPS’ was not declared in this scope
dump_generic_node(&pp, CALL_EXPR_FN(call), 0, TDF_VOPS|TDF_MEMSYMS, false);
^~~~~~~~
#define csp_without_prefix
#include <libcsp/csp.h>
#include <unistd.h>
In file included from /usr/local/include/libcsp/csp.h:28,
from sum.c:18:
/usr/include/unistd.h:1005:13: error: expected identifier or ‘(’ before ‘do’
1005 | extern void sync (void) __THROW;
| ^~~~
/usr/include/unistd.h:1005:13: error: expected identifier or ‘(’ before ‘while’
1005 | extern void sync (void) __THROW;
#define csp_without_prefix
#include <unistd.h>
#include <libcsp/csp.h>
How can solve this problem? Am i use "csp_async" and "csp_sync" not "sync" and "async".
Thankyou for reading this issue
int main(void) { printf("before\n"); block({ sleep(1);} ); printf("after\n"); return 0; }
function main never return.
As the title asked, Which OSes does the library support?
I've just accidentally found this lib and I'm quite impressed. It seems to implement a sweet spot between CSP, real os-level threads, work stealing (Weave beats by a significant margin in all tests even hand optimized Intel libraries; see also nim-lang/RFCs#160 ), channel API, etc. quite similarly to what I envisined in vlang/v#1868 .
I would have one question:
V is a new alpha-state language striving for efficient parallelism & concurrency support. V can be viewed as transpiler to C and thus provides a way to do the "static analysis libcsp is doing during multistaged compilation" in a more straightforward way.
Currently V maps all it's "go routines" 1:1 to os-level threads, but a more efficient implementation (utilizing CSP per os-thread but with preemptive guarantee, work stealing with Leapfrogging, dynamic adjustment of number of os-level threads due to power management on mobile devices, etc.) is needed.
From my point of view the biggest investment in libcsp would be to support also Windows, MacOS, Android, etc. along with ARM, POWER, and other than x86 architectures (ideally should be platform-agnostic with specialized variants for certain architectures - mainly x86 which libcsp already does 😉).
Maybe @UweKrueger could also comment as he's more up to date than me.
Lines 249 to 251 in ea0c5a4
it looks like you meant to use T
here, not t
. I might be wrong on that though, using t
will work too
how to build with cmake? lib and examples?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.