Author Topic: any examples of OS not written in C/C++?  (Read 25428 times)

0 Members and 2 Guests are viewing this topic.

Offline Cerebus

  • Super Contributor
  • ***
  • Posts: 10576
  • Country: gb
Re: any examples of OS not written in C/C++?
« Reply #75 on: April 16, 2021, 05:04:09 pm »
*Cough* Multics. *Cough*

Multics is not a good counter-example to his claim. Parts of it were written in PL/I but a large part was in assembly.

The overwhelming majority was in PL/1. From memory, two modules of any substance, the PL/1 operators and the process switch, perhaps 500 lines of code in total in what you'd call the kernel nowadays,plus  a handful coding gates (just jump table entries in essence), a handful or two of short files that would have otherwise been coded as 'asm{}' had multics pl/1 had syntax for that,  a handful more in BOS the system bootstrap. More was in assembler while they were bootstrapping it from nothing, but pl1_operators_.alm  and  the process switch where all that were left when they finished. Full disclosure, I did some systems programming on multics back in the 80s and it still holds a fond place in the panoply of operating systems as far as I'm concerned.
Anybody got a syringe I can use to squeeze the magic smoke back into this?
 

Offline thinkfat

  • Supporter
  • ****
  • Posts: 2150
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: any examples of OS not written in C/C++?
« Reply #76 on: April 16, 2021, 05:06:19 pm »
OS security is actually pretty awful. Any attempt to put a safety net under clueless programmers who drop the ball every other hour is IMHO laudable. If that turns out to be an OS written in whitespace, so be it.
Everybody likes gadgets. Until they try to make them.
 

Offline thinkfat

  • Supporter
  • ****
  • Posts: 2150
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: any examples of OS not written in C/C++?
« Reply #77 on: April 16, 2021, 05:28:58 pm »
Regarding Jazelle on Arm, has anyone ever seen it used? I'm not even sure if ARMv8 still supports it. As far as I remember it was mostly an exception mechanism that aborted into a special processor mode, from where you would run a Jit compiler to generate machine code to emulate the faulting Java byte code.
Everybody likes gadgets. Until they try to make them.
 

Offline DiTBhoTopic starter

  • Super Contributor
  • ***
  • Posts: 3796
  • Country: gb
Re: any examples of OS not written in C/C++?
« Reply #78 on: April 16, 2021, 05:32:59 pm »
...
There have been only two interestingly innovative architectures recently: the Mill and xCORE.

The Mill - dead as a door nail, before being alive, ultra-proprietary patent troll stuff.
xCORE  - (almost) dead, but was living briefly and still twitching, still nobody gave a rat behind about it and then it sunk in the bucket of bad ideas, no next Atmel or STM anytime soon.

So much for the innovation, anybody with a bit of brain can imagine a CPU architecture (see OpenCores CPU section), but if it does not offer massive advantages over the existing stuff, it will be just an exercise in spending venture or EU grants money.
IMHO, the advancements in code analyzers and simulators will make the existing stuff secure enough (fast already is) without the need of introducing strange cumbersome concepts, of course if the HW guys will stop cutting corners in an attempt to squeeze the last bit of performance.

Totally agreed!
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline DC1MC

  • Super Contributor
  • ***
  • Posts: 1882
  • Country: de
Re: any examples of OS not written in C/C++?
« Reply #79 on: April 16, 2021, 05:37:38 pm »
OS security is actually pretty awful. Any attempt to put a safety net under clueless programmers who drop the ball every other hour is IMHO laudable. If that turns out to be an OS written in whitespace, so be it.

Clueless programmers should stick to "apps", and have no need for, or use in, OS programming. Regarding the "safety nets", who checks for safety of the safety net, we definitely need a TÜV for OSes.
 

Offline DC1MC

  • Super Contributor
  • ***
  • Posts: 1882
  • Country: de
Re: any examples of OS not written in C/C++?
« Reply #80 on: April 16, 2021, 06:03:38 pm »
Hey look, what about writing an OS in ADA ?

