CS 345 – Operating Systems
Section 001, 1:00 – 1:50 pm MWF
Section 002, 2:00 – 2:50 pm MWF
Instructor: Paul Roper
Office: TMCB 3370, 422-8149
Office Hours: 9:00 – 10:50 am MWF
BYU CS 345 Introduction to Operating Systems 1
Required Text: “Operating Systems Internals and
Design Principles” by William Stallings
User CS 345 Web Site
Syllabus, schedule, projects, homework
DO NOT USE GRADEBOOK GRADING SYSTEM!
Complete assigned reading and attend class!
BYU CS 345 Introduction to Operating Systems 3
William Stallings has authored 17 titles, and counting revised editions,
a total of 35 books on various aspects of these subjects. In over 20
years in the field, he has been a technical contributor, technical
manager, and an executive with several high-technology firms.
Currently he is an independent consultant whose clients have
included computer and networking manufacturers and customers,
software development firms, and leading-edge government
research institutions. Bill has designed and implemented both
TCP/IP-based and OSI-based protocol suites on a variety of
computers and operating systems, ranging from microcomputers to
mainframes. As a consultant, he has advised government agencies,
computer and software vendors, and major users on the design,
selection, and use of networking software and products.
Dr. Stallings holds a PhD from M.I.T. in Computer Science and a B.S.
from Notre Dame in electrical engineering.
BYU CS 345 Introduction to Operating Systems 4
Computer Science 345 is an
introduction to the principles underlying
the design and the implementation of
contemporary computer operating
Class designed for students majoring in
Computer Science or in areas having a
strong emphasis in Computer Science.
BYU CS 345 Introduction to Operating Systems 5
At the end of the course, the student should have
a basic understanding of:
Design and implementation issues of contemporary
Detailed analysis of process, multithreading,
symmetric multiprocessing, and microkernels
Memory management techniques, including virtual
Various approaches to process scheduling
Operating system control of Input/Output
Operating system management of files
BYU CS 345 Introduction to Operating Systems 6
CS 124, CS 235, CS 236, CS 240.
CS 345 is a recommended prerequisite to
Knowledge of C.
Or, instructor’s consent.
BYU CS 345 Introduction to Operating Systems 7
BYU Computer Science Major CS 142
Requirements / Prerequisite Intro Programming
Chain Fall 2009 (72-75 Hours)
CS 235 CS 124
1. Complete all CS core classes. (No D credit accepted.)
Data Structures Intro to Comp Sys
2. Complete the following supporting courses:
a. Engl 316.
b. Math 112, 113, 313.
c. Phscs 121. Sophomore
d. Stat 221 (Stat 321, 331, 332, or 441 may be
be used here or as elective credit but not both). CS 252
3. Complete 6 elective courses selected as follows: Intro to Comp Theory
a. 4 courses from ECEn 324, 425, or CS 240 Engl 316
400-level CS courses (except 404 and 405). Adv Programming Technical Writing
b. 1 additional course from (a) or a 500-level
c. 1 additional course from (a), or CS 405, or
ECEn 224, or Math 314, 341, 334, 365, 371, Junior CS 312 CS 345 CS 404
410, 450, or Stat 321, 331, 332, 421, 441, Algorithm Analysis Operating Systems Comp in Society
or PDBiol 120, or Chem 112, or Geol 112.
(*Other science courses such as Chem 111,
Geol 111, Phscs 123, and Phscs 220 may CS 330 CS 340 CS 360
apply when NOT used for GE science Prog Languages SW Engineering Internet Prog
requirement. Check with advisement first.)
Senior CS 405
Math 112 Phscs 121 ECEn 224
Calculus 1 Physics CS 412 CS 428 CS 452
CS 418 CS 431 CS 465 Math 314
Models & Software Sys Database
Optimization BioInformatics Compilers Design Modeling Security Math 341
Math 113 Stat 221 Math 334
Calculus 2 Intro Statistics CS 450 CS 476 CS 455 CS 460 ECEn 324
Signal Image Comp Graphics Math 355
Processing Data Mining (Math 313) Networks Architecture Math 371
Math 313 Math 410
Linear Algebra CS 470 CS 5xx CS 456 CS 462
Artificial User Interface Distributed ECEn 425 Math 450
Intelligence _________ Software Systems Real-time OS Stat 321
Core classes CS 478 Stat 332
Learning Suggested 400-level Elective Tracks: Stat 421
Graphics & Image Processing: Artificial Intel. / Machine Learning:
May be taken concurrently Background – 431, 460, 478 Background – 431, 450, 460 Stat 441
Specialty – 450, 455, 456, 557 Specialty – 470, 476, 478, 486 PDBiol 120
Systems/Networking: Verification / Software Engineering: *Chem 111
Prerequisite ELECTIVES Background – 428, 450
Specialty – 431, 460, 462, 465
Background – 431, 456, 478
Specialty – 428, 452, 486
applies to all Application Development: *Geol 111
courses within Background – 431 Geol 112
the box. Specialty – 428, 452, 456, 462 *Phscs 123
BYU CS 345 Introduction to Operating Systems Updated 03/12/2009 *Phscs8 220
Organization and Grading
This class consists of lecture, homework,
programming assignments, midterms, and
a final. Each has a weighted contribution to
your final grade.
Programming Labs: 52%
2 Midterms: 16%
BYU CS 345 Introduction to Operating Systems 9
Programming Labs: (52%)
Lab 1: Shell (CLI) - 6%
Lab 2: Scheduling - 8%
Lab 3: Jurassic Park - 10%
Lab 4: Virtual Memory - 10%
Lab 5: FSS - 8%
Lab 6: FAT - 10%
BYU CS 345 Introduction to Operating Systems 10
Grades are assigned on the following
scale from the composite total of above
100-93 A 82-80 B- 69-67 D+
92-90 A- 79-77 C+ 66-63 D
89-87 B+ 76-73 C 62-60 D-
86-83 B 72-70 C- 59-0 E
BYU CS 345 Introduction to Operating Systems 11
Homework assignments are designed to reinforce
class material and help in exam preparation.
Most homework consists of 5-10 questions and
covers the material from the previous class
Homework is assigned for every 4 lectures and is
due at the beginning of class.
Any homework submitted after the due date will
lose 50% per week. (After 1 week, an assignment
has no grading value!).
BYU CS 345 Introduction to Operating Systems 12
Homework must have the student’s name,
section, and homework number clearly indicated
at the top of the homework to be accepted for
Finally, you are welcome and encouraged to
discuss the homework with your classmates and
others. However, you are to do and submit your
own work. Submitting someone's work is
considered cheating for which you will receive an
E grade for the class and be reported to the Honor
BYU CS 345 Introduction to Operating Systems 13
Programming Assignments (52%)
There are six programming lab assignments
designed to emphasize topics discussed in class.
The programming assignments build upon each
other and explore a variety of operating system
Programming assignments can be found on the
CS345 web site
Programming assignments must be passed off by
a TA during regular TA hours in the TA offices or
class programming labs.
BYU CS 345 Introduction to Operating Systems 14
To receive full credit, programming assignments
must be completed and passed off with a “Date
Modified” timestamp on or before the due date.
NOTE: Timestamps cannot be used for extra credit
points and cannot be more than two days delinquent.
Any assignment completed and passed off after
the due date will lose 10% per school day. (After
2 weeks, an assignment has no grading value!).
Programming assignments can be passed off
on school computers or personal laptops.
BYU CS 345 Introduction to Operating Systems 15
As an incentive to get your assignments done
early, assignments passed off at least one day
before the due date (timestamps do not count)
with a TA, will receive an additional 10% extra
Any grade points earned on assignments above
the allotted percentage may apply to your
All assignments MUST BE COMPLETED,
PASSED OFF AND SUBMITTED on or before
the final day of class.
BYU CS 345 Introduction to Operating Systems 16
All six programming assignments must be
completed to receive and “A” or “A-”
Everyone who completes all six
programming assignments (regardless of
their scores) and passes the final exam
(non-normalized 70% or better) will pass
the class with at least a “C-” grade.
BYU CS 345 Introduction to Operating Systems 17
Midterms and the final exam are
administered in the testing center.
The midterms are available from Thursday
until closing on Saturday.
The final will be given during finals week
at the testing center.
Anyone missing a midterm without prior
arrangement is automatically assessed a
BYU CS 345 Introduction to Operating Systems 18
Discuss subject matter with respect to assigned
contemporary operating system.
Use slides, handouts, and/or examples as
Presentations are to last NO LONGER THAN 15
Submit peer evaluations of presentation
Presentation is worth 10% of final grade.
BYU CS 345 Introduction to Operating Systems 19
Programming of the assignments will be
done in the C programming language.
The choice of the software tools and
programming environment is left to the
In any case, it is the student’s
responsibility to present their work to a
TA in the designated CS 345 lab for
pass off. (Downstairs TMCB)
BYU CS 345 Introduction to Operating Systems 20
Programming Environments (continued…)
Windows users can download a very good free C
compiler at the LCC website
For those wanting to use Linux on their personal
computers, look at the KNOPPIX website
(http://www.knoppix.net/) for a free Linux system
bootable from CD ROM.
For those who do not own a computer or would
just rather do their work using BYU facilities, there
are Linux/Unix labs available in the Computer
Science building using the gcc compiler.
BYU CS 345 Introduction to Operating Systems 21
Grade Verification and Appeals
It is the student’s responsibility to verify
that scores have been correctly recorded
Until further notice, do not use
Gradebook’s grading system (including
The student can appeal a grade on an
exam directly to their instructor through
BYU CS 345 Introduction to Operating Systems 22
Academic honesty includes completing
your own homework, labs, midterms, and
Students should work together to help
each other understand material, but
should always turn in their own work.
Examples of academic dishonesty include
sharing code for labs with other students,
turning in someone else's writing as your
own report, and cheating on an exam.
BYU CS 345 Introduction to Operating Systems 23
The first violation of academic honesty
standards will result in the student failing
All violations of academic honesty are
documented and reported to the Honor
BYU CS 345 Introduction to Operating Systems 24
Lab 1: Shell. Write a Shell (Command
Language Interpreter) to parse textual
commands entered from the user’s keyboard,
malloc argument variables, handle signals, and
execute programs directly or as child processes.
Lab 2: Scheduler. Write a five-state task
scheduler capable of simultaneously executing
up to 128 tasks in a preemptive, prioritized,
round-robin manner. Implement binary and
counting semaphores and schedule your CLI as
its first task with pseudo-interrupt driven
character input. Add timer semaphores and
tasks to validate your implementation.
BYU CS 345 Introduction to Operating Systems 25
Lab 3: Jurassic Park. Jurassic Park is an inter-
process communication and synchronization
problem between multiple tasks. Visitors to the
park purchase a ticket, wait to take a ride on a
park tour car to see the dinosaurs, and then visit
the museum and gift shops before leaving the
park. Since the park is on a limited budget,
drivers must perform double duty when not
sleeping by selling tickets and driving the tour
cars. Visitors, drivers, and cars are represents
by concurrent tasks while an additional task is
used to display the park status every second.
BYU CS 345 Introduction to Operating Systems 26
Project 4: Virtual Memory. Add a Memory
Management Unit (MMU) to your OS that
translates virtual LC-3 addresses to physical
addresses in a restricted memory space.
Validate your implementation by successfully
executing up to 10 LC-3 crawler and/or memory
test programs concurrently in 2 frames of
physical memory (128 words).
BYU CS 345 Introduction to Operating Systems 27
Lab 5: FSS Scheduling. Add a Fair
Share Scheduler (FSS) to your OS
scheduler to maximize overall CPU
utilization while also maximizing
interactive performance. Instead of using
run queues, implement a “fair” timeline of
future task execution.
BYU CS 345 Introduction to Operating Systems 28
Lab 6: FAT File Manager. Add a MS-
DOS® FAT-12 file manager to your OS
that is able to traverse file directories, view
file data, and load/execute LC-3 programs
from files. Implement creation, access,
and modification of FAT-12 files by adding
file manager functions and commands that
use file system buffering, basic file I/O, file
descriptors, and file pointers to modify file
allocation tables (FAT), directory structures
and cluster chains.
BYU CS 345 Introduction to Operating Systems 29
Linux vs Microsoft users
BYU CS 345 Introduction to Operating Systems 30
Why CS 345?
BYU CS 345 Introduction to Operating Systems 31
What is an operating system?
Hard to define precisely, because operating systems
arose historically as people needed to solve
problems associated with using computers.
“Software that makes computing power available to
users by controlling the hardware.”
“Software executes when nothing else is
“A collection of software modules including device
drivers, libraries, and access routines.”
BYU CS 345 Introduction to Operating Systems 32
What Does a Modern OS Do?
Hardware has low-level physical resources with
complicated, idiosyncratic interfaces.
OS provides abstractions that present clean interfaces.
Goal: make computer easier to use.
Examples: Processes, Unbounded Memory, Files,
Synchronization and Communication Mechanisms.
Provides Standard Interface:
Unix runs on many very different computer systems.
BYU CS 345 Introduction to Operating Systems 33
What Does a Modern OS Do?
Mediates Resource Usage:
Goal: allow multiple users to share resources fairly,
efficiently, safely and securely.
Multiple processes share one processor. (preemptable
Multiple programs share one physical memory (preemptable
Multiple users and files share one disk. (non-preemptable
Multiple programs share a given amount of disk and network
bandwidth (preemptable resource).
Solaris takes up about 8 Mbytes physical memory (or about
BYU CS 345 Introduction to Operating Systems 34
In the future, computers will continue to become
physically smaller and more portable.
Operating systems have to deal with issues like
disconnected operation and mobility.
Media rich information within the grasp of
common people - information with psuedo-real
time components like voice and video.
Operating systems will have to adjust to deliver
acceptable performance for these new forms of
BYU CS 345 Introduction to Operating Systems 35
Operating systems are so large no one person
understands whole system. Outlives any of its
The major problem facing computer science
today is how to build large, reliable software
Operating systems are one of very few
examples of existing large software systems,
and by studying operating systems we may
learn lessons applicable to the construction of
BYU CS 345 Introduction to Operating Systems 36