Paging Example Assume a page size of 1K and a 15-bit logical address space. How many pages are in the system?

Slides:



Advertisements
Similar presentations
Chapter 10: File-System Interface
Advertisements

1 Chapter 11: File-System Interface  File Concept  Access Methods  Directory Structure  File System Mounting  File Sharing  Protection  Chapter.
Chapter 10: File-System Interface
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 11: File-System Interface File Concept Access Methods Directory Structure.
Chapter 10: File-System Interface
File System Interface CSCI 444/544 Operating Systems Fall 2008.
Long-term Information Storage
Dr. Kalpakis CMSC 421, Operating Systems. Fall File-System Interface.
1 File Management (a). 2 File-System Interface  File Concept  Access Methods  Directory Structure  File System Mounting  File Sharing  Protection.
04/02/2004CSCI 315 Operating Systems Design1 File System Interface.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 10: File-System Interface.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition File-System Interface.
File Systems Topics –File –Directory –File System Implementation Reference: Chapter 5: File Systems Operating Systems Design and Implementation (Second.
04/05/2010CSCI 315 Operating Systems Design1 Virtual Memory Wrap-up; File System Interface.
File Systems. 2 Storing Information Applications can store it in the process address space Why is it a bad idea? –Size is limited to size of virtual address.
1 Operating Systems Chapter 7-File-System File Concept Access Methods Directory Structure Protection File-System Structure Allocation Methods Free-Space.
Chapter 10: File-System Interface
10.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Chapter 10: File-System Objectives To discuss file-system design tradeoffs, including.
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 10: File-System Interface File Concept.
1 Friday, July 07, 2006 “Vision without action is a daydream, Action without a vision is a nightmare.” - Japanese Proverb.
File Concept l Contiguous logical address space l Types: Data: numeric, character, binary Program: source, object (load image) Documents.
Os111 Chapter 11 File-System Interface. os112 Outline File Concept Access Methods Directory Structure File System Mounting File Sharing Protection.
7/15/2015B.RamamurthyPage 1 File System B. Ramamurthy.
File Concept §Contiguous logical address space §Types: l Data: Numeric Character Binary l Program.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 10: File-System Interface.
Chapter 10 File System Interface
1 File Systems Chapter Files 6.2 Directories 6.3 File system implementation 6.4 Example file systems.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 10 Operating Systems.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 10-1: File Systems Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 10: File-System Interface.
Silberschatz, Galvin and Gagne  Operating System Concepts File Concept Contiguous logical address space Smallest user allocation Non-volatile.
Chap 10 File-System Interface. Objectives To explain the function of file systems To describe the interfaces to file systems To discuss file-system design.
10.1 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 11: File-System Interface File Concept Access Methods Directory Structure File-System.
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Chapter 10: File-System.
Chapter 10: File-System Interface 10.1 Silberschatz, Galvin and Gagne ©2011 Operating System Concepts – 8 th Edition 2014.
File Systems CSCI What is a file? A file is information that is stored on disks or other external media.
File System Interface. File Concept Access Methods Directory Structure File-System Mounting File Sharing (skip)‏ File Protection.
Operating Systems (CS 340 D) Dr. Abeer Mahmoud Princess Nora University Faculty of Computer & Information Systems Computer science Department.
Page 110/19/2015 CSE 30341: Operating Systems Principles Chapter 10: File-System Interface  Objectives:  To explain the function of file systems  To.
File Systems (1). Readings r Reading: Disks, disk scheduling (3.7 of textbook; “How Stuff Works”) r Reading: File System Implementation ( of textbook)
File-System. Overview File system is the visible aspect of an OS. It provides mechanism for on-line storage of and access to both data and programs of.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 11: File-System Interface Modified.
10.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 10: File-System Interface.
Module 4.0: File Systems File is a contiguous logical address space.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 11: File-System Interface File Concept Access Methods Directory Structure.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 11: File-System Interface File Concept Access Methods Directory Structure.
Disk & File System Management Disk Allocation Free Space Management Directory Structure Naming Disk Scheduling Protection CSE 331 Operating Systems Design.
Why Do We Need Files? Must store large amounts of data. Information stored must survive the termination of the process using it - that is, be persistent.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Lecture 18: File-System Interface (Ch 10)
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 10: File-System Interface File Concept.
Silberschatz and Galvin  Operating System Concepts Module 10: File-System Interface File Concept Access :Methods Directory Structure Protection.
14.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 10 & 11: File-System Interface and Implementation.
It consists of two parts: collection of files – stores related data directory structure – organizes & provides information Some file systems may have.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 10: File-System Interface.
Operating Systems 1 K. Salah Module 4.0: File Systems  File is a contiguous logical address space (of related records)  Access Methods  Directory Structure.
Access Methods File store information When it is used it is accessed & read into memory Some systems provide only one access method IBM support many access.
Operating Systems Files, Directory and File Systems Operating Systems Files, Directory and File Systems.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 11: File-System Interface File Concept Access Methods Directory Structure.
Instructor: Umar KalimNUST Institute of Information Technology Operating Systems File System Interface.
W4118 Operating Systems Instructor: Junfeng Yang.
CSE Operating System Principles File Systems.
Lecture : chapter 9 and 10 file system 1. File Concept A file is a collection of related information defined by its creator. Contiguous logical address.
10.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Chapter 10: File-System 10.1 File Concept 10.2 Access Methods 10.3 Directory Structure.
Chapter 13: File-System Interface
Module 10: File-System Interface
Chapter 11: File-System Interface
Chapter 11: File-System Interface
Chapter 10: File-System Interface
Module 10: File-System Interface
Lecture 4: File-System Interface
Presentation transcript:

Paging Example Assume a page size of 1K and a 15-bit logical address space. How many pages are in the system?

Answer: 2^5 = 32. Assuming a 15-bit address space with 8 logical pages. How large are the pages?

Answer: 2^5 = 32. Assuming a 15-bit address space with 8 logical pages. How large are the pages? Answer: 2^12 = 4K. It takes 3 bits to reference 8 logical pages (2^3 = 8). This leaves 12 bits for the page size thus pages are 2^12.

Consider logical address 1025 and the following page table for some process P0. Assume a 15-bit address space with a page size of 1K. What is the physical address to which logical address 1025 will be mapped? 8 2

Consider logical address 1025 and the following page table for some process P0. Assume a 15-bit address space with a page size of 1K. What is the physical address to which logical address 1025 maps? Step 1. Convert to binary: 000010000000001 8 2

Consider logical address 1025 and the following page table for some process P0. Assume a 15-bit address space with a page size of 1K. What is the physical address to which logical address 1025 maps? Step2. Determine the logical page number: Since there are 5-bits allocated to the logical page, the address is broken up as follows: 00001 0000000001 Logical page number offset within page 8 2

Consider logical address 1025 and the following page table for some process P0. What is the physical address? Step 3. Use logical page number as an index into the page table. 00001 0000000001 8 2 00001

Consider logical address 1025 and the following page table for some process P0. What is the physical address? Take physical page number from the page table and concatenate the offset. So the physical address is byte 1. 000000000000001 8 2 00001

Long-term Information Storage Must store large amounts of data Information stored must survive the termination of the process using it Multiple processes must be able to access the information concurrently. In short:

Long-term Information Storage Files: Good!

Long-term Information Storage Files: Good! No Files: Bad!

File System Operating system determines how files are: Structured Named Accessed Used Protected Implemented Most important aspect to users is how files appear to them: naming convention, available operations, protection, etc. (Not implementation!!).

File Naming Unix: Windows: Case sensitive. Allows, but does not require, extensions (e.g., prog.c). Assigns no meaning to extensions. Add as many extensions as desired (e.g., prog.back.stupid.c). Does not allow spaces in name (unless “\ “) ; Windows: Not case sensitive. Allows 1-3 character extensions. Extensions have meaning (to other application codes, not to the OS) Allows spaces in file name.

Typical file extensions. File Naming Typical file extensions.

File Structure None - sequence of words, bytes Simple record structure Lines Fixed length Variable length Complex Structures Formatted document Relocatable load file

File Structure Three kinds of files byte sequence (i.e., no structure). record sequence Tree (e.g., data base)

File Structure Can simulate last two with first method by inserting appropriate control characters Who decides: Operating system Program (i.e., programs can support any model they want) Unix and Windows support only the sequence of bytes functionality.

File Types: Text and Binary An executable file (Unix)

File Access Sequential access Random access read all bytes/records from the beginning cannot jump around, could rewind or back up convenient when medium was mag tape Random access bytes/records read in any order essential for data base systems read can be … move file marker (seek), then read or … read and then move file marker

File Attributes Name – only information kept in human-readable form Identifier (file descriptor) – unique tag (number) identifies file within file system Type – needed for systems that support different types Location – pointer to file location on device Size – current file size

File Attributes Protection – controls who can do reading, writing, executing Time, date, and user identification – data for protection, security, and usage monitoring Information about files are kept in the directory structure, which is maintained on the disk (although generally cached).

File Operations Create Write Read Reposition within file Delete Truncate

File Operations in Unix int fd = open(Fi) – search the directory structure on disk for entry Fi, and move the content of entry to memory fd is a file descriptor (integer). close (fd) – move the content of entry Fi in memory to directory structure on disk seek() // change pointer to current location in file. read(fd, buf, num_bytes)

Open Files Several pieces of data are needed to manage open files: File pointer: pointer to last read/write location, per process that has the file open File-open count: counter of number of times a file is open – to allow removal of data from open-file table when last processes closes it Disk location of the file: cache of data access information Access rights: per-process access mode information

Open Files Unix maintains an open-file table for each process and for the whole system. File descriptor is used as an index into the process open-file table. Entries are items that have to do with that particular process (e.g., file pointer, access rights, etc.). A pointer to the system-wide open-file table is also in the process open-file table. System-wide open-file table holds process-independent information (e.g., location on disk, last access time, file size, count of the number of processes using the file).

Open File Locking Provided by some operating systems and file systems Mediates access to a file Mandatory or advisory: Mandatory – access is denied depending on locks held and requested Advisory – processes can find status of locks and decide what to do

Directory Both the directory structure and the files reside on disk A collection of data structures containing information about files Directory Files F 1 F 2 F 3 F 4 F n Both the directory structure and the files reside on disk Backups of these two structures are kept on tapes

Operations Performed on Directory Search for a file Create a file Delete a file List a directory Rename a file Traverse the file system

Organize the Directory (Logically) to Obtain Efficiency – locating a file quickly Naming – convenient to users Two users can have same name for different files The same file can have several different names Grouping – logical grouping of files by properties, (e.g., all Java programs, all games, …)

Single-Level Directory Naming problem Grouping problem

Two-Level Directory Separate directory for each user Path name Can have the same file name for different user Efficient searching No grouping capability

Tree-Structured Directories

Tree-Structured Directories (Cont) Efficient searching Grouping Capability In Unix, a directory is a file that contains meta-data about the files it contains.

Tree-Structured Directories (Cont) Most OS support absolute and relative path names. Unix has two pre-defined relative path names: . Represents current directory .. Represents parent directory Current directory (working directory) cd /spell/mail/prog or cd .. (relative to CD)

Path Names A UNIX directory tree

To Open dict the absolute path name is: /usr/lib/dict.

Relative Path Name Assume Current Directory is /usr/jim. Then .. is /usr, . is /usr/jim To access dict: ../lib/dict.

rmdir removes an entire directory (and all sub-directories). Unix: mkdir creates a new sub-directory below the current working directory. rmdir removes an entire directory (and all sub-directories). rm deletes a file If someone suggests that you try out a cool command called rm –r * don’t do it!!

File system containing a shared file Shared Files (1) File system containing a shared file

Links This is termed a hard link. Both directory entry pointing to the same inode. (a) Situation prior to linking (b) After the link is created (c) After the original owner removes the file

Symbolic Links Provide the path name of the target file in the linked file. Other processes do not have access to the inode (i.e., directory structure). What happens when file deleted by owner?

Operations Performed on Directory Search for a file Create a file Delete a file List a directory Rename a file Traverse the file system

Implementing Directories (1) (a) A simple directory fixed size entries disk addresses and attributes in directory entry (b) Directory in which each entry just refers to an i-node

File Control Block

Accessing a File

Allocation of File Blocks Contiguous allocation Linked-list allocation FAT Indexed (inodes).

Directory Structure with Contiguous Allocation of File Blocks

Implementing Files: Contiguous Allocation (a) Contiguous allocation of disk space for 7 files (b) State of the disk after files D and E have been removed

Linked-list Allocation

File Allocation Table

Entry 4 bytes. Blocks 1K. 20 Million Entries (not files Entry 4 bytes. Blocks 1K. 20 Million Entries (not files!) == 80 MB for table.

Indexed Allocation

File Allocation Table

Unix inode

Unix Directory Entry inode number File Name 15 Tester

Unix File System: 1 inode for each file/directory. B S Inode list Data blocks Boot area superblock

File Attributes File Attributes File Attributes File Attributes 100 Disk block addresses (NOT inode addresses) 0 1 2 3 Open file /usr/pmd

File Attributes File Attributes File Attributes File Attributes 100 400 800 253 127 180 769 0 1 2 3 Four inodes in a Unix system Step 1: Fetch inode for root directory (will be stored in memory). Open file /usr/pmd

File Attributes File Attributes File Attributes 800 253 127 180 769 0 1 2 3 Step 1: Fetch inode for root directory (will be stored in memory). inodes in a Unix system Open file /usr/pmd File Attributes 100 400

File Attributes File Attributes File Attributes File Attributes 100 400 800 253 127 180 769 0 1 2 3 inodes in a Unix system Directory Open file /usr/pmd Bin 1 usr 2 Step 1: Fetch inode for root directory (will be stored in memory). Step 2. Fetch disk block 100 and search for file usr. Disk block 100

File Attributes File Attributes File Attributes File Attributes 100 400 800 253 127 180 769 0 1 2 3 inodes in a Unix system Directory Open file /usr/pmd Bin 1 usr 2 Step 1: Fetch inode for root directory (will be stored in memory). Step 2. Fetch disk block 100 and search for file usr. Step 3. Fetch inode 2. Disk block 100

File Attributes File Attributes File Attributes 100 400 800 253 127 0 1 2 3 inodes in a Unix system Open file /usr/pmd Step 1: Fetch inode for root directory (will be stored in memory). File Attributes 180 769 Step 2. Fetch disk block 100 and search for file usr. Step 3. Fetch inode 2. Retrieve disk block 180.

File Attributes File Attributes File Attributes File Attributes 100 400 800 180 769 253 127 0 1 2 3 inodes in a Unix system Open file /usr/pmd pmd 3 B_Man 21 Jtm 34 Step 1: Fetch inode for root directory (will be stored in memory). Step 2. Fetch disk block 100 and search for file usr. Step 3. Fetch inode 2. Retrieve disk block 180.

File Attributes File Attributes File Attributes File Attributes 100 400 800 180 769 253 127 0 1 2 3 inodes in a Unix system Step 1: Fetch inode for root directory (will be stored in memory). Open file /usr/pmd pmd 3 B_Man 21 Jtm 34 Step 2. Fetch disk block 100 and search for file usr. Step 3. Fetch inode 2. Retrieve disk block 180. Step 4. Retrieve inode 3. This points to my home directory starting at block 253.

Miscellaneous If you lost credit for question 6.4 or 5.8 please see me to get those points back. Please check your email and notify me ASAP if your records disagree with mine! Some students still have not demoed project 2. Please make arrangements with the TA to do so today.

Each will account for 50% of the final grade. Grading Test average: 25% Prelim I, 25% Prelim II, and 50% final exam. Assignment average: 75% BRAIN, 15% programming assignments, and 10% homework. Each will account for 50% of the final grade.

Final Exam New Material Virtual Memory: Sections 9.1 up to but not including (UT) 9.2.2, 9.4 UT 9.5.2, 9.6 UT 9.7.2, 9.9.1 UT 9.9.4. File Systems: 10.3 UT 10.4, 11.1 UT 11.4.4, 11.5 UT 11.6. Also, there was material not in the Text but in slides: Understand the differences between the Unix file system and Windows file system. This includes differences in directory entries, methods for keeping track of blocks belonging to a file, and approaches to locating and opening a file.

Final Exam Earlier Material Make sure you understand the scheduling algorithms we discussed (FIFO, SJF, SJF-preemptive, RR). Please understand semaphores and the TestandSet instruction, how they are used and what can be done with them!!

File Allocation Table

Unix inode

Unix Directory Entry inode number File Name 15 Tester

The steps in looking up /usr/ast/mbox The UNIX File System The steps in looking up /usr/ast/mbox

Disk Space Management (1) Block size Dark line (left hand scale) gives data rate of a disk Dotted line (right hand scale) gives disk space efficiency All files 2KB

Tracking Free Disk Blocks Bit Vector 000111000000000111111000011

Linked-list