Docsity

TCSS 422: Operating Systems Course Material and Objectives, Lecture notes of Operating Systems

Toggle sidebar
bg1
TCSS 422 B – Spring 2020
School of Engineering and Technology
6/2/2020
L18.1
Slides by Wes J. Lloyd
June 2, 2020 TCSS422: Operating Systems [Spring 2020]
School of Engineering and Technology, University of Washington - Tacoma
Beyond Physic al Memory,
I/O Devices, HDDs
Wes J. Ll oyd
Sc hoo l of Engi neer ing and T ech nolo gy
Univer sity of Wash ingto n - Taco ma
TCSS 422: OPERATING SYSTEMS
And rew O ber har dt
Senior Soft war e Enginee r,
Axo n C omp any
Alu mni V irgin ia Te ch
Previousl y:
Software Engineer at
Mic ros oft (10 + ye ars),
Cod e.org, a nd Amaz on
Axo n C omp any
ht tps :// www. axo n.c om/ co mpa ny
Op en po siti ons, hir ing
GUE ST
SPE AKE R,
Q& A
June 2, 2020 TCSS422: Operating Systems [Spring 2020]
School of Engineering and Technology, University of Washington - Tacoma L18.2
Qu esti ons f rom 5/2 8
Tut oria l 2 (pth rea ds, l ock s, co ndi tion s) – d ue T hur s Ju ne 4
Qu iz 3 pos ted – Ac tive Rea ding Ch. 19 – du e Tue s Ju ne 2
As sign ment 3 – o n Li nux ker nel p rog ramm ing –
of fer ed in “t utor ial” for mat – du e Sa t Ju ne 1 3
Qu iz 4 – P ag e Tab les
Pr acti ce F inal E xam Que stio ns – T hur sday – 2
nd
ho ur
Ch apte r 22 : Ca che R epl acem ent Poli cie s:
Wo rkl oad Ex amp le s
Ch apte r 36 : I/ O De vice s
Pol ling v s. In terrup ts, Pr ogram med I/ O, Di rect M emory Acce ss
Ch atpe r 37: Har d Di sk D rive s
June 2, 2020
TCSS422: Operating Systems [Spring 2020]
School of Engineering and Technology, University of Washington - Tacoma
L18.3
OB JECTI VES – 6/2
Ple ase clas sif y you r p ers pect ive o n ma teri al c over ed i n
tod ay’s cla ss ( 38 r esp onde nts) :
1- most ly r eview , 5- equ al ne w/re view , 10 -mos tly new
Av erag e – 7. 3 (f rom 6.6 2)
Ple ase rat e th e pa ce o f tod ay’ s cla ss:
1- slow, 5-j ust righ t, 1 0-f ast
Av erag e – 5 .83 (fr om 5 .84 )
June 2, 2020
TCSS422: Operating Systems [Spring 2020]
School of Engineering and Technology, University of Washington - Tacoma
L18.4
MATERIAL / PACE
June 2, 2020
TCSS422: Operating Systems [Spring 2020]
School of Engineering and Technology, University of Washington - Tacoma
L18.5
FE EDBAC K FROM 5/28
Qu esti ons f rom 5/2 8
Tut oria l 2 (pth rea ds, l ock s, co ndi tion s) – d ue T hur s Ju ne 4
Qu iz 3 pos ted – Ac tive Rea ding Ch. 19 – du e Tue s Ju ne 2
As sign ment 3 – o n Li nux ker nel p rog ramm ing –
of fer ed in “t utor ial” for mat – du e Sa t Ju ne 1 3
Qu iz 4 – P ag e Tab les
Pr acti ce F inal E xam Que stio ns – T hur sday – 2
nd
ho ur
Ch apte r 22 : Ca che R epl acem ent Poli cie s:
Wo rkl oad Ex amp le s
Ch apte r 36 : I/ O De vice s
Pol ling v s. In terrup ts, Pr ogram med I/ O, Di rect M emory Acce ss
Ch atpe r 37: Har d Di sk D rive s
June 2, 2020
TCSS422: Operating Systems [Spring 2020]
School of Engineering and Technology, University of Washington - Tacoma
L18.6
OB JECTI VES – 6/2
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download TCSS 422: Operating Systems Course Material and Objectives and more Lecture notes Operating Systems in PDF only on Docsity!

School of Engineering and Technology

June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma Beyond Physical Memory, I/O Devices, HDDs

Wes J. Lloyd

School of Engineering and Technology

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

 https://www.axon.com/company

 Open positions, hiring

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.

OBJECTIVES – 6/

 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.

MATERIAL / PACE

 June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.

FEEDBACK FROM 5/

 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.

OBJECTIVES – 6/

School of Engineering and Technology

 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.

OBJECTIVES – 6/

 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.

OBJECTIVES – 6/

 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.

