Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can a compiler work without an Operating System?

43 views
Skip to first unread message

Vansh Kapoor

unread,
Feb 19, 2024, 8:40:42 PMFeb 19
to
I was reading this book 'Computer Systems' and it made me wander if the compiler exists in Operating system or it can individualy work with the processor main memory and I/O bridges.

John Levine

unread,
Feb 19, 2024, 9:22:38 PMFeb 19
to
According to Vansh Kapoor <kapoorv...@gmail.com>:
>I was reading this book 'Computer Systems' and it made me wander if the compiler exists in Operating system or it can individualy work with the processor main memory
>and I/O bridges.

It's less common now but there have been plenty of compilers that
worked without operating systems. The original FORTRAN compiler ran on
an IBM 704, loaded directly from mag tape. When I was using a PDP-8
around 1970 it didn't have an operating system but there were
assemblers and a Fortran compiler we loaded from paper tape.



--
Regards,
John Levine, jo...@taugh.com, Primary Perpetrator of "The Internet for Dummies",
Please consider the environment before reading this e-mail. https://jl.ly

Bob Eager

unread,
Feb 20, 2024, 3:22:47 AMFeb 20
to
On Tue, 20 Feb 2024 02:22:34 +0000, John Levine wrote:

> According to Vansh Kapoor <kapoorv...@gmail.com>:
>>I was reading this book 'Computer Systems' and it made me wander if the
>>compiler exists in Operating system or it can individualy work with the
>>processor main memory and I/O bridges.
>
> It's less common now but there have been plenty of compilers that worked
> without operating systems. The original FORTRAN compiler ran on an IBM
> 704, loaded directly from mag tape. When I was using a PDP-8 around 1970
> it didn't have an operating system but there were assemblers and a
> Fortran compiler we loaded from paper tape.

And, indeed, that can apply to any program.


--
Using UNIX since v6 (1975)...

Use the BIG mirror service in the UK:
http://www.mirrorservice.org

Ahem A Rivet's Shot

unread,
Feb 20, 2024, 4:00:03 AMFeb 20
to
Most certainly, although it is far from common these days. The most
recent example I know of isn't exactly a compiler but it's close[1].
Smalltalk V/286 started running under MSDOS but promptly switched to
protected mode and abandoned the OS it had used only as a launcher.

[1] OK it was more like a seething mass of mutable objects with an embedded
compiler.

--
Steve O'Hara-Smith
Odds and Ends at http://www.sohara.org/
For forms of government let fools contest
Whate're is best administered is best - Alexander Pope

Julieta Shem

unread,
Feb 20, 2024, 5:12:09 AMFeb 20
to
Vansh Kapoor <kapoorv...@gmail.com> writes:

> I was reading this book 'Computer Systems'

Is it interesting? Who are the authors?

> and it made me wander if the compiler exists in Operating system or it
> can individualy work with the processor main memory and I/O bridges.

It's not clear if you mean running the compiler without an operating
system of if the compiler is able to produce a program that can run
without an operating system. I think you mean the former---can the
compiler bootstrap the computer system and offer an interface to the
user to write programs, compile and run them? This would make the
compiler also be a text editor and a shell, essentially replacing the
entire operating system. That's not what typical compilers are.

A compiler such as GCC---the GNU C Compiler (these days called the GNU
Compiler Collection)---is definitely able to produce a program that can
run without an operating system. This is how an operating system kernel
is produced [1], but typical compilers (GCC included) are not meant to
run without an operating system.

(*) Footnotes

[1] A kernel is by definition a program that can run without an
operating system because a kernel is a program that prepares the
computer system to run other programs.

Theo

unread,
Feb 20, 2024, 8:05:43 AMFeb 20
to
Julieta Shem <js...@yaxenu.org> wrote:
> Vansh Kapoor <kapoorv...@gmail.com> writes:
>
> > I was reading this book 'Computer Systems'
>
> Is it interesting? Who are the authors?
>
> > and it made me wander if the compiler exists in Operating system or it
> > can individualy work with the processor main memory and I/O bridges.
>
> It's not clear if you mean running the compiler without an operating
> system of if the compiler is able to produce a program that can run
> without an operating system. I think you mean the former---can the
> compiler bootstrap the computer system and offer an interface to the
> user to write programs, compile and run them? This would make the
> compiler also be a text editor and a shell, essentially replacing the
> entire operating system. That's not what typical compilers are.

It really depends on the nature of your I/O. A compiler transforms source
code into object code (or machine code). With a modern compiler the source
and machine code are stored in files so you need something to provide a file
abstraction, which we call an OS. But I could imagine where you fed in
first the compiler binary on paper tape, then your source code on another
tape. This prints a tape holding the machine code output. Then you feed
that tape back into the machine to run it.

If you could do a modern reimagination of that idea you could have it work
without an OS. But it's hard to see why you would want to.

