0% found this document useful (0 votes)
32 views30 pages

SIT102 Lecture 8.1

Notes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views30 pages

SIT102 Lecture 8.1

Notes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 30

Lecture 8

File-System
Contents
O File Concept
O Access Methods
O Disk and Directory Structure
O File-System Mounting
O File Sharing
O Protection
Objectives
O To explain the function of file systems
O To describe the interfaces to file systems
O To discuss file-system design tradeoffs,
including access methods, file sharing,
file locking, and directory structures
O To explore file-system protection
Overview of Mass
Storage Structure
O Magnetic disks provide bulk of secondary
storage of modern computers
O Drives rotate at 60 to 250 times per second
O Transfer rate is rate at which data flow between drive
and computer
O Positioning time (random-access time) is time to move
disk arm to desired cylinder (seek time) and time for desired
sector to rotate under the disk head (rotational latency)
O Head crash results from disk head making contact with the
disk surface -- That’s bad
O Disks can be removable
O Drive attached to computer via I/O bus
O Busses vary, including EIDE, ATA, SATA, USB, Fibre
Channel, SCSI, SAS, Firewire
O Host controller in computer uses bus to talk to disk
controller
built into drive or storage array
Solid-State Disks
O Nonvolatile memory used like a hard drive
O Many technology variations
O Can be more reliable than HDDs
O More expensive per MB
O Maybe have shorter life span
O Less capacity
O But much faster
O Busses can be too slow -> connect directly to
PCI for example
O No moving parts, so no seek time or rotational
latency
Magnetic Tape
O Was early secondary-storage medium
O Evolved from open spools to cartridges
O Relatively permanent and holds large quantities of data
O Access time slow
O Random access ~1000 times slower than disk
O Mainly used for backup, storage of infrequently-used data,
transfer medium between systems
O Kept in spool and wound or rewound past read-write
head
O Once data under head, transfer rates comparable to disk
O 140MB/sec and greater
O 200GB to 1.5TB typical storage
O Common technologies are LTO-{3,4,5} and T10000
7

Big picture: performance gap


8

What problem are we


solving?
OData storage & access
O Super important
O One of the fastest growing
industry
O Why?
O Driven by technology

1956, IBM, 24 inches, 3.75MB,


1KB/sec, > $150,000

2015, Seagate, 3.5 inches, 5TB,


6Gb/sec, < $200
9

Disks and the


OS
O Disks are messy physical devices
O Errors, bad blocks, missed seeks, etc.
O The job of the OS is to hide this mess
from higher level software
O Low-level device control (initiate a
disk read, etc.)
O Higher-level abstractions (files, databases,
etc.)
10

How hard disk work?


O http://www.youtube.com/watch?v=kdmLvl1n
82U
O https://youtu.be/9eMWG3fwiEU?t=11
O Disk components
O Platters O
Surfaces O
Tracks
O Cylinders O
Sectors O
Arm
O Heads
11

Another View of Disk


12

Disk Interaction
O Specifying disk requests requires a lot of info:
O Cylinder #, surface #, sector #, transfer size…
O Older disks required the OS to specify all of this
O The OS needed to know all disk parameters
O Modern disks are more complicated
O Not all sectors are the same size, sectors are
remapped, etc.
O Current disks provide a higher-level interface (SCSI)
O The disk exports its data as a logical array of
blocks [0…N]
O Disk maps logical blocks to
cylinder/surface/track/sector
O Only need to specify the logical block # to
read/write
O But now the disk parameters are hidden from
the OS
13

Disk Performance
O Ra ndom disk access is Access data
sequentially: only suffer
SLOW!
Data
one seek and
rotational delay

delay
Seek Random disk
access: suffers
one seek and
rotational delay
every time!
14

Disk Performance
O Disk request performance depends upon three steps
O Seek – moving the disk arm to the correct cylinder
O Depends on how fast disk arm can move (increasing
very slowly)
O Rotation – waiting for the sector to rotate under
the head
O Depends on rotation rate of disk (increasing, but
slowly)
O Transfer – transferring data from surface into disk
controller electronics, sending it back to the
host O Depends on density (increasing quickly)
O When the OS uses the disk, it tries to minimize the
cost of all of these steps
O Particularly seeks and rotation
15

Disks: 2016
O Seagate Cheetah 3.5" (server)
O capacity: 300 - 600 GB
O rotational speed: 15,000 RPM
O sequential read performance: 122 MB/s - 204 MB/s
O seek time (average): 3.4 ms
O Seagate Barracuda 3.5" (desktop)
O capacity: 250 GB – 4TB
O rotational speed: 7,200 RPM
O sequential read performance: 125 MB/s - 146 MB/s
O seek time (average): 8.5 ms
16

