{"id":13670879,"url":"https://github.com/PlatformLab/Arachne","last_synced_at":"2025-04-27T13:33:07.419Z","repository":{"id":38983708,"uuid":"75876333","full_name":"PlatformLab/Arachne","owner":"PlatformLab","description":"Core aware thread management system","archived":false,"fork":false,"pushed_at":"2023-07-16T04:45:52.000Z","size":1146,"stargazers_count":232,"open_issues_count":6,"forks_count":44,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-09T09:09:29.921Z","etag":null,"topics":["arachne","latency","threading","user-threads"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PlatformLab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2016-12-07T21:16:16.000Z","updated_at":"2025-03-21T06:41:58.000Z","dependencies_parsed_at":"2024-04-01T00:42:30.996Z","dependency_job_id":null,"html_url":"https://github.com/PlatformLab/Arachne","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlatformLab%2FArachne","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlatformLab%2FArachne/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlatformLab%2FArachne/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlatformLab%2FArachne/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PlatformLab","download_url":"https://codeload.github.com/PlatformLab/Arachne/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251145738,"owners_count":21543093,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arachne","latency","threading","user-threads"],"created_at":"2024-08-02T09:00:51.741Z","updated_at":"2025-04-27T13:33:02.407Z","avatar_url":"https://github.com/PlatformLab.png","language":"C++","readme":"# Arachne: Towards Core-Aware Scheduling\n\n## What is core aware scheduling?\n\nIn today's large-scale data center systems, there are many complex software\ncomponents which make a binary trade-off between latency and throughput. They\neither overprovision their systems to obtain lower latencies and consequently\nwaste resources, or oversubscribe their systems and experience very high\nlatencies due to imbalance between application load and system resources. \n\nCore-aware scheduling is the notion that we can balance an application's\noffered load to a system's available resources by scheduling threads at user\nlevel, and performing coarse-grained core allocation at operating system level.\n\nUnder this approach, the kernel no longer preemptively multiplexes between\nthreads without any awareness of what the application is doing. This enables us\nto avoid the performance degradations caused by slow context switches, priority\ninversion, and cache pollution from the threads of other processes.\n\n## What is Arachne?\n\nAccording to Greek mythology, [Arachne](https://en.wikipedia.org/wiki/Arachne)\nwas a mortal weaver who challenged the goddess Athena to a weaving competition.\nSimilarly, the Arachne user threading system attempts to challenge the current\ndominance of kernel threads in the C++ world.\n\nArachne is the first step towards core-aware scheduling, allowing an\napplication to run only as many threads in parallel as cores available to it.\n\nArachne is a user-level, cooperative thread management system written in C++,\ndesigned to improve core utilization and maximize throughput in server\napplications without impacting latency. It performs M:N scheduling over kernel\nthreads running exclusively on CPU cores and features ~200 ns cross-core thread\ncreations and ~100 ns cross-core signals on Nehalem X3470. Arachne also\nestimates CPU load and adjusts the number of cores accordingly.\n\n## How do I use it?\n1. Recursively clone [Arachne super repository](https://github.com/PlatformLab/arachne-all).\n\n        git clone --recursive https://github.com/PlatformLab/arachne-all.git\n\n2. Build the library with `./buildAll.sh` in the top level directory.\n\n        cd arachne-all\n        ./buildAll.sh\n\n3. Write your application using the public Arachne API, documented [here](https://platformlab.github.io/Arachne/group__api.html).\n\n```\n    #include \u003cstdio.h\u003e\n    #include \"Arachne/Arachne.h\"\n\n    void numberPrinter(int n) {\n        printf(\"NumberPrinter says %d\\n\", n);\n    }\n\n    // This is where user code should start running.\n    void AppMain(int argc, const char** argv) {\n        printf(\"Arachne says hello world and creates a thread.\\n\");\n        auto tid = Arachne::createThread(numberPrinter, 5);\n        Arachne::join(tid);\n    }\n\n    // The following bootstrapping code should be copied verbatim into most Arachne\n    // applications.\n    void AppMainWrapper(int argc, const char** argv) {\n        AppMain(argc, argv);\n        Arachne::shutDown();\n    }\n    int main(int argc, const char** argv){\n        Arachne::init(\u0026argc, argv);\n        Arachne::createThread(\u0026AppMainWrapper, argc, argv);\n        Arachne::waitForTermination();\n    }\n```\n\n4. Link your application against Arachne.\n\n        g++ -std=c++11 -o MyApp MyApp.cc  -Iarachne-all/Arachne/include -Iarachne-all/CoreArbiter/include  -Iarachne-all/PerfUtils/include -Larachne-all/Arachne/lib -lArachne -Larachne-all/CoreArbiter/lib -lCoreArbiter -Larachne-all/PerfUtils/lib/ -lPerfUtils  -lpcrecpp -pthread\n\n## User Threading vs Kernel Threadpool\n\nFor those who are unfamiliar with the benefits of user threading, it may seem\nthat a simple kernel thread pool would achieve the same result as a user\nthreading library. However, tasks running in a kernel thread pool generally\nshould not block at user level, so they must run to completion without blocking.\n\n[Here](http://stackoverflow.com/questions/41276552/wait-in-forkjoin-pool-java/41277690#41277690)\nis an example of a use case that would require manual stack ripping in a thread\npool, but could be implemented as a single function under Arachne.\n","funding_links":[],"categories":["C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPlatformLab%2FArachne","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPlatformLab%2FArachne","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPlatformLab%2FArachne/lists"}