Web Resources for CS7600 (Intensive Computer Systems)

Instructor: Gene Cooperman
Fall, 2017

CS 7600 (Fall, 2017): Intensive Computer Systems

The core philosophy of the course is to avoid reading or writing massive amounts of code. Instead, the emphasis will be on a high ratio of new concepts and learning per lines of codes written.
It's about concepts, not code!
===============================
Fun stuff: Before doing too deep a dive, you might want to take a look at some fun stuff. This includes some of the news on the web and enrichment topics that we will discuss from time to time.

===============================

Course basics: Here are some immediate resources in the course for doing homework, following the readings, etc.

  1. The homework subdirectory of the course directory contains all course homework, and the course directory contains all handouts, and the syllabus. The syllabus contains the required readings in the textbook. The course directory is also available from our Linux machines as /course/cs7600/.
  2. The course directory includes a help directory. There are two older reviews of UNIX there. But please consider this excellent modern introduction to UNIX by M. Stonebank.
  3. Please also note the directory for UNIX (Linux) editors. You will need to login to a Linux machine to use these. They are in /course/cs7600/unix-editors. For example, to learn vi (estimated time: one hour), login to Linux and do:
        vi /course/cs7600/editors-unix/vitutor.vi
    and follow the on-screen instructions.
  4. Some help files for Linux and its compilers, editors, etc. are also available. As you use Linux, please look into using gdb (GNU debugger), which will help you greatly in debugging. This will help when you test your homeworks on our Linux machines.
  5. Other course directories of interest are: Python, UNIX xv6, and TLA+,
  6. There is also a good, free on-line C book by Mike Banahan, Declan Brady and Mark Doran.
  7. All of the homework can be done on CCIS Linux machines, and most of it (all except GUIs) can be done by remotely logging in via 'ssh' and using the command-line interface. You may also work on your personal laptop, but you are responsible for verifying that your solution also works on CCIS Linux, since that is where it will be graded.
  8. For those who wish to use their laptop for assignments, there are several strategies. On the Mac OS, there is a terminal window that is mostly compatible with Linux. It includes the commands 'ssh' and 'scp'. For Windows, the analagous capability is now encompassed by "Bash on Ubuntu for Windows". Here are some instructions for configuring your Windows laptop to use it. This would be my personal recommendation if you're not ready yet to manage a full Linux distro.
         Another common alternative is to run Cygwin (all the GNU and other capabilities, including gcc, vi, etc.). Alternatively, you can install your favorite Linux distro either: (i) in a virtual machine inside Windows; or (ii) by installing in a large Windows file and running Linux within Windows; or (iii)~in a dual-boot configuration (boot either to Windows or Linux). similar VM and dual-boot options exist for the Mac.
  9. Finally, as you progress in the course, please come back and frequently review my list of "Debugging and Other Systems Tricks". As you move into working with systems in depth, you will want to learn more of the countless systems tricks that are typically learned only by the random interaction of "hackers" working alongside other "hackers". I have tried to bring these pearls together in a single web page, to make it easily accessible as part of a gentle introduction to computer systems.

===============================
Course Resources

MIPS Simulator for Assembly Language homework (MARS):

  1. There is a MIPS Assembly language simulator with free downloads and the online documentation of the MARS simulator. The simulator is built on the SPIM assembler for MIPS, and there is generous, high-quality documentation of the MIPS assembly language with the free, online SPIM documentation for the MIPS assembler, and the SPIM Quick Reference (or an even shorter quick reference here)
  2. The MARS software is distributed as a Java .jar file. It requires Java J2SE 1.5 or later. Depending on your configuration, you may be able to directly open it from the download menu. Java J2SE 1.5 or later. Depending on your configuration, you may be able to directly open it from the download menu.

    If you have trouble, or if you prefer to run from the command line on your own computer, the Java SDK is is also available for free download from the same download page. The instructions for running it from Windows or DOS should work equally well on Linux. The CCIS machines should already have the necessary Java SDK installed.

  3. GOTCHAS: There are several important things to watch out for.
    1. When you hit the "Assemble" menu item, any error messages about failure to assemble are in the bottom window pane, tab: "Mars Messages". Input/Output is in the bottom window pane, tab: "Run I/O"
    2. If you paste assembly code into the edit window pane, you must save that code to a file before Mars will let you assemble it.
    3. If you have selected a box with your mouse (e.g. "Value" box in the data window pane, or "Register" box), then Mars will not update the value in that box. Mars assumes you prefer to write your own value into that box, and not to allow the assembly program to use that box.
    4. If your program stops at an error, read the "Mars Messages" for the cause of the error, and then hit the "Backstep" menu item to see what caused that error. Continue hitting "Backstep" or "Singlestep" in order to identify the error.
    5. Your main routine must call the "exit" system call to terminate. It may not simply call return ("jr $ra"). Note that page B-44 of Appendix B of the text (fourth edition) has a table of "system services" (system calls). These allow you to do "exit" and also I/O.
  4. One of the nicer features of this software is a limited backstep capability (opposite of single-step) for debugging. In addition, the help menu includes a short summary of the MIPS assembly instructions. In general, I like this IDE for assembly even better than some of the IDEs that I have seen for C/C++/Java. (The one feature that I found a little unintuitive is that if you want to look at the stack (for example) instead of data, you must go to the Data Segment window pane, and use the drop-down menu at the bottom of that pane to choose "current $sp" instead of ".data".)
  5. Please note the three sample assembly programs, along with an accompanying tutorial on the same web page.
  6. I'd appreciate if if you could be on the lookout for any unusual issues, and report them promptly (along with possible workarounds), so the rest of the class can benefit. Thanks very much for your help on this.

