Discussion:
Multics vs Unix
Add Reply
Lawrence D'Oliveiro
2024-12-17 20:41:32 UTC
Reply
Permalink
I was reading the introductory “Multics Concepts and Utilization” book
<http://bitsavers.trailing-edge.com/pdf/honeywell/large_systems/multics/F01_multicsIntroCourseOct78.pdf>
over at Bitsavers. Multics (the “MULTiplexed Information and Computing
Service”) was, for its time, an extremely ambitious operating system
project. It was first introduced in 1965, in the form of a series of
papers at the AFIPS Fall Joint Computer Conference of that year
<https://www.computer.org/csdl/proceedings/1965/afips/12OmNzSh1au>.

Of course, it took far too long (7 years) to reach production quality.
In that time, a small group of researchers at AT&T Bell Labs grew
tired of waiting, and decided to create their own, less ambitious
system, which they called “UNIX” as a tongue-in-cheek homage to
“Multics”. And the rest, as they say, is history.

But, nevertheless, Multics remained an influential system. There are
even some present-day fans of it gathered at
<https://multicians.org/>. Apparently they have got the OS booting on
an emulator of the original GE 645 hardware. Though it was mostly
written in a high-level language (PL/I), Multics was never a portable
OS; to support its advanced virtual-memory and security features, it
required special processor hardware support which was not common in
those days.

Even today, Multics has some features which can be considered
innovative and uncommon. It may be true that, for example, SELinux can
match all of its security capabilities and more. But some aspects of
its file-protection system seem, to me, to make sharing of data
between users a bit easier than your typical Linux/POSIX-type system.

For a start, there seems to be no concept of file “ownership” as such.
Or even of POSIX-style file protection modes (read/write/execute for
owner/group/world). Instead, all file and directory access is
controlled via access-control lists (ACLs). Directories have a
permission called “modify”, which effectively gives a matching entity
(user, group, process) owner-type rights over that directory; except
that more than one entity can have that permission at once. Thus, a
group of users working on a common project can all be given this
“modify” access to a shared directory for that project, allowing them
all to put data there, read it back again, control access to it,
delete it etc on a completely equal basis. Contrast this with
POSIX/Linux, where every file has to have exactly one owner; even if
they create that file in a shared directory, it still gives the
creating user a special status over that file, that others with write
access to the containing directory do not have.

(Multics also offers a separate “append” permission, that allows the
possessor to create an item in a directory, without having the ability
to remove an item once it’s there.)

One radical idea introduced in Unix was its profligate use of multiple
processes. Every new command you executed (except for the ones built
into the shell) required the creation of a new process, often several
processes. Other OSes tended to look askance at this; it seemed
somehow wasteful, perhaps even sinful to spawn so many processes so
readily and discard them so casually. The more conventional approach
was to create a single process at user login, and execute nearly all
commands within the context of that. There were special commands for
explicitly creating additional processes (e.g. for background command
execution), but such process creation did not simply happen as a
matter of course.

Gradually, over time, the limitations of the single-process approach
became too much to ignore, and the versatility of the Unix approach
won over (nearly) everybody. Multics, however, is of the old school.
More than that, the process even preserves global state, including
static storage, in-between runs of programs, and this applies across
different programs, not just reruns of the same one. For example, in
FORTRAN, there is the concept of a “common block”. If you run two
different programs that both refer to the same common block, then the
second one will see values left in the block by the first one. To
completely reinitialize everything, you need to invoke the “new_proc”
command, which effectively deletes your process and gives you a fresh
one.

One common irritation I find on POSIX/Linux systems is the convention
that every directory has to have an entry called “.”, pointing to
itself, and one called “..”, pointing to its parent. This way these
names can be used in relative pathnames to reach any point in the
directory hierarchy. But surely it is unnecessary to have explicit
entries for these names cluttering up every directory; why not just
build their recognition as a special case into the pathname-parsing
logic in the kernel, once and for all? That way, directory-traversal
routines in user programs don’t have to be specially coded to look
for, and skip these entries, every single time.

