









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
The course material and objectives for the TCSS 422: Operating Systems course offered in the Spring 2020 semester at the University of Washington - Tacoma. information on the topics covered in the course, such as cache replacement policies, I/O devices, and hard disk drives. It also provides details on assignments, quizzes, and exams, as well as feedback from previous class sessions. intended for students enrolled in the course or those interested in learning about operating systems.
Typology: Lecture notes
1 / 16
This page cannot be seen from the preview
Don't miss anything!
June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma Beyond Physical Memory, I/O Devices, HDDs
University of Washington - Tacoma TCSS 422: OPERATING SYSTEMS Andrew Oberhardt Senior Software Engineer, Axon Company Alumni Virginia Tech Previously: Software Engineer at Microsoft (10+ years), Code.org, and Amazon Axon Company
GUEST SPEAKER, Q&A June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18. Questions from 5/ Tutorial 2 (pthreads, locks, conditions) – due Thurs June 4 Quiz 3 posted – Active Reading Ch. 19 – due Tues June 2 Assignment 3 – on Linux kernel programming – of fered in “tutorial” format – due Sat June 13 Quiz 4 – Page Tables Practice Final Exam Questions – Thursday – 2nd^ hour Chapter 22: Cache Replacement Policies: Workl oad E x a mple s Chapter 36: I/O Devices Polling vs. Interrupts, Programmed I/O, Direct Memory Access Chatper 37: Hard Disk Drives June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Please classify your perspective on material covered in today’s class (38 respondents): 1-mostly review, 5-equal new/review, 10-mostly new Average – 7.3 ( from 6.62) Please rate the pace of today’s class: 1-slow, 5-just right, 10-fast Average – 5.83 ( from 5.84) June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Questions from 5/ Tutorial 2 (pthreads, locks, conditions) – due Thurs June 4 Quiz 3 posted – Active Reading Ch. 19 – due Tues June 2 Assignment 3 – on Linux kernel programming – of fered in “tutorial” format – due Sat June 13 Quiz 4 – Page Tables Practice Final Exam Questions – Thursday – 2nd^ hour Chapter 22: Cache Replacement Policies: Wo rkl oad E x a mple s Chapter 36: I/O Devices Polling vs. Interrupts, Programmed I/O, Direct Memory Access Chatper 37: Hard Disk Drives June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Questions from 5/ Tutorial 2 (pthreads, locks, conditions) – due Thurs June 4 Quiz 3 posted – Active Reading Ch. 19 – due Tues June 2 Assignment 3 – on Linux kernel programming – of fered in “tutorial” format – due Sat June 13 Quiz 4 – Page Tables Practice Final Exam Questions – Thursday – 2nd^ hour Chapter 22: Cache Replacement Policies: Workl oad E x a mple s Chapter 36: I/O Devices Polling vs. Interrupts, Programmed I/O, Direct Memory Access Chatper 37: Hard Disk Drives June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Questions from 5/ Tutorial 2 (pthreads, locks, conditions) – due Thurs June 4 Quiz 3 posted – Active Reading Ch. 19 – due Tues June 2 Assignment 3 – on Linux kernel programming – of fered in “tutorial” format – due Sat June 13 Quiz 4 – Page Tables Practice Final Exam Questions – Thursday – 2nd^ hour Chapter 22: Cache Replacement Policies: Wo rkl oad E x a mple s Chapter 36: I/O Devices Polling vs. Interrupts, Programmed I/O, Direct Memory Access Chatper 37: Hard Disk Drives June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Questions from 5/ Tutorial 2 (pthreads, locks, conditions) – due Thurs June 4 Quiz 3 posted – Active Reading Ch. 19 – due Tues June 2 Assignment 3 – on Linux kernel programming – of fered in “tutorial” format – due Sat June 13 Quiz 4 – Page Tables Practice Final Exam Questions – Thursday – 2nd^ hour Chapter 22: Cache Replacement Policies: Workl oad E x a mple s Chapter 36: I/O Devices Polling vs. Interrupts, Programmed I/O, Direct Memory Access Chatper 37: Hard Disk Drives June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Questions from 5/ Tutorial 2 (pthreads, locks, conditions) – due Thurs June 4 Quiz 3 posted – Active Reading Ch. 19 – due Tues June 2 Assignment 3 – on Linux kernel programming – of fered in “tutorial” format – due Sat June 13 Quiz 4 – Page Tables Practice Final Exam Questions – Thursday – 2nd^ hour Chapter 22: Cache Replacement Policies: Wo rkl oad E x a mple s Chapter 36: I/O Devices Polling vs. Interrupts, Programmed I/O, Direct Memory Access Chatper 37: Hard Disk Drives June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
CHAPTER 21/22: BEYOND PHYSICAL MEMORY June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18. Questions from 5/ Tutorial 2 (pthreads, locks, conditions) – due Thurs June 4 Quiz 3 posted – Active Reading Ch. 19 – due Tues June 2 Assignment 3 – on Linux kernel programming – of fered in “tutorial” format – due Sat June 13 Quiz 4 – Page Tables Practice Final Exam Questions – Thursday – 2nd^ hour Chapter 22: Cache Replacement Policies: Wo rkl oad E x a mple s Chapter 36: I/O Devices Polling vs. Interrupts, Programmed I/O, Direct Memory Access Chatper 37: Hard Disk Drives June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
No-Locality (Random Access) Workload Perform 10,000 random page accesses Across set of 100 memory pages June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
When the cache is large enough to fit the entire workload, it doesn’t matter which policy you use. 80/20 Workload Perform 10,000 page accesses, against set of 100 pages 80% of accesses are to 20% of pages (hot pages) 20% of accesses are to 80% of pages (cold pages) June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
LRU is more likely to hold onto hot pages (recalls history) Looping sequential workload Refer to 50 pages in sequence: 0, 1, …, 49 Repeat loop June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Random performs better than FIFO and LRU for cache sizes < 50 Algorithms should provide “scan resistance” June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.2 3 Implementing last recently used (LRU) requires tracking access time for all system memory pages Times can be tracked with a list For cache eviction, we must scan an entire list Consider: 4GB memory system (2^32 ), with 4KB pages (2^12 ) This requires 2^20 comparisons !!! Simplification is needed Consider how to approximate the oldest page access June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
IF USE_BIT=1 set to USE_BIT = 0 IF USE_BIT=0 replace page June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Not as efficient as LRU, but better than other replacement algorithms that do not consider history June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
On demand demand paging Prefetching Preload pages based on anticipated demand Prediction based on locality Access page P, suggest page P+1 may be used
Prediction models, historical analysis In general: accuracy vs. effort tradeoff High analysis techniques struggle to respond in real time June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Consider an arbitrary canonical “standard/generic” device Two primary components Interface (registers for communication) Internals: Local CPU, memory, specific chips, firmware (embedded software) June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Status register Maintains current device status Command register Where commands for interaction are sent Data register Used to send and receive data to the device June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
General concept: The OS interacts and controls device behavior by reading and writing the device registers. Common example of device interaction June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Poll- Is device available? Poll – Is device done? Command parameterization Send command OS checks if device is READY by repeatedly checking the STATUS register Simple approach CPU cycles are wasted without doing meaningful work Ok if only a few cycles, for rapid devices that are often READY BUT polling, as with “spin locks” we understand is inefficient June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
For longer waits, put process waiting on I/O to sleep Context switch (C/S) to another process When I/O completes, fire an interrupt to initiate C/S back Advantage: better multi-tasking and CPU utilization Avoids: unproductive CPU cycles (polling) June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Interrupts are not always the best solution How long does the device I/O require? What is the cost of context switching? June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
If device I/O is fast polling is better. When I/O time < 1 CPU time slice (e.g. 10 ms) If device I/O is slow interrupts are better. When I/O time > 1 CPU time slice What is the tradeoff space?
Alternative: two-phase hybrid approach Initially poll, then sleep and use interrupts Issue: livelock problem Common with network I/O Many arriving packets generate many many interrupts Overloads the CPU! No time to execute code, just interrupt handlers! Livelock optimization Coalesce multiple arriving packets (for different processes) into fewer interrupts Must consider number of interrupts a device could generate June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
TCSS 422 WILL RETURN AT ~2:45PM June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L15.
June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma From https://en.wikipedia.org/wiki/Parallel_ATA I/O performed on the CPU CPU time is consumed performing I/O CPU supports data movement (input/output) PIO is slow: CPU is occupied with meaningless work June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Legacy serial ports Legacy parallel ports PS/2 keyboard and mouse Legacy MIDI, joysticks Old network interfaces June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Layers of I/O abstraction in Linux C functions (open, read, write) issue block read and w rite requests to the generic block layer June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Too much abstraction Many devices provide special capabilities Example: SCSI Error handling SCSI devices provide extra details which are lost to the OS Buggy device drivers 70% of OS code is in device drivers Device drivers are required for every device plugged in Drivers are often 3rd^ party, which is not quality controlled at the same level as the OS (Linux, Windows, MacOS, etc.) June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
CH. 37: HARD DISK DRIVES June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18. Questions from 5/ Tutorial 2 (pthreads, locks, conditions) – due Thurs June 4 Quiz 3 posted – Active Reading Ch. 19 – due Tues June 2 Assignment 3 – on Linux kernel programming – of fered in “tutorial” format – due Sat June 13 Quiz 4 – Page Tables Practice Final Exam Questions – Thursday – 2nd^ hour Chapter 22: Cache Replacement Policies: Wo rkl oad E x a mple s Chapter 36: I/O Devices Polling vs. Interrupts, Programmed I/O, Direct Memory Access Chatper 37: Hard Disk Drives June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Chapter 37 HDD Internals Seek time Rotational latency Transfer speed Capacity Scheduling algorithms June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Primary means of data storage (persistence) for decades Remains inexpensive for high capacity storage 2020: 16 TB HDD - $400, ~15.3 TB SSD - $4, Consists of a large number of data sectors Sector size is 512-bytes An n sector HDD can be is addressed as an array of 0..n-1 sectors June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Writing disk sectors is atomic (512 bytes) Sector writes are completely successful, or fail Many file systems will read/write 4KB at a time Linux ext3/4 default filesystem blocksize – 4096
June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Formats disk w/ ext4 filesys with specified byte-to-inode ratio Today’s disks are so large, some use cases with many small files can run out of inodes before running out of disk space Each inode record tracks a file on the disk Larger bytes-per-inode ratio results in fewer inodes Default is around ~ Value shouldn't be smaller than blocksize of filesystem Note: It is not possible to expand the number of inodes after the filesystem is created, - be careful deciding the value Check inode stats: tune2fs –l /dev/sda1 ( d isk dev na m e) June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Host ~2,000,000 small XML files totaling 9.5 GB on a ~20GB filesystem on a cloud-based Virtual Machine With default inode ratio (4096 block size), only ~488,000 files will fit Drive less than half full, but files will not fit! HDDs support a minimum block size of 512 bytes OS filesystems such as ext3/ext4 can support “finer grained” management at the expense of a larger catalog size Small inode ratio- inodes will considerable % of disk space June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Device total size bytes- used bytes- free usage /dev/vda2 13315844 9556412 3049188 76% /mnt
Device total inodes used free usage /dev/vda2 3552528 1999823 1552705 57% /mnt June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Torn write When OS uses larger block size than HDD Block writes not atomic - they SPAN multiple HDD sectors Upon power failure only a portion of the OS block is written – can lead to data corruption… HDD access Sequential reads of sectors is fastest Random sector reads are slow Disk head continuously must jump to different tracks June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Made from aluminum coated with thin magnetic layer HDD records on both sides of each platter Data is stored by inducing magnetic changes
Acceleration coasting deceleration settling Acceleration: the arm gets moving Coasting: arm moving at full speed Deceleration: arm slow down Settling: Head is carefully positioned over track Settling time is often high, from .5 to 2ms June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Sectors are offset across tracks to allow time for head to reposition for sequential reads Without track skew, when head is repositioned sector would have already been passed June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Buffer to support caching reads and writes Improves drive response time Up to 256 MB, slowly have been growing Two styles Writeback cache Report write complete immediately when data is transferred to HDD cache Dangerous if power is lost Writethrough cache Reports write complete only when write is physically completed on disk June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Can calculate I/O transfer speed with: I/O Time: Ttransfer = DATAsize x RateI/O Rate of I/O: June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Compare two disks:
Calculate Trotation from rpm (rpmrps, time for 1 rotation / 2) June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
There is a huge gap in drive throughput between random and sequential workloads Ttransfer = Datasize x RateI/O 4 KB 100 MB See sample HDD configurations here: Up to 20 TB https://www.westerndigital.com/products/data-center- drives#hard-disk-hdd June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Disk scheduler: determine how to order I/O requests Multiple levels - OS and HW OS: provides ordering HW: further optimizes using intricate details of physical HDD implementation and state June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Disk scheduling – which I/O request to schedule next Shortest Seek Time First (SSTF) Order queue of I/O requests by nearest track June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.
Problem 1: HDD abstraction Drive geometry not available to OS. Nearest-block-first is a comparable alternate algorithm. Problem 2: Starvation Steady stream of requests for local tracks may prevent arm from traversing to other side of platter June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.