DistOS 2023W 2023-02-08

From Soma-notes
Jump to navigation Jump to search

Notes

Plan 9 & Inferno
----------------

Remember that UNIX was created before the Internet, and was used to develop the Internet

Plan 9 is the work of the original UNIX creators to try and make UNIX work on multiple computers that are connected via a network

Discussion questions:
 - how is the design philosophy of UNIX reflected in Plan9?  Has that vision changed?
 - what mechanisms did they create?  Compare pipes and P9P for example

Inferno was a response to Java
 - portable runtime that could run everywhere
 - but again, more like UNIX
 - but what does that mean? (discuss)

What was Java?
 - machine independent (minimal need to "port")
 - object oriented
 - networked
 - taking security seriously

Remember Java is much more than the language itself
 - Java bytecodes, JVM
 - stack introspection for permissions (entire permission model)
 - Java applets (before Javascript-based web apps was a thing, before Flash!)

Remember JavaScript was named because Java was hot.  The two have nothing really in common.

Discuss: Why didn't Plan9 and Inferno take over the world like UNIX?

We'll start class again at 12:20

-----

To discuss
 - WORM
 - 9P
 - TTY vs 8.5
 - Inferno vs Java
 - C-like languages
 - minimalism

Plan9 had no standard terminals, they just had windows.  Why?
 - because tty was an old abstraction that was for old hardware
 - why keep it around if we can do better?

Minimalism
 - driving force behind the original UNIX but not UNIX-like systems today

What is minimalism in system design?
 - few mechanisms, few abstractions
 - those few abstractions can be used to solve the problems you have
   by mixing and matching them
 - lots of opportunities for code reuse

What is this in contrast to?  Maximalism
 - separate abstractions for every problem
 - so each is perfectly suited for the particular problem it solves
 - but collectively, no pattern/unification
   - so you have to learn each abstraction on its own
   - lots of duplication of things that look similar but are different
   - work on one problem can't be leveraged directly, will have to be
     ported to different problems


In UNIX, the key abstraction is the file
 - if you make things that aren't files look like files, you can use any problem on them that is designed for files
 - this is the idea behind special files, device files

Notice inheritance can be used towards the goal of minimalism, but that rarely happens in practice
 - too easy to just make a new interface

What do you need to get a maximalist design?
 - nothing really, just let individuals do their own thing and smash it all together
 - note that later changes will be hard because everything is designed to work together in just a certain way

What do you need to get a minimalistic design?

If you design a system so that A and B talk, and separately X and Y talk, then when you later want A and Y to talk you'll have to either redesign everything or add an adaptor between A and Y.
 - if you had used a common set of abstractions, A and Y could have been talking already

It is a language problem
 - maximalist design: many little languages between components
 - minimalistic design: one unifying language

What is the downside of minimalistic design?
 - sometimes you get square pegs trying to go into round holes
 - basically, weird corner cases that don't fit the original abstrations
    - so you'll need to add in hacks, etc, to make things work

Consider a printer
 - represent it as a file, then data to print and its status are simple to map
   to read and write
 - but how do you change the printer's settings, like paper size, paper type, duplexing?
   - could do it in-band, but then you can't write to it like a file,
     you have to use a protocol
   - could do it out of band, but then need a new interface
     (ioctl)

What does plan9 do instead of ioctls?
 - don't represent it as a file, represent it as many files, perhaps a directory!

Note that Plan9 gave us /proc & /sys, clone, utf8
 - basically Linux adopted as much of Plan9 as they could

Linux also supports per-process filesystem and other namespaces (in plan9 it was easier since everything was a file), this is part of how we do containers

Why don't we get minimialism in practice?  Why can it only really succeed when things are new?
 - backwards compatibility

Remember minimalism can only stay minimalistic if the core abstractions can change (because you never get that perfectly right).  But once others depend on those abstractions, changing them breaks backwards compatibility.
 - so you start minimalistic, then once everyone depends on that design
   you'll get maximalistic solutions to new problems

When studying for the midterm, compare/contrast papers, look for patterns
 - don't memorize details