In the end it was designed for this, IMNSHO is still better than Lisp, we have nice tutorials for those who want to learn:

https://learn.adacore.com/pdf_books/courses/Ada_For_The_Embedded_C_Developer.pdf

Free and OSS advanced (cross)toolchains, even a special one intended for bareboard targets (this is how you do your OS), what more to to want ? Also, you can buy professional support as well.

https://docs.adacore.com/live/wave/gnat_ugx/html/gnat_ugx/gnat_ugx/bareboard_topics.html

You can learn more in this short presentation video:
https://rr.noordstar.me/5818b6fa
« Last Edit: April 16, 2021, 06:08:22 pm by DC1MC »
 
The following users thanked this post: DiTBho

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19281
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: any examples of OS not written in C/C++?
« Reply #81 on: April 16, 2021, 06:35:30 pm »
C is now a major impediment to improvement  just like the 80x86 ISA.
I'm not clear what you mean by that. Can you give examples?

Many other people have done that far better than I could. I liked C in the early 80s, but by the time the mid 90s had arrived it was clear that C and C++ were problems rather than answers.

I well remember the endless (over a year) debate about whether it should be possible/impossible to "cast away constness". There are good reasons for both, but they are obviously mutually incompatible.

There's the C++ FQA, of course.

Amusingly, until recently it wasn't even possible to write an OS in C. I know it is ridiculous, but as late a 2004 Hans Boehm had to point that out to many people in "Threads Cannot be Implemented as a Library" http://www.hpl.hp.com/techreports/2004/HPL-2004-209.html

Quote
There have been only two interestingly innovative architectures recently: the Mill and xCORE.
The Mill is an interesting CPU architecture. The interesting thing about xCORE is the way the CPUs cooperate, rather than anything about the architecture of the CPUs.

A key point is multiprocessor/multiprocessing operation - but many processors have that. It is easy to make very parallel processors, but difficult to program them to make use of the parallelism.

The unique point is the tight integration of hardware capabilities with software capabilities such that together they are better than the sum.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline thinkfat

  • Supporter
  • ****
  • Posts: 2150
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: any examples of OS not written in C/C++?
« Reply #82 on: April 16, 2021, 06:48:48 pm »
OS security is actually pretty awful. Any attempt to put a safety net under clueless programmers who drop the ball every other hour is IMHO laudable. If that turns out to be an OS written in whitespace, so be it.

Clueless programmers should stick to "apps", and have no need for, or use in, OS programming. Regarding the "safety nets", who checks for safety of the safety net, we definitely need a TÜV for OSes.

As a matter of fact, TÜV does security certification to Common Criteria. But anyone can have that, if the threat model is lean enough.

Regarding Clueless programmers should stick to apps, that's just elitist crap. Rockstars are rare, supply never meets demand and if a venture relies only on them it is doomed to fail. But if your framework allows you to utilize the 'waterboys' instead of packing all the mundane tasks on your few quarterbacks, you will definitely have a competitive edge over the team of just Allstars.
Everybody likes gadgets. Until they try to make them.
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19281
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: any examples of OS not written in C/C++?
« Reply #83 on: April 16, 2021, 06:56:36 pm »
OS security is actually pretty awful. Any attempt to put a safety net under clueless programmers who drop the ball every other hour is IMHO laudable. If that turns out to be an OS written in whitespace, so be it.

Clueless programmers should stick to "apps", and have no need for, or use in, OS programming. Regarding the "safety nets", who checks for safety of the safety net, we definitely need a TÜV for OSes.

As a matter of fact, TÜV does security certification to Common Criteria. But anyone can have that, if the threat model is lean enough.

Regarding Clueless programmers should stick to apps, that's just elitist crap. Rockstars are rare, supply never meets demand and if a venture relies only on them it is doomed to fail. But if your framework allows you to utilize the 'waterboys' instead of packing all the mundane tasks on your few quarterbacks, you will definitely have a competitive edge over the team of just Allstars.

Just so.

