{"id":117727,"date":"2024-01-09T11:14:28","date_gmt":"2024-01-09T02:14:28","guid":{"rendered":"https:\/\/softantenna.com\/blog\/?p=117727"},"modified":"2024-01-09T11:14:28","modified_gmt":"2024-01-09T02:14:28","slug":"motoros","status":"publish","type":"post","link":"https:\/\/softantenna.com\/blog\/motoros\/","title":{"rendered":"MotorOS - x64\u4eee\u60f3\u74b0\u5883\u5411\u3051\u306eRust\u30d5\u30a1\u30fc\u30b9\u30c8\u30aa\u30da\u30ec\u30fc\u30c6\u30a3\u30f3\u30b0\u30b7\u30b9\u30c6\u30e0"},"content":{"rendered":"<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2024\/01\/motoros.jpg\" alt=\"Motoros\" title=\"motoros.jpg\" border=\"0\" width=\"1280\" height=\"726\" \/><\/p>\n<p>C\/C++\u8a00\u8a9e\u306b\u5909\u308f\u308b\u30b7\u30b9\u30c6\u30e0\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3068\u3057\u3066\u6ce8\u76ee\u3092\u96c6\u3081\u3066\u3044\u308b\u300cRust\u300d\u8a00\u8a9e\u3002<\/p>\n<p>Linux\u3078\u306e\u5c0e\u5165\u3084Linux\u4e92\u63db\u3092\u76ee\u6307\u3057\u3066\u958b\u767a\u304c\u9032\u3081\u3089\u308c\u3066\u3044\u308bOS\u300c<a href=\"https:\/\/softantenna.com\/blog\/rust-maestro\/\">Maestro<\/a>\u300d\u306e\u767b\u5834\u306a\u3069\u3001\u5b9f\u969b\u306bOS\u958b\u767a\u3067\u306e\u6d3b\u7528\u306e\u4e8b\u4f8b\u304c\u898b\u3089\u308c\u308b\u306a\u304b\u3001\u30af\u30e9\u30a6\u30c9\u5411\u3051\u306e\u8efd\u91cf\u304b\u3064\u30bb\u30ad\u30e5\u30a2\u306aOS\u300c<a href=\"https:\/\/github.com\/moturus\/motor-os\">Mot\u016brus OS(Motor OS)<\/a>\u300d\u306e\u958b\u767a\u304c\u9032\u3081\u3089\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>Motor OS\u306f\u3001Web\u95a2\u9023\u3084\u3001\u300c\u30b5\u30fc\u30d0\u30fc\u30ec\u30b9\u300d\u3001\u30a8\u30c3\u30b8\u30ad\u30e3\u30c3\u30b7\u30f3\u30b0\u306a\u3069\u3001\u4eee\u60f3\u30de\u30b7\u30f3\u30d9\u30fc\u30b9\u306e\u30ef\u30fc\u30af\u30ed\u30fc\u30c9\u3092\u30bf\u30fc\u30b2\u30c3\u30c8\u306b\u3057\u305f\u65b0\u3057\u3044\u30aa\u30da\u30ec\u30fc\u30c6\u30a3\u30f3\u30b0\u30b7\u30b9\u30c6\u30e0\u3067\u3059\u3002<\/p>\n<p>\u73fe\u5728\u3001\u307b\u3068\u3093\u3069\u306e\u4eee\u60f3\u5316\u30ef\u30fc\u30af\u30ed\u30fc\u30c9\u306fLinux\u3092\u63a1\u7528\u3057\u3066\u3044\u307e\u3059\u304c\u3001Linux\u306f\u5148\u9032\u7684\u306a\u6a5f\u80fd\u3092\u642d\u8f09\u3059\u308b\u4e00\u65b9\u3001\u4eee\u60f3\u5316\u30ef\u30fc\u30af\u30ed\u30fc\u30c9\u306b\u3068\u3063\u3066\u306f\u7406\u60f3\u7684\u3068\u306f\u3044\u3048\u306a\u3044\u5384\u4ecb\u306a\u554f\u984c\u3092\u62b1\u3048\u3066\u3044\u307e\u3059\u3002<\/p>\n<ul>\n<li>Linux\u306f\u30d9\u30a2\u30e1\u30bf\u30eb\u7528\u306b\u6700\u9069\u5316\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001VM\u3067\u306f\u975e\u52b9\u7387\u3068\u306a\u308b\u3002\u30d6\u30ed\u30c3\u30af\u30ad\u30e3\u30c3\u30b7\u30e5\u306e\u4e2d\u8179\u3001\u30d9\u30fc\u30b8\u30c6\u30fc\u30d6\u30eb\u30a6\u30a9\u30fc\u30af\u306e\u91cd\u8907\u3001\u30db\u30b9\u30c8\u30b9\u30b1\u30b8\u30e5\u30fc\u30e9\u30fc\u306e\u554f\u984c\u306a\u3069\u3002<\/li>\n<li>Linux\u306f\u4f7f\u3044\u306b\u304f\u3044\u3002Docker\u3001Nix OS\u3001\u300c\u30b5\u30fc\u30d0\u30fc\u30ec\u30b9\u300d\u306a\u3069\u306f\u5168\u3066\u3001Linux\u306e\u8907\u96d1\u3055\u306e\u305f\u3081\u306b\u5b58\u5728\u3059\u308b\u3002<\/li>\n<li>Linux\u306f\u6b74\u53f2\u7684\u4e8b\u60c5\u306b\u3088\u308a\u3042\u307e\u308a\u5b89\u5168\u3067\u306f\u306a\u3044\u3002<\/li>\n<\/ul>\n<p>\u4eee\u60f3\u5316\u30ef\u30fc\u30af\u30ed\u30fc\u30c9\u306b\u30d5\u30a9\u30fc\u30ab\u30b9\u3057\u3066\u30bc\u30ed\u304b\u3089\u69cb\u7bc9\u3055\u308c\u305f\u65b0\u3057\u3044\u30aa\u30da\u30ec\u30fc\u30c6\u30a3\u30f3\u30b0\u30fb\u30b7\u30b9\u30c6\u30e0\u306f\u3001Linux\u3088\u308a\u3082\u306f\u308b\u304b\u306b\u30b7\u30f3\u30d7\u30eb\u3067\u30bb\u30ad\u30e5\u30a2\u306a\u3082\u306e\u306b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3068\u306e\u3053\u3068\u3002<\/p>\n<p>Motor OS\u306fRust\u3067\u69cb\u7bc9\u3055\u308c\u305f\u30de\u30a4\u30af\u30ed\u30ab\u30fc\u30cd\u30eb\u30d9\u30fc\u30b9\u306e\u30aa\u30da\u30ec\u30fc\u30c6\u30a3\u30f3\u30b0\u30b7\u30b9\u30c6\u30e0\u3067\u3001\u4eee\u60f3\u5316\u30ef\u30fc\u30af\u30ed\u30fc\u30c9\u306b\u7279\u5316\u3057\u3066\u304a\u308a\u3001\u73fe\u5728\u3001x64 KVM\u30d9\u30fc\u30b9\u306e\u4eee\u60f3\u30de\u30b7\u30f3\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3001Qemu\u307e\u305f\u306fCloud Hypervisor\u3067\u5b9f\u884c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u73fe\u6642\u70b9\u3067\u306f\u3001\u307b\u3068\u3093\u3069\u306e\u30b5\u30d6\u30b7\u30b9\u30c6\u30e0\u306f\u958b\u767a\u4e2d\u306e\u6bb5\u968e\u3067\u3059\u304c\u3001\u4f8b\u3048\u3070Web\u30b5\u30fc\u30d0\u30fc\u306a\u3069\u3092\u52d5\u304b\u3059\u3053\u3068\u304c\u3067\u304d\u308b\u305d\u3046\u3067\u3059\u3002<\/p>\n<p>\u73fe\u5728\u5b9f\u884c\u53ef\u80fd\u306a\u6a5f\u80fd\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<blockquote>\n<ul>\n<li>boots via MBR (Qemu) or PVH (Cloud Hypervisor) in about 200ms<\/li>\n<li>himem micro-kernel<\/li>\n<li>scheduling:\n<ul>\n<li>a simple multi-processor round robin (SMP)<\/li>\n<li>in-kernel scheduling is cooperative\n<ul>\n<li>the kernel is very small and does not block, so does not need to be preemptible<\/li>\n<\/ul>\n<\/li>\n<li>the userspace is preemptible<\/li>\n<\/ul>\n<\/li>\n<li>memory management:\n<ul>\n<li>only 4K pages at the moment<\/li>\n<li>stacks are guarded<\/li>\n<li>page faults in the userspace work and are properly handled (only stack memory allocations are currently lazy)<\/li>\n<\/ul>\n<\/li>\n<li>I\/O subsystem (in the userspace)\n<ul>\n<li>VirtIO-BLK and VirtIO-NET<span>\u00a0<\/span><a href=\"https:\/\/github.com\/moturus\/motor-os\/tree\/main\/src\/lib\/virtio\">drivers<\/a>\n<\/li>\n<li>two simple filesystems (<a href=\"https:\/\/crates.io\/crates\/srfs\">srfs<\/a><span>\u00a0<\/span>and<span>\u00a0<\/span><a href=\"https:\/\/crates.io\/crates\/flatfs\">flatfs<\/a>)<\/li>\n<li>\n<a href=\"https:\/\/crates.io\/crates\/smoltcp\">smoltcp<\/a>-based networking (TCP only at the moment)<\/p>\n<ul>\n<li>a simple<span>\u00a0<\/span><a href=\"https:\/\/github.com\/moturus\/motor-os\/tree\/main\/src\/bin\/httpd\">httpd<\/a><span>\u00a0<\/span>is provided<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>the userspace:\n<ul>\n<li>multiple processes, with preemption<\/li>\n<li>threads, TLS<\/li>\n<li>Rust's standard library<span>\u00a0<\/span><a href=\"https:\/\/github.com\/moturus\/rust\/tree\/moturus-2023-12-16\">mostly ported<\/a>\n<ul>\n<li>Rust programs that use Rust standard library and do not depend, directly or indirectly, on Unix or Windows FFI, will cross-compile for Mot\u016brus OS and run, subject to \"what does not work\" below<\/li>\n<\/ul>\n<\/li>\n<li>a simple<span>\u00a0<\/span><a href=\"https:\/\/github.com\/moturus\/rush\">unix-like shell<\/a><span>\u00a0<\/span>in the serial console<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/blockquote>\n<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2024\/01\/motoros_screen.jpg\" alt=\"Motoros screen\" title=\"motoros_screen.jpg\" border=\"0\" width=\"1280\" height=\"715\" \/><\/p>\n<p>\u73fe\u5728\u3001MotorOS\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u7528\u30a4\u30e1\u30fc\u30b8\u306f\u516c\u958b\u3055\u308c\u3066\u304a\u3089\u305a\u3001Linux\u74b0\u5883\u4e0a\u3067\u81ea\u529b\u3067\u30d3\u30eb\u30c9\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002Ubuntu 22.04\u4e0a(WSL2\u306b\u3082\u5bfe\u5fdc)\u3067\u30d3\u30eb\u30c9\u3059\u308b\u65b9\u6cd5\u3092\u8aac\u660e\u3057\u305f<a href=\"https:\/\/github.com\/moturus\/motor-os\/blob\/main\/docs\/build.md\">\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a>\u304c\u516c\u958b\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u958b\u767a\u8005\u304c<a href=\"https:\/\/news.ycombinator.com\/item?id=38907568\">Hacker News<\/a>\u306b\u767b\u5834\u3057\u3001\u9577\u671f\u7684\u306a\u8a08\u753b\u3084\u3001\u30b3\u30f3\u30d1\u30a4\u30e9\u3001\u30d0\u30a4\u30ca\u30ea\u306e\u4e92\u63db\u6027\u306a\u3069\u3001Motor OS\u306b\u95a2\u3059\u308b\u7591\u554f\u306b\u8d85\u3048\u3066\u3044\u307e\u3059\u3002<\/p>\n<blockquote><p>\nI'm the project author\/dev. Thanks a lot for posting this, and for comments\/discussions!<br \/>\nI see two main concerns raised here:<\/p>\n<p>(a) long-term viability and support (b) compilers, binary compatibility, etc.<\/p>\n<p>While the first concern is definitely valid, and without a community this project will not succeed, I do believe that potential benefits of Motor OS (or a similarly focused\/structured project) will eventually result in a widely used new operating system. There are major problems with Linux inside VMs (and sometimes outside), and the Linux devs are not focused on this enough to clean things up anytime soon. I work on Linux Kernel at my day job, I know.<\/p>\n<p>Re: compiler instability, binary compatibility, etc.: I'm sorry, I don't understand what is the issue here. The latest Linux kernel can be compiled with different GCC or LLVM toolchains on x86_64, and the result will happily run old binaries compiled years ago with who knows what. repr(C) structs in rust are stable... So why so many concerns here?<\/p>\n<p>Again, thank you all for your comments and questions - I'm happy to answer more (at least until my day job kicks in).<\/p>\n<p>\u79c1\u306f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u4f5c\u8005\/\u958b\u767a\u8005\u3067\u3059\u3002\u3053\u306e\u6295\u7a3f\u3068\u30b3\u30e1\u30f3\u30c8\/\u8b70\u8ad6\u306b\u611f\u8b1d\u3057\u307e\u3059\uff01<br \/>\n\u79c1\u306f\u3053\u3053\u30672\u3064\u306e\u4e3b\u8981\u306a\u61f8\u5ff5\u304c\u63d0\u8d77\u3055\u308c\u305f\u3068\u898b\u3066\u3044\u308b\uff1a<\/p>\n<p>(a) \u9577\u671f\u7684\u306a\u5b9f\u884c\u53ef\u80fd\u6027\u3068\u30b5\u30dd\u30fc\u30c8 (b) \u30b3\u30f3\u30d1\u30a4\u30e9\u3001\u30d0\u30a4\u30ca\u30ea\u306e\u4e92\u63db\u6027\u306a\u3069\u3002<\/p>\n<p>\u6700\u521d\u306e\u61f8\u5ff5\u306f\u9593\u9055\u3044\u306a\u304f\u59a5\u5f53\u3067\u3001\u30b3\u30df\u30e5\u30cb\u30c6\u30a3\u304c\u306a\u3051\u308c\u3070\u3053\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306f\u6210\u529f\u3057\u306a\u3044\u3060\u308d\u3046\u304c\u3001Motor OS\uff08\u307e\u305f\u306f\u540c\u69d8\u306e\u7126\u70b9\u3092\u7d5e\u3063\u305f\/\u69cb\u9020\u5316\u3055\u308c\u305f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\uff09\u306e\u6f5c\u5728\u7684\u306a\u5229\u70b9\u306f\u3001\u6700\u7d42\u7684\u306b\u5e83\u304f\u4f7f\u308f\u308c\u308b\u65b0\u3057\u3044\u30aa\u30da\u30ec\u30fc\u30c6\u30a3\u30f3\u30b0\u30b7\u30b9\u30c6\u30e0\u306b\u3064\u306a\u304c\u308b\u3068\u4fe1\u3058\u3066\u3044\u308b\u3002VM\u5185\u90e8\uff08\u305d\u3057\u3066\u6642\u306b\u306f\u5916\u90e8\uff09\u306eLinux\u306b\u306f\u5927\u304d\u306a\u554f\u984c\u304c\u3042\u308a\u3001Linux\u306e\u958b\u767a\u8005\u305f\u3061\u306f\u3059\u3050\u306b\u4e8b\u614b\u3092\u4e00\u6383\u3067\u304d\u308b\u307b\u3069\u3053\u306e\u554f\u984c\u306b\u96c6\u4e2d\u3057\u3066\u3044\u306a\u3044\u3002\u79c1\u306f\u672c\u696d\u3067Linux\u30ab\u30fc\u30cd\u30eb\u306b\u643a\u308f\u3063\u3066\u3044\u308b\u3002<\/p>\n<p>Re:\u30b3\u30f3\u30d1\u30a4\u30e9\u306e\u4e0d\u5b89\u5b9a\u6027\u3001\u30d0\u30a4\u30ca\u30ea\u306e\u4e92\u63db\u6027\u306a\u3069\uff1a\u7533\u3057\u8a33\u306a\u3044\u304c\u3001\u4f55\u304c\u554f\u984c\u306a\u306e\u304b\u7406\u89e3\u3067\u304d\u306a\u3044\u3002\u6700\u65b0\u306eLinux\u30ab\u30fc\u30cd\u30eb\u306f\u3001x86_64\u4e0a\u3067\u7570\u306a\u308bGCC\u3084LLVM\u30c4\u30fc\u30eb\u30c1\u30a7\u30fc\u30f3\u3067\u30b3\u30f3\u30d1\u30a4\u30eb\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u3001\u305d\u306e\u7d50\u679c\u3001\u4f55\u5e74\u3082\u524d\u306b\u30b3\u30f3\u30d1\u30a4\u30eb\u3055\u308c\u305f\u53e4\u3044\u30d0\u30a4\u30ca\u30ea\u3092\u3001\u8ab0\u304c\u77e5\u3063\u3066\u3044\u308b\u304b\u308f\u304b\u3089\u306a\u3044\u304c\u3001\u559c\u3093\u3067\u5b9f\u884c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002\u305d\u308c\u306a\u306e\u306b\u3001\u306a\u305c\u3053\u3093\u306a\u306b\u591a\u304f\u306e\u61f8\u5ff5\u304c\u3042\u308b\u306e\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<p>\u7e70\u308a\u8fd4\u3057\u306b\u306a\u308b\u304c\u3001\u30b3\u30e1\u30f3\u30c8\u3084\u8cea\u554f\u3092\u3042\u308a\u304c\u3068\u3046\u3002\n<\/p><\/blockquote>\n<p>MotorOS\u306e\u4f5c\u8005\u306f\u3001\u672c\u696d\u3067Linux\u30ab\u30fc\u30cd\u30eb\u306b\u643a\u308f\u3063\u3066\u3044\u308b\u305d\u3046\u3067\u3059\u3002Rust\u306e\u7279\u5fb4\u3092\u751f\u304b\u3057\u305f\u91ce\u5fc3\u7684\u306a\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3068\u3057\u3066\u6ce8\u76ee\u3092\u96c6\u3081\u308b\u3053\u3068\u306b\u306a\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>C\/C++\u8a00\u8a9e\u306b\u5909\u308f\u308b\u30b7\u30b9\u30c6\u30e0\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3068\u3057\u3066\u6ce8\u76ee\u3092\u96c6\u3081\u3066\u3044\u308b\u300cRust\u300d\u8a00\u8a9e\u3002 Linux\u3078\u306e\u5c0e\u5165\u3084Linux\u4e92\u63db\u3092\u76ee\u6307\u3057\u3066\u958b\u767a\u304c\u9032\u3081\u3089\u308c\u3066\u3044\u308bOS\u300cMaestro\u300d\u306e\u767b\u5834\u306a\u3069\u3001\u5b9f\u969b\u306bOS\u958b\u767a\u3067\u306e\u6d3b\u7528\u306e\u4e8b\u4f8b\u304c\u898b [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":117728,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[75],"tags":[2910],"class_list":["post-117727","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","tag-rust"],"_links":{"self":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/117727","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/comments?post=117727"}],"version-history":[{"count":0,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/117727\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media\/117728"}],"wp:attachment":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media?parent=117727"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/categories?post=117727"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/tags?post=117727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}