Disk Scheduling
O Because seeks are so expensive (milliseconds!),
the OS tries to schedule disk requests that are
queued waiting for the disk
O FCFS (do nothing)
O Reasonable when load is low
O Long waiting times for long request queues
O SSTF (shortest seek time first)
O Minimize arm movement (seek time), maximize
request rate
O Favors middle blocks
O SCAN (elevator)
O Service requests in one direction until done, then reverse
O C-SCAN
O Like SCAN, but only go in one direction (typewriter)
Disk Attachment
O Host-attached storage accessed through I/O
ports talking to I/O busses
O SCSI itself is a bus, up to 16 devices on one
cable, SCSI initiator requests operation and
SCSI targets perform tasks
O Each target can have up to 8 logical units
(disks attached to device controller)
O FC is high-speed serial architecture
O Can be switched fabric with 24-bit address
space – the basis of storage area networks
(SANs) in which many hosts attach to many
storage units
O I/O directed to bus ID, device ID, logical unit
(LUN)
Disk Management
O Low-level formatting, or physical formatting — Dividing a
disk into sectors that the disk controller can read and write
O Each sector can hold header information, plus data, plus
error correction code (ECC)
O Usually 512 bytes of data but can be selectable
O To use a disk to hold files, the operating system still needs to
record its own data structures on the disk
O Partition the disk into one or more groups of cylinders,
each treated as a logical disk
O Logical formatting or “making a file system”
O To increase efficiency most file systems group blocks
into clusters
O Disk I/O done in blocks
O File I/O done in clusters
Disk Management (Cont.)
O Raw disk access for apps that want to do
their own block management, keep OS out
of the way (databases for example)
O Boot block initializes system
O The bootstrap is stored in ROM
O Bootstrap loader program stored in boot
blocks of boot partition
O Methods such as sector sparing
used to handle bad blocks
Booting from a Disk
in Windows
Data Structures for Swapping
on Linux Systems
RAID Structure
O RAID – redundant array of inexpensive disks
O multiple disk drives provides reliability via redundancy
O Increases the mean time to failure
O Mean time to repair – exposure time when another
failure could cause data loss
O Mean time to data loss based on above factors
O If mirrored disks fail independently, consider disk with
1300,000 mean time to failure and 10 hour mean time to
repair
O Mean time to data loss is 100, 0002 / (2 ∗ 10) = 500 ∗
106 hours, or 57,000 years!
O Frequently combined with NVRAM to improve
write performance
O Several improvements in disk-use techniques involve the use
of multiple disks working cooperatively
RAID (Cont.)
O Disk striping uses a group of disks as one storage unit
O RAID is arranged into six different levels
O RAID schemes improve performance and improve the
reliability of the storage system by storing redundant data
O Mirroring or shadowing (RAID 1) keeps duplicate of
each disk
O Striped mirrors (RAID 1+0) or mirrored stripes (RAID
0+1) provides high performance and high reliability
O Block interleaved parity (RAID 4, 5, 6) uses
much less redundancy
O RAID within a storage array can still fail if the array fails, so
automatic replication of the data between arrays is
common
O Frequently, a small number of hot-spare disks are left
unallocated, automatically replacing a failed disk and
having data rebuilt onto them
RAID Levels
RAID (0 + 1) and (1 + 0)
File Concept
O Contiguous logical address space
O Types:
O Data
O numeric
O character
O binary
O Program
O Contents
defined by
file’s creator
O Many
types
O Consider
text file,
source file,
File Attributes
O Name – only information kept in human-readable form
O Identifier – unique tag (number) identifies file within file system
O Type – needed for systems that support different types
O Location – pointer to file location on device
O Size – current file size
O Protection – controls who can do reading, writing, executing
O Time, date, and user identification – data for protection,
security, and usage monitoring
O Information about files are kept in the directory structure, which
is maintained on the disk
O Many variations, including extended file attributes such as
file checksum
O Information kept in the directory structure
File info MS Window 10
File Operations
O File is an abstract data type
O Create
O Write – at write pointer location
O Read – at read pointer
location O Reposition within file -
seek
O Delete
O Truncate
O Open(Fi) – search the directory structure on
disk for entry Fi, and move the content of
entry to memory
O Close (Fi) – move the content of entry Fi in
memory to directory structure on disk

You might also like