Plus in my experience the programmers that consider themselves "the elite" often
  • don't understand as much as they think about the language. Not quite Dunning Krueger territory, but destructive enough
  • concentrate on minutiae and make awful architectural decisions
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 8605
  • Country: gb
Re: any examples of OS not written in C/C++?
« Reply #84 on: April 16, 2021, 07:04:50 pm »
C is now a major impediment to improvement  just like the 80x86 ISA.
I'm not clear what you mean by that. Can you give examples?

Many other people have done that far better than I could. I liked C in the early 80s, but by the time the mid 90s had arrived it was clear that C and C++ were problems rather than answers.
People have loved writing "C is bad" articles" since C first appeared, but most don't really hold water.

I well remember the endless (over a year) debate about whether it should be possible/impossible to "cast away constness". There are good reasons for both, but they are obviously mutually incompatible.
Tinkering with constness is more about the use of ROM than the CPU architecture.

There's the C++ FQA, of course.
C++ doesn't count. Its so complex and quirky, it certainly does tie people's hands.

Amusingly, until recently it wasn't even possible to write an OS in C. I know it is ridiculous, but as late a 2004 Hans Boehm had to point that out to many people in "Threads Cannot be Implemented as a Library" http://www.hpl.hp.com/techreports/2004/HPL-2004-209.html
I think Hans Boehm is also someone who wrote an excellent article about how poorly understood the memory models of various x86 cores was (even by their own developers), and how this shot holes in most threading systems. I don't see how this makes running C code an impediment to progress.

Quote
There have been only two interestingly innovative architectures recently: the Mill and xCORE.
The Mill is an interesting CPU architecture. The interesting thing about xCORE is the way the CPUs cooperate, rather than anything about the architecture of the CPUs.

A key point is multiprocessor/multiprocessing operation - but many processors have that. It is easy to make very parallel processors, but difficult to program them to make use of the parallelism.

The unique point is the tight integration of hardware capabilities with software capabilities such that together they are better than the sum.
Sure, but you could do that with x86 or ARM cores. There is nothing particular about the xCORE cores that makes them special. I've encountered many people trying to tie their favourite ISA to an interesting scheme, that had almost nothing to do with the ISA.
 

Offline MarginallyStable

  • Regular Contributor
  • *
  • Posts: 65
  • Country: us
Re: any examples of OS not written in C/C++?
« Reply #85 on: April 16, 2021, 07:09:29 pm »
I use a subset of c++ in many embedded projects. I feel the way I use it could be good within the linux kernel. Always thought there should be a "c+" specification that would be the stripped down functionality for this scenario (no stdlib, exceptions, etc).
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 8605
  • Country: gb
Re: any examples of OS not written in C/C++?
« Reply #86 on: April 16, 2021, 07:14:00 pm »
I use a subset of c++ in many embedded projects. I feel the way I use it could be good within the linux kernel. Always thought there should be a "c+" specification that would be the stripped down functionality for this scenario (no stdlib, exceptions, etc).
One of the things I really missed when using C after languages like CORAL66 was the ability to bundle groups of functions into their own module. That was already becoming a common features of languages in the ALGOL sphere when C was developed. Its a pity some basic management tools like this never made their way into the C spec.
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19281
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: any examples of OS not written in C/C++?
« Reply #87 on: April 16, 2021, 07:34:42 pm »
I use a subset of c++ in many embedded projects. I feel the way I use it could be good within the linux kernel. Always thought there should be a "c+" specification that would be the stripped down functionality for this scenario (no stdlib, exceptions, etc).

The problems arise when co-workers use a different subset, or users of your code don't understand the limitations it imposes on their code. And in C implementations that includes having the right compilation flags.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19281
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: any examples of OS not written in C/C++?
« Reply #88 on: April 16, 2021, 07:37:01 pm »
I use a subset of c++ in many embedded projects. I feel the way I use it could be good within the linux kernel. Always thought there should be a "c+" specification that would be the stripped down functionality for this scenario (no stdlib, exceptions, etc).
One of the things I really missed when using C after languages like CORAL66 was the ability to bundle groups of functions into their own module. That was already becoming a common features of languages in the ALGOL sphere when C was developed. Its a pity some basic management tools like this never made their way into the C spec.

