OPERATING SYSTEMS 31261
COURSE HOME PAGE
ORT BRAUDE COLLEGE OF ENGINEERING
Electronic and Electrical Engineering Department
Site owner: Samy Zafrany
LECTURE NOTESCourse lecture notes are based on the book slides, but contain some modifications and adaptations to our special course program. The course slides are prepared during this semester and are subject to more changes and modifications, so it is not advised to print them at this early stage.
- Course Slides Part 01 [PDF]
- Course Slides Part 02 [PDF]
- Course Slides Part 03 [PDF]
- Course Slides Part 04 [PDF]
- Course Slides on Parallel Programming part 1 [PDF]
Hebrew Operating Systems booklet (by: Samy Zafrany)
This is a comprehensive and concise introduction to the elements of operating systems and the Unix Operating system in the HEBREW language. It is based on the Silberschatz and Galvin book (Operating System Concepts), and complies with the course program. It is highly recommended to read it with the course notes in class. It also presents the Hebrew terms of this subject as will be used in midterm and final exams. At the two last chapters you will find a solution to 28 useful problems which we may attempt later (mostly in Python, but we may also use BASH and Unix command line shells). Some of these problems are taken from old exams or homework assignments in similar courses and similar problems may be used in our course too.
- Before starting each project please read the following Python Coding Style Guides and please make sure to stick to these rules in every line of code that you turn in!
- Every project contains a detailed and precise list of directives on how to do it and how to check it in. Please make sure to read all these direction carefully and act accordingly.
- Make sure you follow exactly the required names to functions, classes, and methods! Any deviation from the suggested name (even with upper or lower case letter difference) can result in your work not being graded, since in many cases your code will be graded by an automatic checker that imports your code and tests it. It is therefore very important that you follow each and every direction in the project text.
For this course it is mandatory to understand and follow the following two Style Guide:
- Google Python Style Guide
- The PEP8 style guide as used in the James Madison University Python Coding Conventions (by Nathan Sprague)
- Important Note: viewing Python files (*.py) is best done with Google Chrome browser! In other browsers they might not be recognized as normal text files and thus cannot be viewed (you'll need to download them to disk and then open them with a text editor)
Project 1: Python ProgrammingYou will be redirected to the Python web site.
Goto Python Course home page for materials on the Python programming language.
Project 2: Python ProgrammingYou will be redirected to the Python web site. The project is NOT to be submitted. It is for you to gain experience and expertise with the Python programming language, so please try first to solve it (use the hints), before reading the solutions below.
Goto Python Course home page for materials on the Python programming language.
Project 3: File System
SolutionsIt is the student responsibility to do anything he can to solve these problems before reading the solutions. Just by reading and understanding the solutions is not enough for gaining programming expertise!
- Solution to Exercise 1
- Solution to Exercise 2
- Solution to Exercise 3
- Solution to Exercise 4 (Python)
- Solution to Exercise 4 (Windows C)
Solution to Exercise 5
It may not work for you due to problems discussed above! However, this should work in Linux (when you do project #4).
Here is another mehtod to make a Python script executable in Windows cmd.exe
Project 4: Linux Operating System Starter
Unix: Some say the learning curve is steep, but you only have to climb it once.
-- Karl Lehenbauer
Project 5: Linux System Programming
Final Course Project: Windows Process Monitor
- Midterm Examination, Spring 2013
- Solution of Midterm Examination, Spring 2013
- Final Examination 1, Spring 2013
- Solution of Final Examination 1, Spring 2013
- Final Examination 2, Spring 2013
- Solution of Final Examination 2, Spring 2013
- Final Examination 1, Winter 2014
- Solution of Final Examination 1, Winter 2014
- Final Examination 2, Winter 2014
- Solution of Final Examination 2, Winter 2014
- Final Examination 1, Summer 2014
- Solution of Final Examination 1, Summer 2014
- Materials for final exam, Semester Beit 2014
Python Quick Reference Guides
Thiese can also be used for final exam
- Unix Tutorial 1 (www.Tutorialspoint.com)
- Unix Tutorial 2
Unix Tutorial 3 (Idaho State University)
- Unix Tutorial 4 (Surrey University, UK)
- Bash Guide for Beginners
- Advanced Bash-Scripting Guide
- Steve's Bourne / Bash shell scripting tutorial
- BASH Reference Manual
- The Little Book of Semaphores, Allen B. Downey
Operating System Course Notes by Dr. John T. Bell,
Department of Computer Science, University of Illinois, Chicago
- The Art of Unix Programming by: Eric Steven Raymond
- The ever useful and neat subprocess module
- Computer Science 162 - Lecture 1: Operating Systems and System Programming
- Principles of Operating System - Barbara Hecker
- The Little Book of Semaphores Lecture by Allen B. Downey - Book and Video
- Unix System Calls
- Introduction to Multiprocessing in Python - Python Conference 2009
- Linux CBT Nuggets
- MIT 6.01SC Introduction to Electrical Engineering and Computer Science
- 6 Lessons From Dropbox - One Million Files Saved Every 15 Minutes
- How Dropbox Did It and How Python Helped at PyCon 2011
PROGRAMMING LANGUAGESIn todays market a programmer is expected to master and use five or six languages simultaneously! Almost all work environments are operating on multiple programming languages paradigms. We will be using a mix of programming languages: C/C++, Python, and a little BASH
C/C++ Programming Languages: Daniel Geva Web Site
This is the official 31616 course web site of the C/C++ programming languages (owned by Daniel Geva). We will be writing a few operating system programs in C, so if you haven't written C code lately, please visit this course and refresh your C skills soon.
Python Programming Language, sofware installation
Every modern operating system contains a shell programming layer which is essential for writing system programs and system administration. In recent years, the general purpose Python programming language, has also proved to be an excellent choice for Unix and Windows system programming. We will therefore use Python for many of our system programming projects. Please install the needed Python software from this Python software link. This link also contains tutorials, books, and other links to useful and interesting materials. In the first two weeks of the course we will have a quick review of the Python language and solve two or three problem sets in Python.
BASH - Bourne Again Shell
This is the traditional standard Linux Scripting language for performing system tasks. Although we encourgae the usage of Python for system programming, many big and small companies are still maintaining huge BASH code bases, and most likely students that go to work for these companies will sooner or later will have to deal with this kind of scripting languages. We will try to cover a basic introduction to this language and may write a couple of simple scripts in this language.
LINUX OPERATING SYSTEMFollowing is a list of options to access and work on a Linux operating system. Please read and choose one (or more) of the methods that fit you best.
Working with the college Linux server: brdlinux.braude.ac.ilThe simplest method for practicing and doing your Unix homework projects is to use the Braude College Linux server: brdlinux.braude.ac.il.
- Every student has a Unix account in this server with login name 'uxxxxx', which is the letter 'u' + the last 5 letters of ID number.
- The initial password will be sent to the student email address
- After your first login, you may change your initial password with the Unix 'passwd' command.
- If you do not have a Linux account or having problems with your account, send email to: email@example.com with subject: Linux acount, and send me your full name (English) and ID number. I will try to fix the problem as soon as possible.
Connection to your Linux account from any Windows computer is done with the
- Please download this small executable and drop it on your Desktop (you can also carry it in your flash drive).
- On a college lab computer, the recommended place is "D:/workspace/putty.exe". This way it will not be deleted.
- It is also recommended to create a shortcut to putty.exe on your Windows desktop or taskbar.
- We will learn in class how to use it to connect to your Linux account, but there are many tutorials on the net that explain this process very cleary.
- Please consult the following putty tutorial to learn how to use it: http://analog24.net/pcosci/misc/puttytutorial.pdf
- In the first time, putty.exe will ask you a question about "Host Key". Just answer yes, and continue.
- For security reasons, the putty.exe terminal disconnects every 20 (or 30) minutes. If you want to keep it alive indefinitely, it can be configured to do so: http://staff.ask.sydney.edu.au/app/answers/detail/a_id/614
- To upload files from your Windows PC to your Linux account click here: http://brdlinux.braude.ac.il/upload.html
After copying a Python file from Windows to Linux,
in most cases you will need to convert it from Windows format to Unix format and make it executable.
For this you will need to run the following two commands:
# Change to the directory of the file: u12345@brdlinux:~> cd /home/u12345/bin u12345@brdlinux:~/bin> dos2unix file.py u12345@brdlinux:~/bin> chmod +x file.py # Make sure the first line of your program is: #!/usr/bin/python # now you can run file.py like any Linux program ! u12345@brdlinux:~> file.py arg1 arg2 arg3 ...
- Note that with this method we do not have any access to graphical programs (like fancy editors and development environments) and we will be limited to command line mode only. But this is OK as one of the course goals is to teach the power of the command line interface and also how to survive without graphical user interfaces.
- If your account is locked or does not exist, please notify me at firstname.lastname@example.org
- However, if you want to get a direct contact with the full power of the Linux operating system, then it is highly recommended that you install a full Linux system on top of your Windows PC as explained in the next option:
Linux Operating System on VirtualBox for your Windows Laptop or Home PCIt is possible to install a virtual Linux operating system on top of your Windows OS. This option will enable you to run Linux as an application on your Windows OS and have access to the full power of the Linux operating system (all graphical user Desktops and interfaces). This is however a bit slow since it runs on top of a virtual machine.
There are many Linux distributions to choose from, but we suggest only three of them that seem to be very popular.
- Linux OpenSuSe disk image can be downloaded from http://en.opensuse.org
- CentOS Linux: http://www.centos.org (The Community Enterprise Operating System) You may view YouTube videos that explain the Installation process as in http://www.youtube.com/watch?v=G0lh_itYxbA
- Ubuntu Linux: http://www.ubuntu.com/download/desktop
- Install VirtualBox (Oracle) on your laptop or pc from this link https://www.virtualbox.org/
- Download an ISO disk image of Linux to a temporary directory in your pc. Make sure it matches your pc architecture (i386 or x86_64).
- Go to VirtualBox and install OpenSuSe (or Centos, Ubuntu, or whatever Linux distribution you like). You will be asked to enter the ISO file that you have downloaded before.
- We will be doing some work on Linux operating system, especially getting familiar with Linux command line shells (in simple text terminals) playing with system programs, and writing some simple shell scripts for system programming.
- Here are a few YouTube videos that explain how to install OpenSuse on VirtualBox:
HOW TO CREATE A SHARED FOLDER BETWEEN WINDOWS AND LINUX ?
With a shared folder you will be able to edit a Python file in windows (at the "C:\shared" folder) and execute it from your ~/shared Linux directory.
More details can be found in: http://umairj.com/211/sharing-file-with-a-linux-machine-on-virtualbox
If you own a DropBox account then A more recommended alternative to a shared folder is to link
your DropBox account to your Linux account.
Details can be found in:
Install Dropbox on Linux via command line
This way is easier for sharing files between your Windows and Linux systems.
- If time allows: we will write new C Linux system calls, and compile a new Linux Kernel, and then test it. This will be done in the virtual environment alone and should not be attempted at the college laboratories.
Linux on VMWARESecond option to install a virtual Linux operating system on top of your Windows OS is by using the VMWARE Virtual Machine Player. Here is a professional document that describes this: Live CD Linux system for PC. Thanks to Tsur Trigger (Braude student in EE department) for contributing this comprehensive document that describes how to do install several Linux distributions on you windows PC (simultaneously!) and how to have access to the full power of the Linux operating system (all graphical user Desktops and interfaces). You have a chance to test several flavours of Linux and get to decide which one you like.
Linux on a diskonkeyInstallation of Linux on a diskonkey can be obtained from http://www.pendrivelinux.com/. It is possible to install the full Linux operating system on a flash drive (diskonkey) and boot from this drive. I have not tried it yet, but heard it is very stable and work faster than the virtual option. if you try it and find a particular good configuration, please let me know and I will share it with all students. The downside of this option is the fact that your do not see your Windows and cannot exchange files with it. But you get a full real Linux.
MinGW - Minimalist GNU for WindowsThis is a popular set of Unix tools for Windows. It can be downloaded from: Mingw on sourgeforge web site
This is another good option for practicing Unix on your Windows platform, but it is not the real thing. It does however provide you with a large group of powerfull Unix tools for your Windows pc. For example, you get the gcc compiler for compiling C/C++ code on your pc for free. You can use this port for practicing BASH and unix command line. Use Google to see plenty of examples. Quotation: MinGW: A native Windows port of the GNU Compiler Collection (GCC), with freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All of MinGW's software will execute on the 64bit Windows platforms.
bin.zip - A minimal set of Unix commands for DOSThis is probably the simplest and fastest way to use a limited set of Unix commands on your DOS window. Unzip this package to "C:\bin". You will find about 90 Unix commands there. To be able to use them like any other dos commands, add "C:\bin" to your PATH:
C:\> set PATH="C:\bin";%PATH%You can add "C:\bin" to your PATH permanently by:
Computer -> System Properties -> Advanced System Settings -> Environement Variables -> Path -> EditThis is a quick way to get acquainted with the basic Unix command line philosophy, but it is of course very limited and does not give you the BASH abilities and the other Unix system engines. Use Google and the Unix tutorials to understand the usage of the Unix commands such as: ls, cp, rm, mv, cat, grep, less, du, df, find, printenv, file, diff, ...
Kernighan's Law: Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.