Multics doesn’t seem to have this problem. An absolute pathname begins
with “>” (which is the separator for pathname components, equivalent
to POSIX “/”), while a relative pathname doesn’t. Furthermore, a
relative pathname can begin with one or more “<” characters,
indicating the corresponding number of steps up from the current
working directory. Unlike POSIX “..”, you can’t have “<” characters in
the middle of the pathname, which is probably not a big loss.

It is interesting to see other features which are nearly, but not
quite, the same as, corresponding features in Unix. For example, there
is a search path for executables, to save you typing the entire
pathname to run the program. However, this does not seem as flexible
as the $PATH environment-variable convention observed by Unix/POSIX
shells. In particular, it does not seem possible to remove the current
directory from the search path, which we now know can be a security
risk.

Another one is the concept of “active functions” and “active strings”.
These allow you to perform substitutions of dynamically-computed
values into a command line. However, they are not as general as the
Unix/POSIX concept of “command substitution”, where an entire shell
command can supply its output to be interpolated into another command.
Instead of having a completely separate vocabulary of “active
functions” which can only be used for such substitutions, Unix/POSIX
unifies this with the standard set of commands, any of which can be
used in this way.

There are other features of Multics that others more familiar with it
might want to see mentioned (the single-level store concept, where
“everything is a memory segment”, versus Unix “everything is a file”?
I/O redirection based on “switches”—symbolic references to files,
versus Unix integer “file descriptors”?). But then, this long-winded
essay would become even longer-winded :). So if you are interested in
this particular piece of computing history, feel free to follow up the
links above.

In summary, Multics is very much a museum piece, not something you
would want to use today for regular work—not in its original form. But
I think there are still one or two ideas there that we could usefully
copy and adapt to a present-day OS, particularly a versatile one like
Linux.
Grant Taylor
2024-12-18 01:13:42 UTC
Reply
Permalink
But surely it is unnecessary to have explicit entries for these names
cluttering up every directory; why not just build their recognition
as a special case into the pathname-parsing logic in the kernel,
once and for all?
Based on my limited understanding, the "in the kernel" bit is where your
question runs off the rails.

My understanding is that the kernel doesn't know / care where what the
path to the file is. Instead it cares about the file identifier, or
inode. Remember, you can have the same file / inode appear in multiple
directories a la hard links.

The directory path is largely a user space construct only with minimal
kernel support in support of the user space.