You could also implement file handling inside the compiler, so the compiler
talks to the storage directly to fetch files, and has the ability to load
and execute compiled code itself. But that's really just embedding OS
functions inside the compiler.

Theo

Carlos E.R.

unread,
Feb 20, 2024, 8:06:17 AMFeb 20
to
On 2024-02-20 09:50, Ahem A Rivet's Shot wrote:
> On Mon, 19 Feb 2024 17:40:41 -0800 (PST)
> Vansh Kapoor <kapoorv...@gmail.com> wrote:
>
>> I was reading this book 'Computer Systems' and it made me wander if the
>> compiler exists in Operating system or it can individualy work with the
>> processor main memory and I/O bridges.
>
> Most certainly, although it is far from common these days. The most
> recent example I know of isn't exactly a compiler but it's close[1].
> Smalltalk V/286 started running under MSDOS but promptly switched to
> protected mode and abandoned the OS it had used only as a launcher.
>
> [1] OK it was more like a seething mass of mutable objects with an embedded
> compiler.

I can not see the OP (because it comes from Google groups) but it is
common with small machines to not have an operating system.

This thing, for instance:

https://www.shelly.com/en


From second hand information, you compile adding the parts you are
going to use, as space is limited.

--
Cheers, Carlos.

Julieta Shem

unread,
Feb 20, 2024, 8:59:10 AMFeb 20
to
"Carlos E.R." <robin_...@es.invalid> writes:

[...]

> I can not see the OP (because it comes from Google groups)

Sadly, I couldn't see him either. I only saw after other people
replied. We should let the OP know that he's using a tool---Google
Groups---which is about to leave the USENET. IIRC, the date is what?
February 22nd 2024?

Dear OP, grab a program like Thunderbird (or some other) and get an
account at a free USENET server such as Eternal September, which you can
find at

https://www.eternal-september.org/

Google Groups is about to remove your ability to post to the USENET and
will also not let you see our replies. You have two days to act.

songbird

unread,
Feb 20, 2024, 9:00:06 AMFeb 20
to
Vansh Kapoor wrote:
> I was reading this book 'Computer Systems' and it made me wander if the compiler exists in Operating system or it can individualy work with the processor main memory and I/O bridges.

there's nothing preventing the OS from being some
kind of language interpreter or compiler, but i would
think that would be a very embedded type of system
these days.

one of the benefits of more recent ideas is that it
really helps to keep different functions isolated a
bit from each other so they can be tested and not
have the rest of the system so tightly coupled.

how would you upgrade such a monolithic system?
what would there be for quality control or testing?
etc.


songbird

Scott Alfter

unread,
Feb 20, 2024, 1:32:59 PMFeb 20
to
In article <87ttm3b...@yaxenu.org>, Julieta Shem <js...@yaxenu.org> wrote:
>A compiler such as GCC---the GNU C Compiler (these days called the GNU
>Compiler Collection)---is definitely able to produce a program that can
>run without an operating system. This is how an operating system kernel
>is produced [1], but typical compilers (GCC included) are not meant to
>run without an operating system.

It's also how code is built to run on microcontrollers and such. You can't
run gcc on an AVR or STM32, but gcc will build code for both of those and
more.

--
_/_
/ v \ Scott Alfter (remove the obvious to send mail)
(IIGS( https://alfter.us/ Top-posting!
\_^_/ >What's the most annoying thing on Usenet?

Andy Burns

unread,
Feb 21, 2024, 2:50:13 PMFeb 21
to
Carlos E.R. wrote:

> it is common with small machines to not have an operating system.
> This thing, for instance:
>
> https://www.shelly.com/en

I doubt that a 'smart' switch provides a compiler ...

Ahem A Rivet's Shot

unread,
Feb 21, 2024, 3:30:04 PMFeb 21
to
Find out what chip/SOC it uses and look for the manufacturer's SDK.

Andy Burns

unread,
Feb 21, 2024, 4:02:02 PMFeb 21
to
Ahem A Rivet's Shot wrote:

> Andy Burns wrote:
>
>> I doubt that a 'smart' switch provides a compiler ...
>
> Find out what chip/SOC it uses and look for the manufacturer's SDK.

I think all the shelly devices can be flashed with tasmota, so ESP32 based

Carlos E.R.

unread,
Feb 21, 2024, 4:21:39 PMFeb 21
to
No, you do it externally. Write the code, compile, link with the runtime
library, and flash it to the module. I haven't done it personally, so I
do not know more.

--
Cheers, Carlos.

Bob Martin

unread,
Feb 22, 2024, 1:25:37 AMFeb 22
to
Many of the early IBM 360 programs were loaded from card decks.
I remember using DEBE a lot.
OS/360 version was 4/5 when I started (never used DOS or TOS).

0 new messages