I narrowly missed using CORAL66, and have long been amazed at "name collisions" in C.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9886
  • Country: us
Re: any examples of OS not written in C/C++?
« Reply #89 on: April 16, 2021, 07:52:12 pm »
I don't think I'm going to rush into Rust

Code: [Select]
-rwxr-xr-x 1 rstofer rstofer    8304 Apr 16 12:49 hello
-rw-r--r-- 1 rstofer rstofer      71 Apr 16 12:48 hello.c
-rwxr-xr-x 1 rstofer rstofer 3343520 Apr 16 12:47 main
-rw-r--r-- 1 rstofer rstofer      46 Apr 16 12:47 main.rs

Look at the size of the 'main' executable compared to 'hello'.

I'll concede I know absolutely nothing about Rust but I got the example here:
https://doc.rust-lang.org/book/ch01-02-hello-world.html
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19281
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: any examples of OS not written in C/C++?
« Reply #90 on: April 16, 2021, 07:54:03 pm »
C is now a major impediment to improvement  just like the 80x86 ISA.
I'm not clear what you mean by that. Can you give examples?

Many other people have done that far better than I could. I liked C in the early 80s, but by the time the mid 90s had arrived it was clear that C and C++ were problems rather than answers.
People have loved writing "C is bad" articles" since C first appeared, but most don't really hold water.

"90% of everything is crap" - but the 10% is worth understanding.

Quote
I well remember the endless (over a year) debate about whether it should be possible/impossible to "cast away constness". There are good reasons for both, but they are obviously mutually incompatible.
Tinkering with constness is more about the use of ROM than the CPU architecture.

Absolutely not. Constness is about correct operation in the presence of large programs and/or optimisation. ROMs are a side issue.

Without constness, many optimisations aren't possible because the compiler cannot determine the absence of aliasing. Even then, having the wrong compilation flags introduces all sorts of intermittent bugs.

With constness, how can a debugger operate?

Quote
There's the C++ FQA, of course.
C++ doesn't count. Its so complex and quirky, it certainly does tie people's hands.

No argument there. If C++ is is the answer, you asked the wrong question.

Quote
Amusingly, until recently it wasn't even possible to write an OS in C. I know it is ridiculous, but as late a 2004 Hans Boehm had to point that out to many people in "Threads Cannot be Implemented as a Library" http://www.hpl.hp.com/techreports/2004/HPL-2004-209.html
I think Hans Boehm is also someone who wrote an excellent article about how poorly understood the memory models of various x86 cores was (even by their own developers), and how this shot holes in most threading systems. I don't see how this makes running C code an impediment to progress.

Strawman question!

Until very recently, C didn't even have a memory model. How successful its current memory model will be remains to be seen. It is a very difficult area; even Java had to modify the memory model in the light of experience.

Quote
Quote
There have been only two interestingly innovative architectures recently: the Mill and xCORE.
The Mill is an interesting CPU architecture. The interesting thing about xCORE is the way the CPUs cooperate, rather than anything about the architecture of the CPUs.

A key point is multiprocessor/multiprocessing operation - but many processors have that. It is easy to make very parallel processors, but difficult to program them to make use of the parallelism.

The unique point is the tight integration of hardware capabilities with software capabilities such that together they are better than the sum.
Sure, but you could do that with x86 or ARM cores. There is nothing particular about the xCORE cores that makes them special. I've encountered many people trying to tie their favourite ISA to an interesting scheme, that had almost nothing to do with the ISA.

Correct. There was even an XMOS processor that included an ARM core!

Nonetheless, the combination of i/o ports, comms fabric, multiprocessor cores, language and IDE tools is unparalleled (ho ho ho). It is the unified vision plus implementation of the vision that is unique.