As such, I don't think you can special case "." and ".." into the
pathname-parsing logic in the kernel.
That way, directory-traversal routines in user
programs don’t have to be specially coded to look for, and skip
these entries, every single time.
I question why you are wanting to treat "." and ".." special when you
are working with dot files. It seems to me like if you are explicitly
looking for dot files, then you'd want to see "." and "..".
--
Grant. . . .
Lawrence D'Oliveiro
2024-12-18 01:20:09 UTC
Reply
Permalink
Post by Grant Taylor
My understanding is that the kernel doesn't know / care where what the
path to the file is.
Oh, but it does.
Post by Grant Taylor
Instead it cares about the file identifier, or
inode. Remember, you can have the same file / inode appear in multiple
directories a la hard links.
Yes you can. But there is no userland API in POSIX/*nix to let you
identify a file directly by inode. You always have to specify some path
that gets to it. This is by design.
Post by Grant Taylor
As such, I don't think you can special case "." and ".." into the
pathname-parsing logic in the kernel.
You already have to, for “..” at least. Think about what happens when “..”
would take you to a different filesystem.
Post by Grant Taylor
I question why you are wanting to treat "." and ".." special when you
are working with dot files. It seems to me like if you are explicitly
looking for dot files, then you'd want to see "." and "..".
Typically, no.
Niklas Karlsson
2024-12-19 05:22:37 UTC
Reply
Permalink
Post by Lawrence D'Oliveiro
Post by Grant Taylor
Instead it cares about the file identifier, or
inode. Remember, you can have the same file / inode appear in multiple
directories a la hard links.
Yes you can. But there is no userland API in POSIX/*nix to let you
identify a file directly by inode. You always have to specify some path
that gets to it. This is by design.
Hmm. I haven't gone grovelling through the API documentation, but I note
that find(1) on this machine (Ubuntu 18.04.6 LTS) has the -inum option
to find files by inode number. So unless find(1) does some serious
acrobatics for that, I do think there's a userland API to identify a
file by inode.

Niklas
--
All software sucks. Everybody is considered a jerk by somebody. The sun
rises, the sun sets, the Sun crashes, lusers are LARTed, BOFHs get drunk.
It is the way of things. -- ***@summit.bor.ohio.gov (Steve Conley)
Lawrence D'Oliveiro
2024-12-19 07:11:35 UTC
Reply
Permalink
Post by Niklas Karlsson
Hmm. I haven't gone grovelling through the API documentation, but I note
that find(1) on this machine (Ubuntu 18.04.6 LTS) has the -inum option
to find files by inode number. So unless find(1) does some serious
acrobatics for that ...
It calls stat(2) or lstat(2) and checks the st_ino field in the returned
data.

<https://savannah.gnu.org/projects/findutils/>
Niklas Karlsson
2024-12-19 09:41:37 UTC
Reply
Permalink
Post by Lawrence D'Oliveiro
Post by Niklas Karlsson
Hmm. I haven't gone grovelling through the API documentation, but I note
that find(1) on this machine (Ubuntu 18.04.6 LTS) has the -inum option
to find files by inode number. So unless find(1) does some serious
acrobatics for that ...
It calls stat(2) or lstat(2) and checks the st_ino field in the returned
data.
Looks like you're right; the only way to directly manipulate a file by
its inode number is through direct manipulation of the filesystem via
some FS-dependent tool (debugfs in the case of ext*).

Niklas
--
You know what the chain of command is? It's the chain I go get and beat
you with 'til you understand who's in ruttin' command here!
-- Jayne Cobb, _Firefly_
Lawrence D'Oliveiro
2024-12-19 19:48:46 UTC
Reply
Permalink
Post by Niklas Karlsson
Post by Lawrence D'Oliveiro
Post by Niklas Karlsson
Hmm. I haven't gone grovelling through the API documentation, but I
note that find(1) on this machine (Ubuntu 18.04.6 LTS) has the -inum
option to find files by inode number. So unless find(1) does some
serious acrobatics for that ...
It calls stat(2) or lstat(2) and checks the st_ino field in the
returned data.
Looks like you're right; the only way to directly manipulate a file by
its inode number is through direct manipulation of the filesystem via
some FS-dependent tool (debugfs in the case of ext*).
Having said that, Linux does offer “handle” calls
<https://manpages.debian.org/2/open_by_handle_at.2.en.html>, which
very likely include inode info somewhere in that opaque structure.

But note that accessing files in this way can only be done by
suitably-privileged processes. Otherwise it would break the POSIX
security model.
Scott Lurndal
2024-12-19 13:47:14 UTC
Reply
Permalink
Post by Niklas Karlsson
Post by Lawrence D'Oliveiro
Post by Grant Taylor
Instead it cares about the file identifier, or
inode. Remember, you can have the same file / inode appear in multiple
directories a la hard links.
Yes you can. But there is no userland API in POSIX/*nix to let you
identify a file directly by inode. You always have to specify some path
that gets to it. This is by design.
Hmm. I haven't gone grovelling through the API documentation, but I note
that find(1) on this machine (Ubuntu 18.04.6 LTS) has the -inum option
to find files by inode number. So unless find(1) does some serious
acrobatics for that, I do think there's a userland API to identify a
file by inode.
Admins used to use ncheck(8) to map inode numbers to path name(s)
in bell labs versions of Unix.

find(1) uses 'stat(2)' to get the inode number when walking the
filesystem tree, so it's more a brute force method than an API.
Niklas Karlsson
2024-12-19 14:13:01 UTC
Reply
Permalink
Post by Scott Lurndal
Post by Niklas Karlsson
Hmm. I haven't gone grovelling through the API documentation, but I note
that find(1) on this machine (Ubuntu 18.04.6 LTS) has the -inum option
to find files by inode number. So unless find(1) does some serious
acrobatics for that, I do think there's a userland API to identify a
file by inode.
Admins used to use ncheck(8) to map inode numbers to path name(s)
in bell labs versions of Unix.
Oh, hello. That's an interesting fact. I like it when things like this
come up in discussions here. Thank you!

I found https://illumos.org/man/8/ncheck - interesting!

A quick web search suggests that at least some commercial UNIXes still
have it; Illumos is of course a Solaris derivative, and I found a
reference to it existing on AIX as well. On Linux, assuming ext*, you
apparently have to use debugfs to do something similar.

Niklas
--
Post by Scott Lurndal
I've wondered recently why it's not feasible to make large passenger planes
capable of water landing.
Well, they keep having to replace all the seat cushions, for one
thing... -- Mike Sphar and Mark Hughes in asr
Scott Lurndal
2024-12-19 14:47:37 UTC
Reply
Permalink
Post by Niklas Karlsson
Post by Scott Lurndal
Post by Niklas Karlsson
Hmm. I haven't gone grovelling through the API documentation, but I note
that find(1) on this machine (Ubuntu 18.04.6 LTS) has the -inum option
to find files by inode number. So unless find(1) does some serious
acrobatics for that, I do think there's a userland API to identify a
file by inode.
Admins used to use ncheck(8) to map inode numbers to path name(s)
in bell labs versions of Unix.
Oh, hello. That's an interesting fact. I like it when things like this
come up in discussions here. Thank you!
I found https://illumos.org/man/8/ncheck - interesting!
Unix V7 version:

$ PAGER= man /reference/usl/unix/v7/usr/man/man1/ncheck.1m
NCHECK(1M) NCHECK(1M)



NAME
ncheck - generate names from i-numbers

SYNOPSIS
ncheck [ -i numbers ] [ -a ] [ -s ] [ filesystem ]

DESCRIPTION
Ncheck with no argument generates a pathname vs. i-number list of all
files on a set of default file systems. Names of directory files are
followed by `/.'. The -i option reduces the report to only those files
whose i-numbers follow. The -a option allows printing of the names `.'
and `..', which are ordinarily suppressed. suppressed. The -s option
reduces the report to special files and files with set-user-ID mode; it
is intended to discover concealed violations of security policy.

A file system may be specified.

The report is in no useful order, and probably should be sorted.

SEE ALSO
dcheck(1), icheck(1), sort(1)

DIAGNOSTICS
When the filesystem structure is improper, `??' denotes the `parent' of
a parentless file and a pathname beginning with `...' denotes a loop.
Dan Cross
2024-12-19 15:04:59 UTC
Reply
Permalink
Post by Niklas Karlsson
Post by Scott Lurndal
Post by Niklas Karlsson
Hmm. I haven't gone grovelling through the API documentation, but I note
that find(1) on this machine (Ubuntu 18.04.6 LTS) has the -inum option
to find files by inode number. So unless find(1) does some serious
acrobatics for that, I do think there's a userland API to identify a
file by inode.
Admins used to use ncheck(8) to map inode numbers to path name(s)
in bell labs versions of Unix.
Oh, hello. That's an interesting fact. I like it when things like this
come up in discussions here. Thank you!
I found https://illumos.org/man/8/ncheck - interesting!
A quick web search suggests that at least some commercial UNIXes still
have it; Illumos is of course a Solaris derivative, and I found a
reference to it existing on AIX as well. On Linux, assuming ext*, you
apparently have to use debugfs to do something similar.
Various systems have had extensions to address files by inum
over time. From memory, systems that supported AFS used to add
an `openi` system call that allowed a user to open a file by
inode number (one presumes it also took some kind of reference
to the filesystem that the inode was relative to, since the name
space of inodes is per-fs, and not globally unique).

Hmm. Maybe that was Coda, and not AFS.

- Dan C.
OrangeFish
2024-12-19 21:56:50 UTC
Reply
Permalink
Post by Niklas Karlsson
Post by Scott Lurndal
Post by Niklas Karlsson
Hmm. I haven't gone grovelling through the API documentation, but I note
that find(1) on this machine (Ubuntu 18.04.6 LTS) has the -inum option
to find files by inode number. So unless find(1) does some serious
acrobatics for that, I do think there's a userland API to identify a
file by inode.
Admins used to use ncheck(8) to map inode numbers to path name(s)
in bell labs versions of Unix.
Oh, hello. That's an interesting fact. I like it when things like this
come up in discussions here. Thank you!
I found https://illumos.org/man/8/ncheck - interesting!
A quick web search suggests that at least some commercial UNIXes still
have it; Illumos is of course a Solaris derivative, and I found a
reference to it existing on AIX as well. On Linux, assuming ext*, you
apparently have to use debugfs to do something similar.
Niklas
Solaris 11 still has it in /usr/sbin:

System Administration Commands ncheck(1M)

NAME
ncheck - generate a list of path names versus i-numbers

SYNOPSIS
ncheck [-F FSType] [-V] [generic_options]
[-o FSType-specific_options] [special]...

DESCRIPTION
ncheck with no options generates a path-name versus
i-number list of all files on special. If special is not
specified on the command line the list is generated for
all specials in /etc/vfstab which have a numeric
fsckpass. special is the raw device on which the file
system exists.

OPTIONS
-F Specify the FSType on which to operate. The FSType
should either be specified here or be determinable
from /etc/vfstab by finding an entry in the table
that has a numeric fsckpass field and an fsckdev
that matches special.

-V Echo the complete command line, but do not execute
the command. The command line is generated by using
the options and arguments provided by the user and
adding to them information derived from
/etc/vfstab. This option may be used to verify and
validate the command line.

[and so on]

OF

Bob Eager
2024-12-19 15:03:55 UTC
Reply
Permalink
Post by Scott Lurndal
Admins used to use ncheck(8) to map inode numbers to path name(s)
in bell labs versions of Unix.
find(1) uses 'stat(2)' to get the inode number when walking the
filesystem tree, so it's more a brute force method than an API.
Yes, I remember that on Sixth Edition.

Not to mention icheck.
--
Using UNIX since v6 (1975)...

Use the BIG mirror service in the UK:
http://www.mirrorservice.org
Waldek Hebisch
2024-12-18 13:04:28 UTC
Reply
Permalink
Post by Lawrence D'Oliveiro
Of course, it took far too long (7 years) to reach production quality.
In that time, a small group of researchers at AT&T Bell Labs grew
tired of waiting, and decided to create their own, less ambitious
system, which they called “UNIX” as a tongue-in-cheek homage t
What I read is a bit different: AT&T management got tired and
decided to quit the project. Researchers at Bell Labs liked
Multics features, did not want to loose them, so decided to
do their own simpler variant.
--
Waldek Hebisch
Rich Alderson
2024-12-18 23:26:21 UTC
Reply
Permalink
Post by Waldek Hebisch
Post by Lawrence D'Oliveiro
Of course, it took far too long (7 years) to reach production quality.
In that time, a small group of researchers at AT&T Bell Labs grew
tired of waiting, and decided to create their own, less ambitious
system, which they called "UNIX" as a tongue-in-cheek homage t
What I read is a bit different: AT&T management got tired and
decided to quit the project. Researchers at Bell Labs liked
Multics features, did not want to loose them, so decided to
do their own simpler variant.
That is the usual story; the poster to whom you responded often gets this kind
of thing wrong...
--
Rich Alderson ***@alderson.users.panix.com
Audendum est, et veritas investiganda; quam etiamsi non assequamur,
omnino tamen proprius, quam nunc sumus, ad eam perveniemus.
--Galen
Dan Cross
2024-12-19 12:28:11 UTC
Reply
Permalink
Post by Rich Alderson
Post by Waldek Hebisch
Post by Lawrence D'Oliveiro
Of course, it took far too long (7 years) to reach production quality.
In that time, a small group of researchers at AT&T Bell Labs grew
tired of waiting, and decided to create their own, less ambitious
system, which they called "UNIX" as a tongue-in-cheek homage t
What I read is a bit different: AT&T management got tired and
decided to quit the project. Researchers at Bell Labs liked
Multics features, did not want to loose them, so decided to
do their own simpler variant.
That is the usual story; the poster to whom you responded often gets this kind
of thing wrong...
Indeed. It's honestly best not to engage with him; he's
a known troll.

- Dan C.
Loading...