CPS 356 (3 hours) is a course that introduces the theoretical and practical issues underlying an operating system's structure and operation. Topics include process and thread creation and management, scheduling, concurrent, multi-threaded programming and synchronization, deadlock, memory management, virtual memory, and computer security. Concepts are demonstrated using the C, Go, and Elixir programming languages in a Linux environment. This course assumes no prior experience with Linux, C, Go, Lua, or Elixir.
[LP] | Linux and C Programming by S. Perugini. 2018. Draft (Available as a Resource in Isidore). |
[PLCI] | Programming Languages: Concepts and Implementation by S. Perugini. 2018. Draft
(Available as a Resource in Isidore; only Chapter 14:
Concurrency and Synchronization needed for this course.). |
[SCMSW] | Seven Concurrency Models in Seven Weeks: When Threads Unravel by P. Butcher.
Pragmatic Programmers, Dallas, TX, 2014.
ISBN-13:978-1-937785-65-9 (textbook
webpage contains links to the source code
of all programs in the text). An eBook of [SCMSW] is available free to all UD students in the library's
eContent collection. To access it conduct a search for the title in the library's catalog
at library.udayton.edu.
Steps to access [SCMSW] off-campus:
|
[SMLSW] | Seven More Languages in Seven Weeks: Languages that are Shaping the Future by B.A. Tate, F. Daoud, I. Dees, & J. Moffit. Pragmatic Programmers, Dallas, TX, 2014. ISBN-13:978-1-941222-15-7 (textbook webpage contains links to the source code of all programs in the text). An eBook of [SMLSW] is available free to all UD students in the library's eContent collection. To access it conduct a search for the title in the library's catalog at library.udayton.edu. Steps to access [SMLSW] off-campus: follow same steps above for accessing [SCMSW] (with the title of this book). |
[CARM] | C: A Reference Manual (2nd ed.) by Harbison, S.P. & Steele Jr., G.L. (1995). Englewood Cliffs, NJ: Prentice Hall. ISBN: 0-13-326232-4. This book is on reserve at the Roesch library. |
[CPL] | The C Programming Language (2nd ed.) by Kernighan, B.W. & Ritchie, D.M. (1988). Upper Saddle River, NJ: Prentice Hall. ISBN: 0-13-110362-8.
This book is on reserve at the Roesch library. |
[OSCJ8] | Operating System Concepts with Java (8th ed.) by Silberschatz, A., Galvin, P.B., & Gagne, G. (2010). John Wiley & Sons, Inc. ISBN: 978-0-470-50949-4.
This book is on reserve at the Roesch library. |
[PG] | Programming in Go: Creating Applications for the 21st Century
by Summerfield, M. (2012). Boston, MA: Addison-Wesley. ISBN: 9780321774637
(textbook
webpage contains links to the source code
of all programs in the text).
An eBook of [PG] is available free to all UD students in the library's
eContent collection. To access it conduct a search for the title in the library's catalog
at library.udayton.edu.
Steps to access [PG] off-campus: follow same steps above for accessing [SCMSW] (with the title of this book). |
[TLCL] | The Linux Command Line: A Complete Introduction by Schotts, W. (2012). No Starch Press.
|
[UPE] | The UNIX Programming Environment (2nd ed.) by Kernighan, B.W. & Pike, R. (1984). Upper Saddle River, NJ: Prentice Hall. ISBN: 0-13-937681-X.
This book is on reserve at the Roesch library. |
[USP] | UNIX Systems Programming: Concurrency, Communication, & Threads (2nd ed.) by Robbins, K.A. & Robbins, S. (2003). Upper Saddle River, NJ: Prentice Hall. ISBN: 0-13-042411-0. This book is on reserve at the Roesch library. An eBook of [USP] is available free to all UD students in the library's eContent collection. To access it conduct a search for the title in the library's catalog at library.udayton.edu. |
Homework | Assigned | Due | Total points |
---|---|---|---|
Homework #1 | Aug 30 | Sep 6 | 20 |
Homework #2 | Sep 6 | Sep 13 | 30 |
Homework #3 | Sep 13 | Sep 20 | 40 |
Homework #4 | Sep 20 | Sep 27 | 30 |
Homework #5 | Oct 2 | Oct 9 | 20 |
Homework #6 | Oct 25 | Nov 1 | 26 |
Homework #7 | Nov 1 | Nov 8 | 18 |
Homework #8 | Nov 8 | Nov 13 | 13 |
Homework #9 | Nov 13 | Nov 20 | 48 |
Homework #10 | Nov 29 | Dec 4 | 33 |
Total Homework Points: | 245 | ||
Extra Credit Homework #1 | Oct 25 | Dec 10 | 80 |
Extra Credit Homework #2 | Nov 29 | Dec 6 | 20 |
Extra Credit Homework #3 | Dec 11 | Dec 17 | 20 |
[LP] Programming Exercise 4.31.31. (Use filename /home/<logname>/homeworks/hw1/countsubsstdin.c)
external fragmentation | internal fragmentation | sharing code | |
---|---|---|---|
contiguous-memory allocation | |||
pure paging | |||
pure segmentation | |||
paged segmentation |
0 | 5 |
1 | 6 |
2 | 1 |
3 | 2 |
section | page | offset (displacement) |
---|---|---|
bits | bits | bits |
segment | base | length |
---|---|---|
0 | 219 | 600 |
1 | 2300 | 14 |
2 | 90 | 100 |
3 | 1327 | 580 |
4 | 1952 | 96 |
When jobs initially arrive in the system, they are put on the job scheduling queue which is maintained in FIFO order. The job scheduling algorithm is run when a job arrives or terminates. Job scheduling allows as many jobs to enter the ready state as possible given the following restriction: a job cannot enter the ready state if there is not enough free memory to accommodate that job's memory requirement. Do not start a job unless it is the first job on the job scheduling queue. When a job terminates, its memory is released, which may allow one or more waiting jobs to enter the ready state.
A job can only run if it requires less than or equal to the system's main memory capacity. The system has a total of 512 blocks of usable memory. If a new job arrives needing more than 512 blocks, it is rejected by the system with an appropriate error message. Rejected jobs do not factor into the final statistics (described below).
Note that all jobs in the ready state must fit into available main memory.
Process scheduling is managed as a multilevel feedback queue. The queue has two levels, each queue is organized as a FIFO, and both use a round robin scheduling technique. New jobs are put on the first level when arriving in the ready state. When a job from the first level is given access to the CPU, it is allowed a quantum of 100 time units. If it exceeds that time quantum, it is preempted and moves to the second level.
The jobs on the second level may only be allocated the CPU if there are no jobs on the first level. When a job on the second level is given access to the CPU, it is allowed a quantum of 300 time units. If it exceeds that, it is preempted and put back on the second level of the ready queue.
Process scheduling decisions are made whenever any process leaves the CPU for any reason (e.g., expiration of a quantum or job termination). When a job terminates, do job scheduling first, then process scheduling. Also, give preference to first level jobs (i.e., if a job from the second level of the ready queue is running, and a new job enters the first level, the running job is preempted to the second level in favor of the first level job).
While executing on the CPU, a job may require I/O, which preempts it to the I/O wait queue for the duration of its I/O burst.
When a job completes, put it on a finished list for later processing.
The simulator is driven by the events read from standard input. Examples of possible events are given below. The first field will be the first character of the line, and subsequent fields will be separated by one of more spaces or tabs. The header of each field in the following examples does not appear in the input stream.
Event Time Job Memory Run Time A 140 12 24 2720
Interpretation: job 12 arrives at time 140, requires 24 blocks of memory and uses the CPU for a total of 2720 time units.
Event Time I/O Burst Time I 214 85
Interpretation: the job currently running on the CPU will not finish its quantum because at time 214 it needs to perform I/O for a duration of 85 time units.
Event Time D 214
Interpretation: display the status of the simulator at time 214.
You may assume that events appear on the input stream in ascending time order. However, realize that the events given in the input stream are not only events which your simulator must handle. For instance, a time quantum expiration is not an event given in the input stream, but it is an event which your simulator must handle. Furthermore, an internal event, such as a time quantum expiration, not in the input stream, may occur at the same time as an event in the input stream (e.g., a new job arrival). Events in the input stream are external events.
The following is a list of internal events (i.e., not given on the input stream) which your simulator must handle:
Assume that context switching and displays take no simulator time (an unrealistic assumption in a real operating system).
When a display is requested, print the contents of all queues as well as the job currently running on the CPU to standard output using only the format used in the sample output given below.
After processing all jobs, write the following to standard output (in this order, as shown on the sample output given below):
Often more than one event happen at the same time. Use the following rules to determine which events to process first:
This test data is available at /home/perugini_cps356/share/project/. At first, simply try to get only one job through your system; see the test file /home/perugini_cps356/share/project/testdata/one.txt. Once you are confident that your system processes only one job properly, try to get two jobs through the system; see the test file /home/perugini_cps356/share/project/testdata/two.txt
While developing your simulator, you are encouraged to get it to work on the simple test input first (p2d.dat) and progressively enhance and refine your system to the point where it works on the most complex test input (p2a.dat).
Use the Linux diff utility to compare your output to the correct output. For full credit, the output produced by your program must have zero differences, as defined by diff, with the output posted here.
There is also a reference executable of a solution for this project available at /home/perugini_cps356/share/project/OSsim
.Note: All directory and filenames below are case-sensitive. You must use the directory and filenames exactly as shown below, (i.e., all lower case).
Prepare your submission file as /home/<logname>/project/project.tar. This archive must contain only the most minimal set of files necessary to build your simulator from scratch. Only the file /home/<logname>/project/project.tar will be electronically collected from your account on the deadline.
Failure to follow these submission requirements will result in a 10% penalty.
tar cvf project.tar <directory_with_code>or
tar cvf project.tar <list of source code files>Be very careful to ensure the file name after the cvf is the name of the tar file. If you run the command as follows, you will overwrite one of your source files!
tar cvf Main.java Scheduler.java Types.javaThe command to untar a tar file is as follows:
tar xvf project.tarThis will create the directory structure with all the files indicated by project.tar.
Some of you may work locally on your personal computer in some IDE. To upload your code from your computer to the suse server you can either copy and paste the contents of a file into a file on the server or you can use a secure copy program.
To transfer files to and from your account, use a secure file transfer program such as FileZilla. You can also use PSCP or PSFTP available for free download from the PuTTY Download Page. You can use pscp.exe or psfpt.exe.
For Windows users you will need to download pscp or psfpt.exe. You will need to have the pscp.exe or psftp.exe in your CMD path (system environment variable PATH) or in your current working directory for this command to work or you will have to specify the path to pscp in the command (C:\putty\pscp.exe for example). Below is an example of the command:
pscp.exe -r <path_to_local_directory_with_code> <logname>@cpssuse04.cps.udayton.edu:/home/<logname>/project/
For Mac OS X and Linux users, there is a command built into your terminal called scp (for secure copy. The format of this command is:
scp -r <path_to_local_directory_with_code> <logname>@cpssuse04.cps.udayton.edu:/home/<logname>/project/
Ninety percent of your score will come from correctness and 10% of your score will come from following our programming style guide. Applicable submission penalties will then be applied.
In an effort to award partial credit to students who are unable to complete certain parts of this project, students earn up to two different portions of the 70 possible points for correctness:
Note: Depending on how you order the jobs on your I/O wait queue, your dump of the jobs waiting for I/O may not match our output exactly, and for just that queue, that is acceptable. For instance, you might organize your I/O wait queue as a priority queue where the job which comes off first is at the head, or you might maintain jobs on the I/O wait queue in the order in which they are put on and then search for the job to take off when the I/O is complete.
Component | Quantity | Points per | Total points |
---|---|---|---|
Homeworks | ~10 | varies | (33 EC) 245 |
Midterm Project | 1 | 80 | 80 |
Labs | |||
Exams & Quizzes | 3 | ~125 | 375 |
Final exam (comprehensive) | 1 | 300 | 300 |
Total: | 1,000 |
Homeworks involves analytical, theoretical, and programming exercises. The programming requires a fair amount of critical thought and design, and approximately 500-1000 lines of code. To prepare students for the realities of computer science problems in industry and graduate school (and beyond) this course encourages (and rewards) self-reliance and independent, self-directed work. Handwritten assignments are not accepted. Assignments are due at 3:35pm in class. Late assignments are not accepted. No exceptions. All exams are in-class, closed-book, and closed-notes. Attendance is mandatory at all examinations; make-ups are not given. Any missed examination will result in a zero. Make no assumptions about anything; always consult the instructor first. Final letter grades of A, A-, B+, B, B-, C+, C, C-, and D start approximately at 93, 90, 87, 83, 80, 77, 73, 70, and 60 percent, respectively.
CPS 356 is a challenging course and moves at a very fast pace. Spending a minimum of 9 hours outside of class each week reading, studying, and programming is required. I advise you to see me to discuss any problems you may have before you are evaluated. Having said this, CPS 356 is exciting, fun, and essential. The advent of multi-core processors on the desktop makes mastery of core operating system concepts and concurrent programming more necessary than ever for the modern computer scientist.
Students are expected to conduct themselves with respect, integrity, and virtue. Keep phones and similar devices in a silent mode and put away during class (i.e., out of sight). The use of laptop computers and similar devices is not permitted in class. Audio or video recording of any kind in class is strictly prohibited.
To achieve the course objectives, homework assignments must be a sole result of your work, not be shared with other students, and prepared in accordance with the University Honor Pledge (see below). Moreover, you may not plagiarize code from any, cited or uncited, textbooks, online resources, or other authors. There is no team, group-work assignments in this class. Discussions among classmates must never include pending assignments. No exemptions. All questions and comments about a pending assignment must only be directed to the instructor and teaching assistants. Evidence indicating a violation of this policy will be handled according to the University Academic Honor Code and result in a doubly-weighted zero which will not be dropped (e.g., if the assignment is worth 100 points, you receive a 0/200) or a zero on the next exam. Make no assumptions about this policy; always consult the instructor first. No student should ever feel that they must resort to academic dishonesty. You are encouraged to consult the instructor if you are struggling with the course or an assignment. No grade is worth your integrity. Honesty in your academic work will develop into professional integrity. The faculty and students of the University of Dayton will not tolerate any form of academic dishonesty.
The Honor Pledge as listed in the Academic Honor Code section of the Undergraduate Catalog applies in full to this course.
Honor code FAQ
This material is based upon work supported by the National Science Foundation under Grant Number (NSF Grant Number 1712406). Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.