I also hope it is not the last word - we need as much help as we can get with highly parallel systems. There are encouraging signs: other modern languages are incorporating some of the CSP and xC concepts more or less directly. Such languages are learning from the past, not being constrained by it.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19281
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: any examples of OS not written in C/C++?
« Reply #91 on: April 16, 2021, 07:56:14 pm »
I don't think I'm going to rush into Rust

Wise decision; neither am I!

Quote
Code: [Select]
-rwxr-xr-x 1 rstofer rstofer    8304 Apr 16 12:49 hello
-rw-r--r-- 1 rstofer rstofer      71 Apr 16 12:48 hello.c
-rwxr-xr-x 1 rstofer rstofer 3343520 Apr 16 12:47 main
-rw-r--r-- 1 rstofer rstofer      46 Apr 16 12:47 main.rs

Look at the size of the 'main' executable compared to 'hello'.

I'll concede I know absolutely nothing about Rust but I got the example here:
https://doc.rust-lang.org/book/ch01-02-hello-world.html

But microbenchmarks - which might be invalidated tomorrow - are not a good basis for avoiding any language.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9886
  • Country: us
Re: any examples of OS not written in C/C++?
« Reply #92 on: April 16, 2021, 08:14:06 pm »
I don't think I'm going to rush into Rust

Wise decision; neither am I!

Quote
Code: [Select]
-rwxr-xr-x 1 rstofer rstofer    8304 Apr 16 12:49 hello
-rw-r--r-- 1 rstofer rstofer      71 Apr 16 12:48 hello.c
-rwxr-xr-x 1 rstofer rstofer 3343520 Apr 16 12:47 main
-rw-r--r-- 1 rstofer rstofer      46 Apr 16 12:47 main.rs

Look at the size of the 'main' executable compared to 'hello'.

I'll concede I know absolutely nothing about Rust but I got the example here:
https://doc.rust-lang.org/book/ch01-02-hello-world.html

But microbenchmarks - which might be invalidated tomorrow - are not a good basis for avoiding any language.

But even this simple test can serve to dissuade a programmer from trying a language that, at best, is a poor substitute for C.  C has been around a while, I expect it to join Fortran and COBOL as one of the long lasting languages.

I know, everybody is laughing at the geezer geek!  Well, there is an nvfortran compiler for NVIDIA GPU programming.  I don't see that it works on the Jetson Nano platform but it certainly works on the graphic board GPUs.

And banking still relies on COBOL.  If you get cash from an ATM, chances are the banking end of the code was written in COBOL.

Fortran introduced in 1957 (created in 1954)
COBOL introduced in 1959
C introduced in 1972
C++ introduced in 1985
Rust introduced in 2013 - 56 years after Fortran and 41 years after C
 

Offline benst

  • Regular Contributor
  • *
  • Posts: 87
  • Country: nl
Re: any examples of OS not written in C/C++?
« Reply #93 on: April 16, 2021, 08:29:48 pm »
One of my favorites is the Lilith workstation by Niklaus Wirth on which everything was coded in Modula-2 including the OS. See https://en.wikipedia.org/wiki/Lilith_%28computer%29

Ben
I hack for work and pleasure.
 
The following users thanked this post: DiTBho

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19281
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: any examples of OS not written in C/C++?
« Reply #94 on: April 16, 2021, 09:24:10 pm »
I don't think I'm going to rush into Rust

Wise decision; neither am I!

Quote
Code: [Select]
-rwxr-xr-x 1 rstofer rstofer    8304 Apr 16 12:49 hello
-rw-r--r-- 1 rstofer rstofer      71 Apr 16 12:48 hello.c
-rwxr-xr-x 1 rstofer rstofer 3343520 Apr 16 12:47 main
-rw-r--r-- 1 rstofer rstofer      46 Apr 16 12:47 main.rs

Look at the size of the 'main' executable compared to 'hello'.

I'll concede I know absolutely nothing about Rust but I got the example here:
https://doc.rust-lang.org/book/ch01-02-hello-world.html

But microbenchmarks - which might be invalidated tomorrow - are not a good basis for avoiding any language.

