Myth Machines

What are they?

In the basement of the Gates building at Stanford, within room B08, there's about 16 computers (named myth51 to myth66) that we call the "Myth machines". You might also hear them referred to as the "Myth clusters" or the "Myth servers". They look like this (only 8 shown here):

8 of the Myth machines

^Courtesy of Lisa Yan.

Why are they called "Myth clusters" or "Myth servers"? Because it's a bunch of computers clustered together to serve your computing needs. (But yes, cluster and server are real technical terms too.)

There are more clusters at Stanford than just the myth clusters. At your time at Stanford, you might run across farm, rice, sherlock, or others.

In computer , a server is a computer whose job is to sit nicely and respond to requests coming from other computers. For example, a web server is a computer whose job is to send back webpages to browsers asking for them. In this case, the Myth machines run "SSH servers" - they accept SSH requests from your computer so that you can remotely run code on them.

Since servers respond to other computers' requests, they don't tend to be used on their own. For that reason, we usually don't waste money outfitting them with a monitor, keyboard, mouse, etc. That's why they look so bare in the photo above!

In CS 107, you won't run a single line of your code on your own laptop. Instead, you'll be using SSH to run all of your programs remotely on these Myth machines.

Do we have to? Yes. It's important to know how to use ssh and to use computers remotely through a terminal. Real programmers do this all the time, and especially so during the pandemic.

Having everyone use the Myth machines also provides a consistent environment for everyone to program in. It makes tech support so much easier. Remember all those Ed questions about Qt Creator in CS 106B?

SSH?

You shouldn't worry about the details in CS 107, but SSH is a program/protocol to allow us to type stuff on our own computers, let the results take place on a remote computer, and show us the results in real time. This requires an Internet connection since all of this communication between your computer and Myth is sent securely over the Internet.

Make sure you follow the CS 107 Getting Started guide (it's part of assign0!) to get SSH set up on your computer.

SSH is a two-way protocol - whenever you type on the keyboard, it gets sent to the Myth machines, and whenever the program being run prints anything, it gets sent back to your computer to display.

For example, here's what happens when you type ls while ssh'ed into a Myth machine.

1) Each individual keystroke (l, s, <ENTER>) is processed and sent to the Myth machine. As each keystroke is received, it's printed out to the display, and that's sent right back to you so you can see what you're typing. (If you have laggy Internet, sometimes what you're typing doesn't show up until a second or two later - now you know why!)

2) When you press <ENTER>, the keystroke is as usual processed and sent to Myth. The shell program (that's the program running when you see a prompt that allows you to type commands) reads this as a newline character, which it interprets as you telling it to run the command you entered. Thus the ls program gets invoked.

3) The ls program runs and prints a list of files and directories to the display. This gets sent back to you to see.

4) The ls program ends and control goes back to the shell so you can type in another command.

Terminal, shell, ssh, which one am I running again?

Yeah, it's confusing, although the distinction isn't really important until CS 111, so don't worry too much.

But for the record: on your computer you're running a terminal program. (Probably Terminal.app on macOS, Windows Terminal on Windows, lots of choices but maybe urxvt on Linux.) The terminal program spawns a shell program (either bash or zsh, probably) that gives you a prompt to type into. Within the shell program, you run the ssh program. The ssh program connects to a ssh-server program running on a Myth machine. Upon connection, it spawns a separate shell program (bash) which runs on the Myth machine. Your programs get run within there.

So yeah, this involves at least six programs running in tandem - the terminal on your computer, the shell within that, the ssh program running inside that, the ssh-server it connects to, the remote shell it spawns, and the actual program you're running. Don't worry about it.

By the way, this setup allows multiple people to use the same Myth machine at once - there's no conflict and each session is independent. It also means you can open multiple terminals and connect to Myth on each one at once.

What kind of software is on the Myth machines?

The Myth machines run a flavor of the Linux operating system. So yes, technically all the programs you write will be "Linux programs"! (But most C programs we write can be compiled to run on any computer system.)

You may hear the Myth machines being referred to as "UNIX-like". UNIX was the first popular operating system. It was created in the 1970s and due to its generous licensing became widespread both in universities and commercially. Linux and macOS were both heavily influenced by UNIX and hence we call them "UNIX-like". You'll find that much of what you learn about using the terminal will apply to your Linux or macOS computer (if you have one) with little modification.

Windows is not UNIX-like. If you open a terminal (called "Command Prompt") on Windows, you'll find that you can't even run ls because it doesn't exist. (Instead, you use a program called dir.) The underlying design of the operating system is also quite different and when you write super low-level programs, you'll have to interface with the OS differently compared to Linux and macOS.

The Myth machines use what's called the Andrew File System. It's sadly not named after me. The only important thing to know is that it's magic that makes your files on the Myth machines accessible from any Myth machine. So it doesn't matter which of the 16 Myth machines you end up connecting to!

Since we're accessing these machines remotely, the only way to interact with them is through the command line (i.e. typing into the prompt in the terminal). While there's lots of pre-installed software you can run (try running firefox if you don't believe me), many don't work without a screen. So you'll be learning how to use "command-line" variants of common programs.