Computer Sciences Dept.

CS 537 - Introduction to Operating Systems

Spring 2007

Marvin Solomon
office: 7367 Computer Sciences
office hours: 1:00 Tuesday and Thursday, or by appointment
office phone: 263-2844
email address:


Mark Cowlishaw
office:  1309 Computer Sciences
office hours:  1:00-3:00 PM, MWF
email address:   mcowlish<AT>

Mohamed Eldawy
Office:  5384 Computer Sciences
Office Hours: 9:00-11:00 AM Monday; 9:00-10:00 AM and 4:00-5:00 PM Wednesday
email address:  eldawy<AT>

  • Photo Gallery


    Watch this space for important announcements.
    Last updated: Thu May 17 11:16:35 CDT 2007
    May 17 Project 5 has been graded. Here is a summary of grades.
    The mean grade was 84.80 and the median was 90.
    May 8 Project 4 has been graded. Here is a summary of grades.
    The mean grade was 78.97 and the median was 82.
    May 7 An improved version of is available. See the project page for details.
    May 2 A bug in has been fixed. See the project page for details.
    April 17
    Project 3 has been graded. Here is a summary of grades.
    The mean grade was 96.73 and the median was 98.
    March 22
    Students Cymen Vig and Jason Malinowski reported that there is still a lurking race condition. This one is quite rare and only affects shutdown, causing the program to hang when it's trying to terminate. Jason properly diagnosed the problem: synchronized method Request.await() calls synchronized method Warehouse.undo() and synchronized method, calls synchronized method Request.give() (indirectly, via algorithmN(). This is exactly the same sort of thing you were penalized for on project 2.

    As Jason noted:

    • the main thread is done running stuff and is interrupting the brewer threads
    • a brewer gets the interrupt, and fires off P3.getWarehouse.undo(alloc) to undo the request, while simultaneously
    • the Warehouse (which has a lock due to run()), is going to give that brewer's request some stuff (the exact same request that is trying to be aborted.)
    This is an excellent object lesson on why it's a bad idea for a synchronized method in one object to call a synchronized method in another object. Too bad I didn't follow my own advice.

    If you're still working on your project and you are seeing some runs hang, you might want to grab new copies of,, and from ~cs537-1/public/html/source/p3.

    March 19
    IMPORTANT: There was a bug in program P3 that could cause it to deadlock under certain race conditions. Please fetch a new copy of ~cs537-1/public/html/source/p3/ Many thanks to the alert students who diagnosed the bug and many apologies from the addle-brained professor who created it. I guess you learned something from project 2! Too bad I didn't :-(.

    To make up for the time some of you wasted on this bug, I've extended the due date to Tuesday, March 27.

    March 19
    There is now a FAQ for project 3.
    March 16
    The midterm exam has been graded. Here is a summary of grades.
    The mean grade was 83.83 and the median was 86.
    March 15
    Project 2 has been graded. Here is a summary of grades.
    The mean grade was 86.03 and the median was 89.
    March 6
    The midterm exam will be from 7:15 to 9:15 Thursday, March 15 in room 1240 Computer Sciences. Here are some sample questions of the kind that will be on the exam.
    March 6
    The project 3 instructions are ready for you to start work.
    Feb 19
    Project 1 has been graded. Here is a summary of grades.
    The mean grade was 79.35 and the median was 82.

    Comments on the grading are in the file ~cs537-1/handin/yourlogin/P1/p1_grade.txt. You can find your current record and class standing in the file ~cs537-1/handin/yourlogin/grade.

    Feb 8
    The project 2 instructions are ready for you to start work. A FAQ (frequently asked questions) page is included.
    Feb 8
    The class mailing list is This list includes all students enrolled in the course as well as both TAs and the professor. We may occasionally send announcements to this list, but you should still be in the habit of checking this web page frequently for news about the course. Messages to this list will be sent to your “official” UW address You can arrange to have your mail forwarded to a different address (e.g. by visiting My UW-Madison and clicking on the My NetID link.

    Anyone in the class can send mail to the whole list. However, please do not mail to this list unless you think your message may be of interest to a significant fraction of the class. Questions about ambiguities in project specifications, etc. should probably be sent to the Professor and/or TAs. One appropriate use of these lists would be to look for a partner for projects.

    Messages previously sent to this list will be archived at

    January 23
    A previous version of this page incorrectly indicated that the midterm exam would be “Thursday, March 13.” The correct date is Thursday, March 15.
    January 16
    If you have not previously used the Unix computing facilities in the CS department at UW, you may find it helpful to attend one of the Unix orientation sessions. They are offered January 23, 24, and 25 at 4pm in room 1325 Computer Sciences. The sessions will all be the same, so you only need to attend one of them. If you are new to Unix, you should also purchase the CS 1000 handout at the DoIT Tech Store.


    CS 537 is intended as a general introduction to the techniques used to implement operating systems and related kinds of systems software. Among the topics covered will be process management (creation, synchronization, and communication); processor scheduling; deadlock prevention, avoidance, and recovery; main-memory management; virtual memory management (swapping, paging, segmentation and page-replacement algorithms); control of disks and other input/output devices; file-system structure and implementation; and protection and security.

    This course assumes familiarity with basic computer organization (e.g., processors, memory, and I/O devices as covered in CS354) and data structures (e.g., lists and hash tables). You will need to be able to program in Java to perform the assignments in the course.

    Lecture Information

    11:00 - 12:15 Tuesday and Thursday1221 Computer Sciences
    2:25 - 3:15 Tuesday1221 Computer Sciences

    The Tuesday afternoon 2:25 session is listed in the timetable as “discussion”, but it will generally be used as fourth hour of lecture, following in sequence with the other lectures. Each week, it will start with discussion of topics related to the projects and questions regarding points raised in the the lectures or the text, but when all these questions have been answered, I will continue with the regular lecture material.

    Important announcements will be sent to the class mailing list or posted to the News section of this web page above, so please read your mail and check this page frequently (particularly around project time). You are responsible for all such announcements, as well as announcements made in lecture. Note that if you are not officially enrolled in the class, we cannot add you to this mailing list because it is automatically generated.



    Applied Operating Systems Concepts, Seventh Edition by Abraham Silberschatz, Peter Baer Galvin, and Greg Gagne, John Wiley and Sons, 2004; or Applied Operating Systems Concepts with Java, Seventh Edition by Abraham Silberschatz, Peter Baer Galvin, and Greg Gagne, John Wiley and Sons, 2007.
    This text is only recommended rather than required, since the main “text” for this course is a set of online lecture notes. This book is useful for reference, for an alternative point of view, and for those who like the security of having a large, heavy, and expensive book to turn to. I chose this particular text because it has been used in recent semesters, so used copies should be available at the bookstore.

    Other editions may be used interchangeably for the purposes of this course.

    Another recently used text book that covers the same material is Modern Operating Systems, Second Edition by Andrew S. Tanenbaum, Prentice Hall, 2001.

    The Java Programming Language, Fourth Edition by Ken Arnold, James Gosling, and David Holmes, Addison-Wesley, 2006.

    There are literally thousands of books on the Java programming language and I have only looked at only a few of them, so there may very well be a better book, but this one is quite good. The fourth edition also includes “Java 5” features, which we will be using in this class. See also the summary of new features on the Java web site.

    Online References

    I have written a set of online lecture notes. Lots of additional helpful materials about Java are available on the web.

    The following references are available online at the Java home site.

    You will be referring to the last of these particularly frequently.


    There will be five programming projects, all in the Java programming language. Unix workstations are provided for your use, but you may use any computer to which you have access that implements the Java programming language (version 1.5). However, if you do not use the Computer Sciences Department's computers, you will be responsible for transferring any required data sets or software packages to your computer and for transferring programs and results back to the CS department machines to hand them in.

    The first assignment will be an easy “get acquainted” exercise designed to help you become familiar with the computing environment and the Java language, particularly the Thread feature of Java. Subsequent projects will involve process synchronization, processor scheduling, memory management, and file-system implementation. Each student should do the first assignment individually. For the remaining projects, students will be required to work in pairs. Both members of a pair will receive the same grade on a project. Feel free to discuss projects with anyone, but you must not share code with anyone but your partner. That means you may not use in any way code written by other students in this class, code from previous semesters, or code from similar courses elsewhere. In summary, the only Java code you may use is code you write, code we give you, and Java classes from the standard Java libraries. Cheating will be vigorously punished. See the Dean of Students' Code of Conduct for more details. Enough said!

    Programming assignment 3 is due at the start of lecture. Other programming assignments are due at 1:00 a.m. on the dates indicated.

    Why Java?

    Sometimes the projects in this course are in C or C++, sometimes they are in Java, and sometimes they are in a mixture of languages. This semester, both lectures will be using Java. There are several arguments in favor of Java, but two in particular are most relevant to this course:

    • Java is a more congenial programming environment. Runtime errors such as bad subscripts, null pointers, and uninitialized variables cause exceptions caught by the language runtime rather than mysterious crashes or random behavior. Java Strings are much easier to use than char * arrays. Garbage collected storage management is extremely handy. Using Java rather than C or C++ will make you more productive, allowing you to spend more time on the concepts and algorithms and less time tracking down obscure bugs. It allows me to assign more challenging and hopefully more interesting projects.
    • Java has “operating system” features built in. In particular, it is the first widely-used programming language with language-level support for concurrency (threads) and synchronization (monitors).

    On the other hand, there are some excellent arguments for using C and/or C++ in this course.

    • Java hides what's really going on. The essence of the study of operating systems is the relationship between the hardware and software. The congenial Java programming environment is provided by thick layer of software that cushions some of the nastier knobs and hooks provided by the hardware and the operating system kernel.
    • Systems programmers need to know C. There's still a huge market for programmers trained in C and/or C++, for operating systems and related fields such as networking and real-time and embedded systems. It can be argued that a student with degree in Computer Science who has not programmed in C has received a deficient education.
    • Java is for wimps. Real men and women use C. This is actually a corollary to the other two points. We will talk about the C-language interface to the operating system, but in some sense, you do cannot fully appreciate the feel of of the low-level interfaces without experiencing them first-hand. In fact, there's a strong argument for requiring some use of assembly language.
    Learning C is not so much a matter of learning its syntax and semantics (which are, after all, not all that different from Java), but rather a matter of learning survival skills for this harsh world. If you have a subscript out of bounds or dereference a null pointer in Java, you get a nice traceback, telling you exactly where in the program you screwed up. In C, you will probably get the error message, “Segmentation fault”, which is about the only runtime error message that exists. It means, roughly, “something went wrong somewhere.” And that's only if you're lucky! If you're unlucky, your wild reference will damage some variable totally unrelated to what you were doing. The injury will lie in waiting until much later, when it will cause totally unpredictable and unfathomable results. A real education in C would focus primarily on avoiding the “gotchas” and on picking up the pieces when you don't. Students who are familiar with Java and want to learn C++ should check out CS 368.

    This course will assume that all students are Java programmers at the level of someone who has completed CS 367 with an A or AB. If you are familiar with C++ but not Java, check out the excellent introduction to Java and/or my Notes on Java. See The Java Tutorials and/or the Java book for lots more information about Java.


    There will be a midterm and a final exam, each of which will count for 19% of your grade.
    The midterm will be 7:15-9:15 PM Thursday, March 15, room 1240 Computer Sciences.
    The final exam will be 12:25 - 2:25 PM, Wednesday, May 16, room 1240 Computer Sciences.

    The first programming project (getting started) will count for 2% of your grade. The remaining four projects will account for the remaining 60% of your grade. They may not all be equally difficult (generally they will get progressively harder throughout the term), but they will all count equally.

    Course Schedule

    The following schedule is tentative; it may be updated later in the semester, so check back here frequently.

    1Jan 23 - 25Introduction
    2-6Jan 30 - Feb 27 Processes, Synchronization, Processor Scheduling
    6-11March 1 - Apr 10 Memory Management and Virtual Memory
    11-14Apr 12 - May 1 File Systems and Disks
    14-15May 3 - May 10 Protection and Security
    Programming Assignments
    3Wednesday, Feb 7 at 1:00 am Project 1 -- Shell
    6Wednesday, Feb 28 at 1:00 am Project 2 -- Synchronization
    9Tuesday, Mar 27 at the start of lecture Project 3 -- Performance
    12Wednesday, Apr 18 at 1:00 am Project 4 -- File Systems, Part I
    15Friday, May 11 at 1:00 am Project 5 -- File Systems, Part II
    8Thursday, March 15 Midterm Exam, 7:15 - 9:15 pm, Room 1240 Computer Sciences
    16Wednesday, May 16 Final Exam, 12:25 - 2:25 pm Room 1240 Computer Sciences

    Computer Sciences | UW Home