But even this simple test can serve to dissuade a programmer from trying a language that, at best, is a poor substitute for C.  C has been around a while, I expect it to join Fortran and COBOL as one of the long lasting languages.

You are aware, I presume, that there are serious moves to enable Rust in the Linux kernel.

As I see it, one of the less tractable problems is that it relies on the LLVM compiler, not gcc.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9886
  • Country: us
Re: any examples of OS not written in C/C++?
« Reply #95 on: April 16, 2021, 10:27:08 pm »
I just followed the directions using Ubuntu under Win 10.  I did no other research.
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19281
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: any examples of OS not written in C/C++?
« Reply #96 on: April 16, 2021, 10:51:21 pm »
I just followed the directions using Ubuntu under Win 10.  I did no other research.

I guess you are referring to my post noting the moves to have Rust in the Linux kernel.

It sounds like your negative opinion is based on inexperience with using the tool.
My inexperience leads me to sit on the fence, on the basis that there are significant potential benefits, but they haven't been demonstrated to my limited knowledge.

You may care to read:
https://www.phoronix.com/scan.php?page=news_item&px=Torvalds-Rust-Kernel-K-Build
https://www.phoronix.com/scan.php?page=news_item&px=Rust-Hits-Linux-Next
https://www.phoronix.com/scan.php?page=news_item&px=Rust-For-Linux-April-2021-RFC
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline ve7xen

  • Super Contributor
  • ***
  • Posts: 1192
  • Country: ca
    • VE7XEN Blog
Re: any examples of OS not written in C/C++?
« Reply #97 on: April 16, 2021, 11:20:58 pm »
I don't think I'm going to rush into Rust

Code: [Select]
-rwxr-xr-x 1 rstofer rstofer    8304 Apr 16 12:49 hello
-rw-r--r-- 1 rstofer rstofer      71 Apr 16 12:48 hello.c
-rwxr-xr-x 1 rstofer rstofer 3343520 Apr 16 12:47 main
-rw-r--r-- 1 rstofer rstofer      46 Apr 16 12:47 main.rs

Look at the size of the 'main' executable compared to 'hello'.

I'll concede I know absolutely nothing about Rust but I got the example here:
https://doc.rust-lang.org/book/ch01-02-hello-world.html

The standard library is linked statically by default, though your binary is still an order of magnitude larger than mine for some reason. If you do dynamic linking, comparable to the default with C, it's down to 20KB on my system which is barely larger than what gcc emits. The statically linked C binary is actually larger than Rust's.

Not that this is really a great reason to choose a language. These days the size of the binary on disk is more or less irrelevant for almost all code.

Code: [Select]
$ rustc main.rs
$ du -h main
336K    main
$ rustc -C prefer-dynamic main.rs
$ du -h main
20K     main
$ gcc -o main main.c
$ du -h main
16K     main
$ gcc -static -o main main.c
$ du -h main
952K    main
73 de VE7XEN
He/Him
 
The following users thanked this post: newbrain

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9886
  • Country: us
Re: any examples of OS not written in C/C++?
« Reply #98 on: April 17, 2021, 02:06:04 am »
I used these instructions for installation (Section 1.1)

https://doc.rust-lang.org/book/ch01-01-installation.html

and this HelloWorld example (Section 1.2)

https://doc.rust-lang.org/book/ch01-02-hello-world.html

I didn't pursue the topic beyond looking at the size of the executable.

And what's with the 'macro' notation with the ! symbol?

println!("Hello World");

Seriously?

 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19281
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: any examples of OS not written in C/C++?
« Reply #99 on: April 17, 2021, 08:13:54 am »
I used these instructions for installation (Section 1.1)

https://doc.rust-lang.org/book/ch01-01-installation.html

and this HelloWorld example (Section 1.2)

https://doc.rust-lang.org/book/ch01-02-hello-world.html

I didn't pursue the topic beyond looking at the size of the executable.

It appears that your principal objective was to find an excuse to dismiss the language.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf