[{"data":1,"prerenderedAt":206},["ShallowReactive",2],{"project-47054517":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":29,"sentiment":30,"stance_mix":31,"scored_comments":35,"aspects":36,"strip":38,"post_text":39,"what":40,"said":62,"maker_in_thread":115,"shape":126,"grid":129,"attempts":168,"same_week":169,"maker_shows":33,"maker_hidden":199,"reader_version":200,"card":201},"47054517","tiny_coro","Writing a C++20M:N Scheduler from Scratch (EBR, Work-Stealing)","title","Show HN: Writing a C++20M:N Scheduler from Scratch (EBR, Work-Stealing)","https:\u002F\u002Fgithub.com\u002Flixiasky-back\u002Ftiny_coro-build_your_own_MN_scheduler","github.com","lixiasky",1771368389,2026,18,20,2128,4366,49,"shown","languages","coroutine runtime","library",[24,25,26,27,28],"c++20 coroutines","m:n scheduler","work stealing","epoch-based reclamation","lock-free","quiet",null,{"positive":32,"neutral":33,"mixed":34,"critical":32},0,3,1,4,{"idea":37},{"positive":32,"critical":32},[32,32,32,32,32,32,32,32,32,32,32,33,32,33,32,33,32,33,32,32],"tiny_coro is a lightweight, educational M:N asynchronous runtime written from scratch using C++20 coroutines. It's designed to strip away the complexity of industrial libraries (like Seastar or Folly) to show the core mechanics clearly.\n\nKey Technical Features:\n\nM:N Scheduling: Maps M coroutines to N kernel threads (Work-Stealing via Chase-Lev deque).\n\nMemory Safety: Implements EBR (Epoch-Based Reclamation) to manage memory safely in lock-free structures without GC.\n\nVisualizations: I used Manim (the engine behind 3Blue1Brown) to create animations showing exactly how tasks are stolen and execu",{"problem":41,"audience":30,"pricing":30,"motivation":47,"time_to_build":30,"stack":51,"openness":60,"stage":61,"team_size":61},{"value":42,"source":43,"evidence":44},"Shows the core mechanics of coroutine runtimes without the complexity of industrial libraries","maker",[45],{"id":46},"post",{"value":48,"source":43,"evidence":49},"To bridge the gap between using coroutines and understanding the runtime",[50],{"id":46},[52,56],{"value":53,"source":43,"evidence":54},"C++20",[55],{"id":46},{"value":57,"source":43,"evidence":58},"Manim",[59],{"id":46},"open_source","unknown",{"praise":63,"objections":75,"requests":83,"questions":93,"alternatives":100},[64],{"value":65,"source":66,"evidence":67},"Interesting comparison to history of coroutines and state machines","commenter",[68,72],{"id":69,"by":70,"text":71},"47057389","srean","Any Fortran folks around ? Since old Fortran does not have function pointers I used to wonder how does one write gradient descent routine for a user defined function in Fortran.…",{"id":73,"by":11,"text":74},"47058430","That is a fascinating comparison! History really does rhyme. What you described—suspending with a flag and resuming with new values—is surprisingly similar to how the C++20…",[76],{"value":77,"source":66,"evidence":78},"Commenter prefers multitasking over coroutines and async approaches",[79],{"id":80,"by":81,"text":82},"47057760","throwaway81523","This looks cool, but says it's simpler than Seastar. Seastar last time I looked at it was fairly simple, but didn't use coroutines at all. Instead it used a futures\u002Fpromise…",[84],{"value":85,"source":66,"evidence":86},"Suggestions to explore Felix and other coroutine-based schedulers",[87,90],{"id":88,"by":70,"text":89},"47058988","Coroutine idea is very old. I am not 100% sure but they were heavily used in Telecom applications. It's easier in C and old C++ if one can drop down to assembly to switch between…",{"id":91,"by":70,"text":92},"47059371","> Unfortunately, my previous GitHub account got flagged\u002Fshadowbanned Oh! That sucks big time. Hope you had a local repo of everything. BTW I don't think your tone is formal, just…",[94],{"value":95,"source":66,"evidence":96},"Why the maker's previous account was flagged and what happened to the earlier project",[97],{"id":98,"by":70,"text":99},"47059134","BTW what happened to your baby wireshark ? Also, do you use ChatGPT to frame your responses ? Nothing wrong if you do, but people might notice the tone and wonder.",[101,105,109],{"value":102,"source":66,"evidence":103},"Seastar",[104],{"id":80,"by":81,"text":82},{"value":106,"source":66,"evidence":107},"Felix",[108],{"id":88,"by":70,"text":89},{"value":110,"source":66,"evidence":111},"Protothreads",[112],{"id":113,"by":81,"text":114},"47058464","Also look at Protothreads :)",{"comments":116,"answered":117,"key":118},8,2,[119,120,123],{"id":73,"text":74},{"id":121,"text":122},"47058571","Oh absolutely! Adam Dunkels' work is legendary. It's kind of poetic that Protothreads achieved stackless concurrency via C preprocessor macros and Duff's device tricks, and now…",{"id":124,"text":125},"47059127","The legendary \"Coroutines in C\" article! Thanks for the reference—I learned a lot from his work. His use of macros to hide the switch statement is basically the spiritual…",{"commenters":35,"max_depth":116,"maker_replies":116,"first_comment_mins":127,"lifespan_hours":128},379,19,[130,132,134,137,140,142,143,144,146,147,148,150,152,154,155,157,159,162,164,166],[69,32,32,131,70,32],"other\u002Fneutral\u002Fnone",[133,32,32,131,81,32],"47057715",[135,32,32,136,70,32],"47057733","commenter\u002Fneutral\u002Fnone",[138,32,32,131,139,32],"47063690","pklausler",[73,32,32,141,11,34],"project\u002Fneutral\u002Fidea",[113,32,32,131,81,32],[121,32,32,131,11,34],[145,32,32,131,70,32],"47058948",[124,32,32,131,11,34],[88,32,32,131,70,32],[149,32,32,131,11,34],"47059077",[98,32,33,151,70,32],"maker\u002Fneutral\u002Fnone",[153,32,32,151,11,34],"47059238",[91,32,33,151,70,32],[156,32,32,151,11,34],"47059452",[80,34,33,158,81,32],"project\u002Fmixed\u002Fidea",[160,34,32,161,11,34],"47058410","project\u002Fpositive\u002Fidea",[163,34,33,141,81,32],"47058491",[165,34,32,161,11,34],"47058550",[167,117,32,131,70,32],"47059854",[],[170,175,180,185,190,194],{"id":171,"name":172,"points":173,"category":174},"47031334","Jemini",488,"ai",{"id":176,"name":177,"points":178,"category":179},"47051852","AsteroidOS 2.0",470,"hardware",{"id":181,"name":182,"points":183,"category":184},"47026186","Microgpt",282,"learning_science",{"id":186,"name":187,"points":188,"category":189},"47040375","FreeFlow",277,"productivity",{"id":191,"name":192,"points":193,"category":184},"47008163","Data Engineering Book",251,{"id":195,"name":196,"points":197,"category":198},"47011567","SQL-tap",233,"dev_tools",false,"v2",{"id":202,"name":5,"line":6,"ai":199,"cat":20,"year":13,"points":14,"comments":15,"rec":29,"s":30,"top":18,"kw":203,"maker":11,"domain":10,"tier":19,"attempts":32,"strip":204,"url":9,"mix":205,"praise":65,"objection":77,"sub":21},47054517,[24,25,26,27,28],"00000000000303030300",[32,33,34,32],1793991144509]