Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Virtual Memory and File Systems in Operating Systems: Lecture 20 - Prof. John Glick, Study Guides, Projects, Research of Operating Systems

A part of the lecture notes for comp 310: operating systems, specifically lecture 20. The lecture covers the implementation of virtual memory in nachos and the basics of file management. Topics include understanding how to implement vm in nachos, properties of physical disks, the file system abstraction, disk structure, disk performance, and disk scheduling. Announcements include office hours and project time.

Typology: Study Guides, Projects, Research

Pre 2010

Uploaded on 08/16/2009

koofers-user-son-1
koofers-user-son-1 🇺🇸

10 documents

1 / 18

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
COMP 310:
Operating Systems
Lecture 20:
Virtual Memory in Nachos
and Begin File Systems
October 20, 2004
Christine Alvarado
Today’s goals
Understand how to implement (or start
implementing) VM in Nachos
Understand basics of file management
Properties of physical disks
The file system abstraction
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12

Partial preview of the text

Download Virtual Memory and File Systems in Operating Systems: Lecture 20 - Prof. John Glick and more Study Guides, Projects, Research Operating Systems in PDF only on Docsity!

COMP 310:

Operating Systems

Lecture 20:

Virtual Memory in Nachos

and Begin File Systems

October 20, 2004

Christine Alvarado

Today’s goals

 Understand how to implement (or start

implementing) VM in Nachos

 Understand basics of file management

 Properties of physical disks

 The file system abstraction

Announcements  I will be gone Thursday through next Wednesday  Office hours next week moved:

 Wednesday 2:30-4:30 (as usual)

 Thursday 2-4pm

 Friday 10-11am

 Friday: Dr. Glick—project time!  Monday: Dr. Jiang—More on filesystems Before we get back to the worksheet…

 VM Review: How many Virtual Address Spaces are there?

OS (Course) Components Programs: Processes, Threads, Synchronization I/O: Hardware, Interrupts, Direct Memory Access Memory/Disk: Virtual Memory, Paging, Naming Distributed Systems , Security

Up-to-the-minute research File Systems: Goals  File systems are yet another abstraction that the OS provides to programs  Disks are messy physical devices

 Errors, bad blocks, missed seeks, etc.

 All this should be hidden from the higher level software

Disk Structure Disk Interaction Is Complicated  Specifying a disk request requires a lot of detailed information

 If you want to specify a place on a disk, what do

you have to know?

 Modern disks are even worse…

Disk Scheduling—when is it worth it?  Disk scheduling doesn’t have much impact unless there are request queues (i.e. lots of processes that want to access the disk at once)

 In what kind of system is this worth it?

 Modern disks often do scheduling themselves

 The disk knows the layout better than the OS

File Systems: Abstraction for accessing data on disk  We have already seen one way that disk is used. What was it?  Why not do everything this way?

File Systems  The file system is the ABSTRACTION the OS provides for the data on the disk  File systems:

 Organize files logically

 Permit sharing of data between processes,

people and machines

 Protect data from unwanted access

 Just like VM did for PM!

Files  A file is data with some properties  A file can also have a type

 Understood by file system

 Understood by other parts of the OS

 Executable, dll, source, text, etc…

 Where is file’s type encoded?

 Windows?

 UNIX?

size Data

name owner protection last read/write etc

How do we oraganize files?

 Directories!

 Directories have two purposes:

 For users—organize files  For system—naming interface (why not just store everything in one directory?)

 How are directories organized?

 Most file systems support notion of a current

directory

 Two ways to refer to a given file… Implementing Directories  A directory is a list of entries

 <name, location>

 Name is the name of the file or directory

 Location is where it is on disk

 List is usually unordered

 Who sorts this list?

 Where are directories (lists) stored?

Tree-Structured directories

root code bin classes

nachos java find reorder COMP

PSs

PS1 PS

threads userprog

synch.h sych.cc subdir

subdir

Acyclic Graph Structure

root code bin classes

nachos java find reorder COMP

code PSs

PS1 PS

threads userprog

synch.h sych.cc subdir

subdir

Accessing Directories

 How does OS access the directory /one/two/three?

 Open directory /  Where does OS find this directory?  Look for “one” in this directory go to location of “one”  Open directory “one”, get location of “two”  Open directory “two”, get location of “three”  Open file “three”

 Systems spend a lot of time walking paths

 This is why open != read/write  OS can cache prefixes for performance File Sharing  What kind of directory structure is needed?  Key issues:

Concurrent Access (reading/writing, two reading)

Protection

Protection  File systems implement some kind of protection system

 Who can access

 How can they access

 A protection system dictates whether an action (read/write/execute) performed by a process/thread/user on a file should be allowed

 Where have you seen this recently?

Representing Protection Dr. Alvarado rx rx r OSStudent2 rwx rwx rw OSStudent1 rwx rwx rw /code /threads /synch.cc

Disk Layout Strategies

Disk

File

Unix Inodes  Unix inodes implement an indexed structure for files  Also store metadata info (what is this meta-data?)  Each inode contains 15 block pointer  First 12 are direct blocks (e.g. 4KB blocks)  Then single, double and triple indexed prot, time, length, etc meta data 0 1 2 13 14

15 triple index

Unix Inodes and Path Search

 Unix Inodes are NOT directories

 Inodes describe where on disk the blocks for a file

are placed

 Directories are files, so inodes also describe where they are placed

 Directory entries map file names to inodes

 To open /one user Master Block to find inode for /  Open /, look for entry for one  Read the inode for one into memory  The inode says where first data block is on disk  Read that block into memory to read file… Read Ahead  Many File Systems implement “read ahead”

 FS predicts that process will keep reading in file

 FS requests next block before it is accessed

 When is this an advantage?