San Jose State University : Site Name


Main Content

Working in Mars Mission Control, JPL

Ronald Mak

Department of Computer Science
Spring Semester 2015

Office hours: TuTh: 7:30-8:30 PM
Office location: MacQuarrie Hall, room 413
Mission Control, Jet Propulsion Laboratory (JPL)
NASA Mars Exploration Rover Mission

CS 149: Operating Systems

Section 3: TuTh 9:00-10:15 AM, DH 450
Section 2: TuTh 3:00-  4:15 PM, MH 233
Section 8: TuTh 6:00-  7:15 PM, MH 223

Team assignments

# Date Due Project
1 Jan 27 Feb 2 Linux up and running

Program: forktest.c
2 Feb 5 Feb 16 Process scheduling algorithms
3 Feb 17 Feb 27 Multithreaded class enrollment
4 Mar 5 Mar 20 Swapping and paging
5 Apr 2 Apr 9 Disk scheduling algorithms

Solution: Assignment5Solutions.xls
6 Apr 14 Apr 27 UNIX I/O


Date Content
Jan 22 Slides: What is an OS?; why study OS?; purpose of an OS; OS generations; abstractions; UNIX as an example OS; VirtualBox; OS generations; historical perspective: batch computer systems, data processing with plugboards and punched cards, IBM 1401
Jan 27 Slides: Installation of Debian in a virtual machine; guest additions; shared folder; abstractions: processes, memory, file systems; API; fork(); Assignment #1; mounted file systems; pipes; shell; I/O redirection

Debian installation screen shots.
Ubuntu and guest additions installation YouTube videos.

Example system calls: forktest.c   echo.c
Jan 29 Slides: Systems call waitpid(); man pages; shell piping; POSIX; kernel mode vs. user mode; system call workflow; OS structure: monolithic, layered, virtual machine, client-server, distributed; processes; process models; context switching; process creation and termination; process states
Feb 3 Slides: Process control block contents; scheduling goals; process behavior; compute-bound and I/O-bound; when to schedule; preemptive; non-preemptive; scheduling critera and goals; first-come first-served; shortest job first; Practice Problem #1; shortest remaining time; round robin; time quantum vs. context switch time; interactive systems; highest priority first; Practice Problem #2
Feb 5 Slides: Practice Problem #2; shortest process next; lottery scheduling, fair-share scheduling; realtime systems: interrupt routines; Assignment #2; threads; multicore systems; thread scheduling; user-level; kernel-level; POSIX threads
Feb 10 Slides: Thread code example; interprocess communication; shared memory; producer-consumer code example; message passing: direct and indirect; message synchronization; client-server communications: sockets, remote procedure calls, marshalling and unmarshalling parameters; pipes; pipe code example; process synchronization; race condition; critical region

Example thread code: threadtest.c
Example producer-consumer: producer.c    consumer.c
Example pipe code: pipe.c
Feb 12 Slides: Lock variables; busy waiting; Peterson's Solution; test and set lock instruction; sleep and wakeup; semaphores and mutexes; synchronized producer and consumer example; problems with semaphores

Synchronized producer-consumer: procon.h   procon.c
Feb 17 Slides: Example multithreading program; Assignment #3; Readers-Writers problem; Dining Philosophers problem

Example multithreading program: officehour.c   officehour.out
Feb 19 Slides: Dining Philosophers pseudo-C solution; monitors; Java monitors; Dining Philosophers Java solution; deadlocks; resources; definition; conditions; modeling; Pthreads deadlock example; strategies; ignore them; detection and recovery

Dining Philosophers Java monitor solution:   DiningPhilosophers.out
Example Pthreads deadlock: deadlock.c
Feb 24 Slides: Preventing deadlocks by negating the four conditions; global resource numbering; Deadlock avoidance; resource trajectories; banker's algorithm for a single resource and for multiple resources; two-phase locking; memory management; computer system architecture; memory hierarchy; memory/storage speed comparisons; memory manager
Feb 26 Slides: Monoprogramming systems; fixed partitions; process relocation; process protection; address binding Logical vs. physical address space; dynamic loading and linking; swapping; variable partition scheme; memory compaction; memory demands; keeping track of memory
Mar 3 Slides: Memory allocation algorithms; memory fragmentation; paging; shared pages; multilevel page tables; page table entry translation lookaside buffer (TLB); TLB hit ratio; inverted page tables; segmentation; paging vs. sementation
Mar 5 Slides: Internal vs. external fragmentation; virtual memory; demand paging; page fault; copy-on-write; page replacement; first-in first-out (FIFO); second chance; least recently used (LRU); least frequently used (LFU); most frequently used (MFU); random pick; working set; thrashing; page fault frequency (PFF); Assignment #4
Mar 10 Slides: Locality model; working set model; local vs. global page allocation; working set and page fault rate; prepaging; page size; TLB reach; program structure; kernel memory; buddy system; memory-mapped files; Intel architecture; ARM architecture

