# CS 180 - Introduction to Operating Systems

"You get the operating system you deserve" -- Mead
 Reminder: These notes will be taken down permanently on Friday, April 28, 2017. If you want to save a copy for yourself, please download them before that time.

Information

If you have any questions about any assignment, lecture, quiz, etc., please post the questions in the CS180 Forum on the CS180 Moodle website. There are many people that can answer your question. If you just send your question to me in an email, it may be a while until (or if) I get back to you. If you have a question about an assignment, it's very likely that other students have the same question and they will benefit from the posted answers. Also, you can use the Academic Support Center for help.

 Syllabus Office hours Important dates for this school year. Academic Support Center Schedule Digipen's online library - This is where you can access Safari Books Online, which contains 1,000s of technical books covering many topics. Some required reading will be available here.

References

 The Linux Programming Interface: A Linux and UNIX System Programming Handbook. It is one of the highest-rated Linux books listed on Amazon. Highly recommended for anyone wanting to understand more about Linux systems programming. Sample chapters: Chapter 4 - File I/O Chapter 24 - Process Creation Chapter 52 - POSIX Message Queues Table of Contents for the book.

 Operating Systems: Three Easy Pieces: Welcome to Operating Systems: Three Easy Pieces, a free online operating systems book! The book is centered around three conceptual pieces that are fundamental to operating systems: virtualization, concurrency, and persistence. In understanding the conceptual, you will also learn the practical, including how an operating system does things like schedule the CPU, manage memory, and store files persistently. Lots of fun stuff!

Wine (To run Windows apps directly on Linux)
• WINE HQ WINE Headquarters. The place to find out more about the non-emulator emulator.
• WINE App Database This site lists over 20,000 applications and what their WINE compatibility is.
Miscellaneous

• mem.leaks.cpp Sample program to test out Valgrind. You may also be interested in kcachegrind as well. (A graphical profiler for Linux.)
• Dr. Memory A cross-platform (Linux/Mac/Windows) memory debugger much like Valgrind. It was developed at Google. It may only work on 32-bit programs. You'll need to install the 32-bit libraries on your 64-bit Linux system for C and C++:
`sudo apt-get install gcc-multilib g++-multilib`

• Doxygen - is a free, cross-platform, automated documentation generator. You should install version 1.8.6, which is what is installed at Digipen. You can find this version in the 1.8.6 downloads section. You will also need to create a PDF file from the Doxygen-generate files. This will require a few other programs to be installed, which is trivial to do under Linux. You should install these:
`sudo apt-get install texlive-latex-base texlive-latex-extra texlive-fonts-recommended pdflatex evince`
If any other dependencies are required, simply install those as well. If you want the full $\textbf {\LaTeX{}}$ experience, install the full version:
`sudo apt-get install texlive-full`
Realize that this could install over 3 GBs of files. There's also a nice editor/IDE for creating documents called Texmaker that works on Linux, Windows, and Mac. I use that to create all of the quizzes and exams.

• Various IDEs for Linux (also on Mac OS X and Windows): KDevelop, NetBeans, QtCreator, Code::Blocks, CodeLite, Eclipse, and CLion

• odroid computer from HardKernel.
• ODROID-XU4 This one has 8 cores! Check out how it migrates tasks between the cores.
• Raspberry Pi Another small, cheap device that runs Linux. A very popular device. I recommend this book Raspberry Pi User Guide to get started. Updated to cover the B+ version. Written by the founder of the Raspberry Pi Foundation.
• VoCore A Linux computer (1 square inch). It runs BusyBox, which is a really small version of Linux for embedded systems.
• CuBox-i4Pro A pretty powerful little computer.

Notes

Homework Assignments

• Problems from the website and other sources:

Overview of the major Linux distributions - We will be spending some time studying Linux, and this will give you a good idea of why I chose the distributions I did. There are over 100 different "versions" of Linux, and this gives you some insight into why Linux has so many choices (and why it is used more than any other operating system). Be prepared to answer the question, "Besides Mint, which of these distributions do you think you would use and why?"

Check out this short video to see just how popular Linux is. It's a couple of years old, so the numbers will be much higher than are stated. If you're new to Linux and interested in customizing the Cinnamon interface, here is an introductory video to do that. The guy that did the video has lots of other related videos that you might find useful to watch. You can also search for "Linux Mint" on youtube for lots of others.

Read sections 1.1 through 1.8 in the PDF that comes with Virtual Box. This is for version 5.0.0. Digipen may be using a different version, but the documentation should be almost identical. You can also read the latest documentation online.

To get a decent overview of what Linux is compared to Windows, read the Ultimate Linux Guide for Windows Users. This should help you get started with the whole "Linux" thing.

Friday, January 13, 2017
Install Linux Mint, either natively or via a virtual machine. The version for this class is 18 "Sarah" - Cinnamon (64-bit) . (You can use a later version of the series, 18.1 "Serena", if you want.) You can add the other desktops (MATE, KDE, etc.) afterwards. Version 18 comes with the correct compiler version (Clang 3.8) that we are going to be using for all programming assignments. It is possible to run Linux Mint 17.x and then install newer versions of the clang compiler, but this is more work. If you are adventurous, you can read about doing that here. Since most students probably don't have Linux installed anywhere, getting the later version is probably fine. However, if you happen to be running a stable 17.x Mint, you can just update the compiler. (That's what I'm doing.)

Read Linux Mint User's Manual - You can skip the installation instructions if you want as I've already demonstrated and given you a written tutorial on installation. Start reading at page 21, and then read about packages starting on page 35. This will give you lots of information to get you up to speed quickly.

Read chapters 1 through 5 in The Linux Command Line. You should read this while sitting at the computer and running Linux. Also, you should realize that, although the command line in Linux may look a lot like the command line in Windows, the Linux command line (the Bash shell) is infinitely more powerful than the one in Windows. You will do well for yoursef to explore at least the basics of it. Those of you that have been using Linux or Mac OS X from the command line may only need to skim this information.

Monday, January 16, 2017
Take a few of your programming assignments from CS120 (e.g. spellcheck, you'll need the Linux dictionary), build and execute them in Linux. They should all compile and run the same as they did on Windows. Note: To execute a program under Linux, you must prefix the command with ./ (that's a dot and forward slash, which indicates the current directory). Tuesday, January 17, 2017
Experiment with mem.leaks.cpp with valgrind. Yeah, it's a C++ file, but it will demonstrate a lot of bugs. (Originally developed by Prof. Volper). Monday, January 30, 2017
Here are some questions to help you Practice with Filters. Friday, February 17, 2017
Read the chmod tutorial up to and including "Try chmod". Monday, February 20, 2017
Run all of the examples that are posted on the Processes page and see what kind of results you get. Practice with the exec functions so that you know how to use them. (You will be asked to use them.) Monday, March 13, 2017
Make sure you've run all of the sample code on the Threads page and see what kind of results you get. Wednesday, March 22, 2017
Study the sample code from the Memory page regarding Dynamic Loading. You'll be implementing this for homework. Wednesday, March 29, 2017

• ## Practice Labs

• Data for the practice labs