OBJECTIVES – 6/

 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.

OBJECTIVES – 6/

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.

OBJECTIVES – 6/

School of Engineering and Technology

 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.

WORKLOAD EXAMPLES: NO-LOCALITY

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.

WORKLOAD EXAMPLES: 80/

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.

WORKLOAD EXAMPLES: SEQUENTIAL

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.

IMPLEMENTING LRU

School of Engineering and Technology

 Harness the Page Table Entry (PTE) Use Bit

 HW sets to 1 when page is used

 OS sets to 0

 Clock algorithm (approximate LRU)

 Refer to pages in a circular list

 Clock hand points to current page

 Loops around

 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.

IMPLEMENTING LRU - 2

 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.

CLOCK ALGORITHM

 Consider dirty pages in cache

 If DIRT Y (modified) bit is FALSE

 No cost to evict page from cache

 If DIRT Y (modified) bit is TRUE

 Cache eviction requires updating memory

 Contents have changed

 Clock algorithm should favor no cost eviction

June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.

CLOCK ALGORITHM - 2

 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

 What other techniques might help anticipate required

memory pages?

 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.

WHEN TO LOAD PAGES

 Page swaps / writes

 Group/cluster pages together

 Collect pending writes, perform as batch

 Grouping disk writes helps amortize latency costs

 Thrashing

 Occurs when system runs many memory intensive

processes and is low in memory

 Everything is constantly swapped to-and-from disk

June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.

OTHER SWAPPING POLICIES

 Working sets

 Groups of related processes

 When thrashing: prevent one or more working

set(s) from running

 Temporarily reduces memory burden

 Allows some processes to run, reduces thrashing

June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.

OTHER SWAPPING POLICIES - 2

School of Engineering and Technology

 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.

CANONICAL DEVICE

 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.

CANONICAL DEVICE:

HARDWARE INTERFACE

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.

OS DEVICE INTERACTION

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.

POLLING

 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 VS POLLING

 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.

INTERRUPTS VS POLLING - 2

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?

School of Engineering and Technology

 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.

INTERRUPTS VS POLLING - 3

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.

 To interact with a device we must send/receive

DATA

 There are two general approaches:

 Programmed I/O (PIO):

 Port mapped I/O (PMIO)

 Memory mapped I/O (MMIO)

 Direct memory access (DMA)

June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.

DEVICE I/O

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.

PROGRAMMED I/O (PIO)

PIO

 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.

PIO DEVICES

School of Engineering and Technology

 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.

FILE SYSTEM ABSTRACTION

 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.

FILE SYSTEM ABSTRACTION ISSUES

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.

OBJECTIVES – 6/

 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.

OBJECTIVES

 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.

HARD DISK DRIVE (HDD)

School of Engineering and Technology

 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

 Same as typical memory page size

June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.

HDD INTERFACE

 mkefs.ext4 -i <bytes-per-inode>

 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.

BLOCK SIZE IN LINUX EXT

 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.

EXAMPLE: USDA SOIL EROSION MODEL

WEB SERVICE (RUSLE2)

 Free space in bytes (df)

Device total size bytes- used bytes- free usage /dev/vda2 13315844 9556412 3049188 76% /mnt

 Free inodes (df –i) @ 512 bytes / node

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.

EXAMPLE: USDA SOIL EROSION MODEL

WEB SERVICE (RUSLE2) - 2

 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.

HDD INTERFACE - 2

June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.

HDD PLATTER

 Made from aluminum coated with thin magnetic layer  HDD records on both sides of each platter  Data is stored by inducing magnetic changes

School of Engineering and Technology

 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.

FOUR PHASES OF SEEK

 Data transfer

 Final phase of I/O: time to read or write to disk

surface

 Complete I/O cycle:

1. Seek (accelerate, coast, decelerate, settle)

2. Wait on rotational latency (until track aligns)

3. Data transfer

June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.

HDD I/O

 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.

TRACK SKEW

June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.

TRACK SKEW - 2

 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.

HDD CACHE

 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.

TRANSFER SPEED

School of Engineering and Technology

 Compare two disks:

  1. Random workload: 4KB (random read on HDD)
  2. Sequential workload: 100MB (contiguous sectors)

    Calculate Trotation from rpm (rpmrps, time for 1 rotation / 2) June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.

EXAMPLE: I/O SPEED

  1. Random workload: 4KB (random read on HDD)
  2. Sequential workload: 100MB (contiguous sectors) June 2, 2020 TCSS422: Operating Systems [Spring 2020] School of Engineering and Technology, University of Washington - Tacoma L18.

EXAMPLE: I/O SPEED

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.

MODERN HDD SPECS

 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

 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.

SSTF – SHORTEST SEEK TIME FIRST

 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.

SSTF ISSUES

  • Slide
  • WJL1 Wes J. Lloyd, 5/30/