I'm not a Fortran developer myself, but I'm about to use it a little and found myself wondering why, if it is much older than C but equally as performant as C, was it never used to develop any operating system before C and UNIX came along?

A substitute answer, if the above is invalid, might be which operating systems were developed in Fortran. But still, it didn't seem to catch on at all.

  • 2
    Basic is also old but definitely not suited for OS building – ratchet freak Oct 6 '14 at 15:44
  • 11
    C was specifically designed for writing operating systems. Fortran was not; its specialty is numeric and scientific computing. – Robert Harvey Oct 6 '14 at 15:44
  • 1
    Perhaps after I use Fortran a bit, the answer will be self evident... I suppose it lacked good support for pointers at the time, and maybe it still does (I'm still sketchy on the details). – bbarker Oct 6 '14 at 15:48
  • 4
    @bbarker: I'm only familiar with the 1977 standard, but back then Fortran didn't offer much support for any low-level operations that an OS would need to perform (memory management being one area). Despite being older, Fortran has a higher level of abstraction than C. It's great for doing number-crunching, because that's what it was designed for. – John Bode Oct 6 '14 at 16:11
  • 1
    Can you provide evidence that FORTRAN was never used for this? – GrandmasterB Oct 6 '14 at 19:31
up vote 14 down vote accepted

I'd say that Fortran, even of pre-C times, abstracts the programmer from hardware details too much.

  • No pointer support. If you want to pass large amounts of data between subroutines, you use a COMMON block, and you don't control its allocation. Pointer arithmetic and structure allocation control are hard to non-existent.
  • Data types are numeric-oriented. Referring to a particular byte is a bit hard, let alone bits.
  • I/O is provided by language statements, not by subroutines. You depend on the compiler's runtime for it, and cannot roll your own.

This is off the top of my head; last time I wrote Fortran-IV code was ~25 years ago.

Possibly you could alter a Fortran compiler to introduce the missing capabilities. But building a special-purpose 'portable assembly' language like C proved to be easier and more effective.

  • 1
    This is part of it, but the crux of the issue is that C supports pretty much every function that a CPU can perform, hence it having the nickname "portable assembly." Languages that abstract too much of the CPU function cannot be used as a foundational language to build the core kernel, I/O, and memory modules. – user22815 Oct 6 '14 at 18:03
  • 1
    @Snowman А C compiler can lack support for particular CPU instructions, failing to offer a high-level construct to compile into these instructions, not even intrinsics. This leaves you with inline assembly or just assembly + extrn functions. I suppose Fortran could offer the same if it had adequate data structures and a way to handle pointers. Interfacing Fortran from assembly was not hard (at leas on PDP11), but it somehow defeats the purpose of a 'portable assembly'. – 9000 Oct 6 '14 at 18:18
  • 1
    I realized after I made that comment that it is not entirely true, there are plenty of instructions that C does not support natively (e.g. SIMD). However, with inline assembly pretty much anything is possible. Technically with C bindings other languages could leverage that as well, though. – user22815 Oct 6 '14 at 18:20
  • 2
    The lack of pointer support is the fundamental problem. One of the main jobs of an OS is to subdivide memory based upon demands made at runtime, but FORTRAN has traditionally required that each program must specify its memory requirements before it can do anything else. A FORTRAN implementation could code to allow arbitrary sorts of low-level I/O by defining functions to e.g. "read I/O register N" or "store M to I/O register N" or even read/write arbitrary memory addresses, but it would have no facility to have "ordinary" statements interpret memory in ways determined at runtime. – supercat Oct 6 '14 at 18:33
  • Eppur si muove. See PRIMOS – Ross Patterson Oct 19 '14 at 13:09

Who says FORTRAN was never used to develop an operating system?

Prime Computer's PRIMOS was written in FORTRAN. I first encountered it in 1982, but it had been around for a while already. There was some assembler, but no more than there was in Unix, which is largely described as "written in C".

No.

Aside from structural issues of lack of pointers and access to hardware that is typically necessary for operating system design (fortran is too abstract), fortran also had a significant issue with different versions from different manufactures being, well, different. Fortran 66 was the first industry standard version (before fortran 77), but even with these standards there were many other versions out there.

There were also other languages which did offer the necessary access to memory as memory, and hardware, and a bit less abstract. You had PL/I from '64 which was used to write Multix. BCPL and B from '66 and '69 respectively were also used for operating system development. And then there was and C from '72. And one shouldn't forget the MCP for the Burroughs B5000 written in Algol in '61 (compare with Fortran being introduced in '58).

All of those better languages were better choices for operating system design - and were used for various operating systems. They were standardized, cross platform and stable in a time when Fortran wasn't well standardized and programs that ran on IBM might not run on Digital equipment. They also were availabe very shortly after fortran and people started thinking about writing an OS in a language that was no longer seen as slow (compiler technology and optimizations were staring to catch up to hand coded assembly).

So, no. There was no reason to write an operating system in Fortran when there were much better tools available for those who wanted to take it up. As fortran as a systems language isn't recorded in the history while other ones are, and it certainly would have been notable it is probably safe to say that no serious operating system development has been done in Fortran.

From a Fortran 95 handout:

Not being a general-purpose language, there are some things Fortran is very bad at. Anyone trying to write a compiler or operating system in Fortran is probably mad or about to become mad. However the ‘old’ University Library electronic catalogue, which is soon to be replaced, is written in Fortran, even though this is far from the sort of application for which Fortran was designed.

  • @JohnR.Strohm thank you, corrected that order of events. – user40980 Oct 7 '14 at 1:11
  • 2
    In the time period in question, operating systems were not manufacturer- or platform-independent. As such, the fact that FORTRAN varied from manufacturer to manufacturer, and from machine to machine even at the same manufacturer, is not a significant issue. Far more significant is the lack of low-level access (pointers). More to the point, at that time, it was generally believed that high-level languages could not yield the performance and security needed for an operating system. – John R. Strohm Oct 7 '14 at 1:11
  • In the 50s, that might have been true (and I dug some around trying to find what the Fortran Monitor System was written in... all I could get was 'assembly' which was probably the case), but by 61 there was an operating system written in Algol. The contemporary fortran was Fortran IV. Note that Fortran III from '58 might have been usable as a framework around inline assembly, but it was never released as a product - that appears to have been a dead end (it wasn't in IV). Part of the point though, is that we're only talking about a year between Fortran being introduced and algol... – user40980 Oct 7 '14 at 1:17
  • And algol was capable of being a system/general purpose language, and was within three years of its creation. I would assume that people started looking at that possibility very early on in its development. The first operating system written in a high level language came out before PL/I or BCPL. – user40980 Oct 7 '14 at 1:20
  • FWIW - Multics, not Multix, was written in PLI. see: multicians.org – dbasnett Oct 9 '14 at 11:41

Fortran is a LINEAR programming language and is ill suited to the development of an OS.

The C family of languages are OBJECT ORIENTED PROGRAMMING (OOP) languages. They allow non-linear programs to run multiple, simultaneous routines, branches, sub-routines, all without unnecessary complications.

Think of Fortran as a pipe carrying water from point A to point B. Think of OOP languages as an ocean stretching from shore to shore, doing all sorts of things, all at once.

  • 6
    I wouldn't necessarily call 'C' an object oriented language. The abstraction you are describing doesn't seem to help with understanding why Fortran wasn't used for operating system creation. – user40980 Oct 6 '14 at 18:18
  • 5
    You are seemingly conflating C and C++. You can write OO code in C (see Gnome / GTK), and probably even in Fortran. C++ only provides [reams of] syntactic sugar for that. – 9000 Oct 6 '14 at 18:20
  • Actually, modern Fortran offers more OO features than modern C. – mouviciel Oct 13 '14 at 6:56

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.