Homeworks
Each chapter has some questions at the end; we call these "homeworks", because you should do the "work" at your "home". Make sense? It's one of the innovations of this book.
Homeworks can be used to solidify your knowledge of the material in each of the chapters. Many homeworks are based on running a simulator, which mimic some aspect of an operating system. For example, a disk scheduling simulator could be useful in understanding how different disk scheduling algorithms work. Some other homeworks are just short programming exercises, allowing you to explore how real systems work.
For the simulators, the basic idea is simple: each of the simulators below let you both generate problems and obtain solutions for an infinite number of problems. Different random seeds can usually be used to generate different problems; using the -c
flag computes the answers for you (presumably after you have tried to compute them yourself!).
Each homework included below has a README file that explains what to do. Previously, this material had been included in the chapters themselves, but that was making the book too long. Now, all that is left in the book are the questions you might want to answer with the simulator; the details on how to run code are all in the README.
Thus, your task: read a chapter, look at the questions at the end of the chapter, and try to answer them by doing the homework. Some require a simulator (written in Python); those are available by below. Some others require you to write some code. At this point, reading the relevant README is a good idea. Still others require some other stuff, like writing C code to accomplish some task.
To use these, the best thing to do is to clone the homeworks. For example:
prompt> git clone https://github.com/remzi-arpacidusseau/ostep-homework/
prompt> cd file-disks
prompt> ./disk.py -h
Introduction
Chapter | What To Do |
---|---|
Introduction | No homework (yet) |
Virtualization
Chapter | What To Do |
---|---|
Abstraction: Processes | Run process-run.py |
Process API | Run fork.py and write some code |
Direct Execution | Write some code |
Scheduling Basics | Run scheduler.py |
MLFQ Scheduling | Run mlfq.py |
Lottery Scheduling | Run lottery.py |
Multiprocessor Scheduling | Run multi.py |
Abstraction: Address Spaces | Write some code |
VM API | Write some code |
Relocation | Run relocation.py |
Segmentation | Run segmentation.py |
Free Space | Run malloc.py |
Paging | Run paging-linear-translate.py |
TLBs | Write some code |
Multi-level Paging | Run paging-multilevel-translate.py |
Paging Mechanism | Run mem.c |
Paging Policy | Run paging-policy.py |
Complete VM | No homework (yet) |
Concurrency
Chapter | What To Do |
---|---|
Threads Intro | Run x86.py |
Thread API | Run some C code |
Locks | Run x86.py |
Lock Usage | Write some code |
Condition Variables | Run some C code |
Semaphores | Read and write some code |
Concurrency Bugs | Run some C code |
Event-based Concurrency | Write some code |
Persistence
Chapter | What To Do |
---|---|
I/O Devices | No homework (yet) |
Hard Disk Drives | Run disk.py |
RAID | Run raid.py |
FS Intro | Write some code |
FS Implementation | Run vsfs.py |
Fast File System | Run ffs.py |
Crash Consistency and Journaling | Run fsck.py |
Log-Structured File Systems | Run lfs.py |
Solid-State Disk Drives | Run ssd.py |
Data Integrity | Run checksum.py and Write some code |
Distributed Intro | Write some code |
NFS | Write some analysis code |
AFS | Run afs.py |
C-programming tips and lessons learned
- ch 39,
myls.c
: uses thegetopt
command fromunistd.h
to parse commandline args. - ch 39,
myls.c
: usingstdbool.h
for thebool
type - ch 39,
myls.c
: usingstrlen
,strncpy
,strncmp
, andstrncat
fromstring.h
- ch 39,
mytail.c
: usinghandle_error
function macro to print error then exit the program - ch 39,
mytail.c
: opening files withopen
fromfcntl.h
- ch 39,
mytail.c
: reading/parsing files withlseek
andread
fromunistd.h
- ch 39,
myfind.c
: regex parsing viaregex.h
- ch 39,
myfind.c
:errno
andEACCES
viaerrno.h