Example memory-mapped file: mapfile.c
Mar 12 Slides: Linux memory management; Linux physical memory; Linux kernel mamory allocation; review for the midterm; sample midterm questions
Mar 19 Slides: Midterm solutions; OS design goals and challenges; interface design principles; layered OS architecture; hiding low-level hardware; performance; space-time tradeoff; Mythical Man Month; OS trends
Apr 2 Slides: Hard disk storage; hard disk drives; disk attachment; disk scheduling: FCFS, SSTF, SCAN, C-SCAN, LOOK, C-LOOK; scheduling choices; Assignment #5; hierarchical storage management (HSM); RAID; price per metabyte of DRAM and hard disk; file systems; files; file types; file attributes; file operations; opening a file; internal file tables; file locking
Apr 7 Slides: Computer History Museum unofficial field trip; file structure; sequential access method; direct (ramdom) access method; disk structure; directories; directory operations; single-level directory; two-level directory; tree-structured directory; acyclic-graph directory; file path names; mounting a file system; file protection; layered file system; disk layout; file allocation: contiguous, linked, FAT, indexed; UNIX inode
Apr 9 Slides: Implementing directories; UNIX directories; UNIX file system exercises; disk block size; free disk space management; file system reliability; bad blocks; backups and dumps; file system consistency; file system performance
Apr 14 Slides: Journaling file systems; virtual file system (VFS); network file system (NFS); NFS mounting; Assignment #6; types of I/O devices; hardware to support I/O; bus architecture; device controllers; memory-mapped I/O; direct memory access (DMA); I/O software layers; device drivers; device-independent software; I/O interrupts; synchronous and asynchronous I/O operations; kernel I/O subsystem
Apr 16 Slides: Polling; I/O interrupts; software interrupts; traps; application-level interrupt handlers; clocks and timers; select(); sockets; how fast?; multiprocessor systems; multiprocessor OS; remote procedure call (RPC); distributed shared memory (DSM)

Example interrupt handler : interrupt2.c
Example timer: timers.c
Example select: select.c
Example socket: server.c   client.c   socket_name.h
Apr 21 Slides: Virtual machines; virtual machine managers; host vs. guest operating systems; virtualization requirements; history; benefits; implementation; type 2 hypervisor; virtualization components; distributed systems; advantages; network operating systems; distributed operating systems
Apr 23 Slides: Network structure; local area network (LAN); wide area network (WAN); communication structure; naming and name resolution; domain name service (DNS); routing strategies: fixed, virtual, dynamic; connection strategies: circuit switching, message switching, packet switching; contention; CSMA/CD; communications protocols; ISO network model; TCP/IP protocol layers; Ethernet packet transmission; failure detection; reconfiguration; network design issues
Apr 28 Slides: Distributed file system (DFS); DFS structure; naming and transparency; naming schemes; remote file access; cache location; cache update policy; caching consistency; protection; principle of least authority (POLA); protection granularity; protection domains; UNIX domains; UNIX domain switching; access matrix; access control list; capability list; role-based access control; covert channels; program-level protection
Apr 30 Slides: Security; security violations; violation methods; man-in-the-middle attack; levels of security; trojan horse attack; trap door attack; logic bomb; stack and buffer overflow; viruses; keystroke logger; Morris Internet worm; port scanning; denial of service; design principles for security; user authentication; security firewalls; cryptography; bad guys, cybersecurity career
May 5 Slides: Case study: Linux; history of UNIX; POSIX; booting; layers; user interfaces; kernel; processes and threads; clone(); scheduler; interprocess communication; memory management; address space; page tables; file system; ext3; executable files; directories; file locking; I/O; networking; TCP/IP; NFS mounting; security

Example fork+exec: exec.c
May 7 Slides: Case study: Windows 8.1; Microsoft OS eras; Modern Windows; MinWin; programming layers; programming Windows; NT subsystem components; kernel-mode objects; native NT API; Win32 API; WOW; Windows vs. Unix; registry; kernel-mode organization; dispatcher objects; executive layer; hardware abstraction layer; device stacks; object management; object handles; object procedures and directories; creating and opening a file; executive object types; processes and threads; thread priorities; memory management; page faults; I/O API calls; device driver stacking; file system; NTFS clusters; file system logging and recovery; security├č
May 12 Slides: Android; design goals; architecture; Dalvik; application framework; package manager; binder IPC; application process launching; process lifecycle; postmortem reports; final exam schedule; review for the final

Course description

Fundamentals: Contiguous and non-contiguous memory management; processor scheduling and interrupts; concurrent, mutually exclusive, synchronized and deadlocked processes; files. Substantial programming project required.

There will be systems programming assignments in both C and Java. (C programming will be at an elementary level that shouldn't be a problem for Java programmers.)


CS 146 or SE 146 Data Structures and Algorithms grade C- or better
Department policy is to enforce
all course prerequisites strictly.

Required textbook

Modern Operating Systems (4th Edition)
Andrew S. Tanenbaum and Herbert Bos
Pearson, 2014
ISBN: 978-0133591620

Software to install

VirtualBox 4.3.20
Install the Windows or Mac version.
Debian 7.8.0 ISO file for the Intel architecture
Download "small installation image" which is a .iso file.
Use the file to install Debian as a virtual machine under VirtualBox.

Note: A fast Internet connection is recommended!
The installation process takes a while and downloads many files.

Debian installation screenshots, courtesy of Prof. Teng Moh

YouTube videos of an Ubuntu installation, courtesy of Duy Nguyen.
Part 2 is about installing guest additions.