===============================
The GNU debugger

GDB (GNU DeBugger):
  A Few Simple Debugging Commands Save You Hours of Work

	INVOKING gdb:
	  gdb --args  <COMMAND_LINE>
	  Example:  gdb --args ./a.out arg1 arg2
	 
	COMMON gdb COMMANDS:
	  break, continue
	  run
	  next, step, finish  (next line, step inside fnc, finish current fnc)
	  where, frame, list (e.g.: where; frame 0; list)
	  info threads, thread (e.g.: thread 2)
	  ptype, print  (   ptype argv[0]; print argv[0]   )
	  quit
	  < Cursor keys work, TAB provides auto-complete >
          set follow-fork-mode child  (needed for debugging child process in shell)
	  IF PROGRAM IS IN INFINITE LOOP, TYPE ^C (ctrl-C) TO TALK TO gdb.
	  help    e.g.: (gdb) help continue
  NOTE: For those who like a full-screen display of the current code, try the command ^Xa (ctrl-X a) to turn full-screen mode on and off. Also, try: (gdb) layout split

  NOTE: For a _really cool_ GDB intrface, look at: https://github.com/cyrus-and/gdb-dashboard. To try it out, just go to the .gdbinit file from that web site, and then copy the code into a local file, gdbinit-dashboard, and then execute source gdbinit-dashboard in GDB. Personally, I like to use Dashboard by displaying the whole dashboard in another terminal.

===============================
Python

There are some good introductory materials for Python in the instructor's directory. After trying those out, here are some other Python background materials:

Python

===============================
Virtual memory

The following note by Rob Landley is a truly excellent summary of the most important points of virtual memory as it's really used (not just the textbook theoretical synopsis):

Motivation for multi-core CPUs (and hence, multi-threading)

Memory Consistency Models

When we use lock-free algorithms, we would often like to assume a strong memory consistency model, such as sequential consistency. Many CPUs offer only a relaxed consistency model. This can affect the design of your lock-free algorithm.

===============================
Current Events

(Many of these articles are from digitimes.com.
For context, note the Wikipedia Silicon article implying that 10 nm is approximately from 48 to 90 silicon atoms laid end-to-end. 3 nm is approximately from 14 to 27 silicon atoms laid end-to-end.)

===============================

What are the largest supercomputers today?

Deep Learning (a motivator for high-end HPC):

Intel Announces Knights Mill: A Xeon Phi For Deep Learning (see also Coral supercomputers, below)

Deep Learning on NVIDIA GPUs

DeepMind Beats Human Champion at Game of Go (in 2015)

"[The deep learning algorithm of] AlphaGo doesn't actually use that much hardware in play, but we needed a lot of hardware to train it and do all the different versions and have them play each other in tournaments on the cloud. That takes quite a lot of hardware to do efficiently, so we couldn't have done it in this time frame without those resources."

What are some popular programming languages today?

Relative Popularity of Different Languages

Benchmark Games (Which is faster, C, Java, or Python?):
(Benchmarks are notoriously variable. Be careful about how you interpret this.)

Three Newer Languages (with lessons from Scheme/Java/C/C++)

A Brief Glimpse at Some Other Assembly Languages

===============================