From owner-freebsd-hackers@freebsd.org Mon Dec 31 09:52:19 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BAF64142DD0C for ; Mon, 31 Dec 2018 09:52:19 +0000 (UTC) (envelope-from damjan.jov@gmail.com) Received: from mail-ot1-x342.google.com (mail-ot1-x342.google.com [IPv6:2607:f8b0:4864:20::342]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E16C1925F1; Mon, 31 Dec 2018 09:52:18 +0000 (UTC) (envelope-from damjan.jov@gmail.com) Received: by mail-ot1-x342.google.com with SMTP id 81so23151836otj.2; Mon, 31 Dec 2018 01:52:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HQkNOuJnuXLkBKaTwOKTSEL/RFPhJS5nelrJpcf5eCM=; b=EepLTKrjBLU37OvfQimo7+zLmRBu8lRQNrJY0B9F++EBNMLRu3pHS6GROnerkyqebf Nio9CG9AJPloFUpjKUI2i6XCzEhzPEbctEEAUfM3vSPdenK6bDc5eGyK4M6+TYbC7e3o H8M2Y8IWl7MFq8mL9eDKV5oudZLU5F98aRwNSaqs83YHHQrtJ7E5q74o0XnkAdeP/d07 hAWWC/LlONf804BjVIc7JPr2SQ1vPpF1LYRSRIyOyWl+W6Pq+JtxCEvxaCiCq6CZFqSS EfFSiqrPOjWF1AOcygyEGI0PQZF3mOv3TWu0oWJUy6jtSJP6RFpBxt5sg7nIZS+pEcEL s5mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HQkNOuJnuXLkBKaTwOKTSEL/RFPhJS5nelrJpcf5eCM=; b=K66NDiSg8VDnIm5TjeJCKAKS+vPuv6jVhPXTBvsqi8IZBOEaVjIy1nM6dfBEtk9ajS 8HDf749qlOntWz/o5iagHKoYqHc0iQai5r9xBYmBuxc1etX52oOjvtPE8BVdHPs1SPmK xBv6Rek0Qb8veM+VK02TOZqEeKISkabif2ldSEUnYhgA4YtU6hA/G7J6ivlyJozAP69K FcGtSD4K6qbOfFzogWa21KZPLD67nRAU4GqIfxxsL2q/13QRNbNTnk8/QRtWm8CPKi96 3d5vd5jbxMXtjD5qkmVi3k2mqg9ntsfWba/N3v/VWcuLaW96qYJPLo9IwVqAEv5pARjI SxLw== X-Gm-Message-State: AJcUukdAW6t2QKu/Znnx8R6LFXQDO62i0+dDMqnJTfxuv8unGFpE2xkZ jmkgiiQvloOe8G06az8UrBTmPOX+S/ekyHQRo6k+qChO+vM= X-Google-Smtp-Source: ALg8bN4wFA0xZGJV9vTaqC2zY+e/nVk/Hht+aRcacPkRlBVaLTSIkMVwdAuwaeR7MfAC2Yt1xA2bnmHW7TlM9bC9HhU= X-Received: by 2002:a9d:65c8:: with SMTP id z8mr25625153oth.338.1546249937788; Mon, 31 Dec 2018 01:52:17 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Damjan Jovanovic Date: Mon, 31 Dec 2018 11:50:12 +0200 Message-ID: Subject: Re: Speculative: Rust for base system components To: Alan Somers Cc: Eric McCorkle , "freebsd-hackers@freebsd.org" X-Rspamd-Queue-Id: E16C1925F1 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=EepLTKrj; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of damjanjov@gmail.com designates 2607:f8b0:4864:20::342 as permitted sender) smtp.mailfrom=damjanjov@gmail.com X-Spamd-Result: default: False [-2.41 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+,1:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.98)[-0.980,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_SPAM_SHORT(0.50)[0.499,0]; NEURAL_HAM_LONG(-0.97)[-0.968,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; IP_SCORE(0.04)[ip: (3.79), ipnet: 2607:f8b0::/32(-1.94), asn: 15169(-1.55), country: US(-0.08)]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2.4.3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Dec 2018 09:52:20 -0000 On Mon, Dec 31, 2018 at 8:37 AM Alan Somers wrote: > On Sun, Dec 30, 2018 at 10:38 PM Eric McCorkle > wrote: > > > > > > > == Go == > > > > Go is not really a "systems language" in the sense that C or Rust are. > > It isn't a replacement for C so much as a replacement for python. > > > > What's more, it is almost universally disliked by people with a > > background in programming languages (I am one of those). There's a > > couple of reasons for this. First, it omits a number of features that > > modern languages *really* should include, parameterized types (generics) > > being one of the most glaring. Beyond that, it completely ignores > > anything produced by modern PL research (unlike Rust, which benefits > > from that work). Second, one of its main design parameters was "it > > should compile fast". This as a design constraint basically guarantees > > that you can't do anything interesting in compilation, which rules out > > both advanced type systems as well as serious optimization. > > > > Unlike Rust, which offers substantial security and stability benefits > > through its type system, Go would do little more than just change the > > syntax of a bunch of code. Moreover, it's likely that there would be > > performance consequences, given the design constraint of fast > compilation. > > I think there's a common misconception that Go and Rust are similar > just because they were invented at about the same time and they share > some superficial syntactial similarities. But Go is much less > suitable for an OS. It's a memory-managed language, like Java. > Remember when Java was the hot new thing, and people predicted that > OSes would be written entirely in Java, and microprocessors would be > redesigned to execute JVM bytecode directly? It never happened, > because Java just isn't suitable for low-level work. Neither is Go. > Rust is. > > ARM chips could (and some did) have the Jazelle DBX extension to run Java bytecode in hardware. There are Java editions used on SIM cards and Blu-ray disks, so it certainly has low-level editions. It's Java SE that is heavy: 7 threads and 50 MB RAM for a hello world application, last time I checked. In this regard, Go is much lighter: 2 threads and 1 MB RAM for a hello world. Go has unsigned types, structure embedding, excellent interoperability with C, and the ability to compile into shared libraries which are loaded and called from C, so it is a lot better for low-level programming than Java. Having said that, the number of architectures supported by Go is fairly limited, and languages with automated garbage collection are unusable for kernel development. I would like to see more Rust (or a similar language) in systems development. Damjan