CS 241 Section (04/29/2010). In Section Today… MP7 HW3 Clarifications File System Topics.

Slides:



Advertisements
Similar presentations
File Management.
Advertisements

Chapter 4 : File Systems What is a file system?
MORE FILE ATTRIBUTES. ls –l to display file attributes (properties) Listing of a specific directory Ownership and group ownership Different file permissions.
File Systems.
COS 318: Operating Systems File Layout and Directories
Links Learning Objectives: 1. To understand the basics of links & its usage 2. To learn the construction / removal of different types of links 3. To distinguish.
Operating Systems File Systems (in a Day) Ch
File System Implementation CSCI 444/544 Operating Systems Fall 2008.
File Systems Implementation
CS 104 Introduction to Computer Science and Graphics Problems Operating Systems (4) File Management & Input/Out Systems 10/14/2008 Yang Song (Prepared.
Linux+ Guide to Linux Certification, Second Edition
Ceng Operating Systems
6/24/2015B.RamamurthyPage 1 File System B. Ramamurthy.
Links Learning Objectives: 1. To understand the basics of links & its usage 2. To learn the construction / removal of different types of links 3. To distinguish.
1 Friday, July 07, 2006 “Vision without action is a daydream, Action without a vision is a nightmare.” - Japanese Proverb.
Linux Linux File System.
7/15/2015B.RamamurthyPage 1 File System B. Ramamurthy.
Links Software Tools. Lecture 4 / Slide 2 Links l A link is a pointer to a file. l In fact, in UNIX all filenames are just links to a file. Most files.
Secondary Storage Management Hank Levy. 8/7/20152 Secondary Storage • Secondary Storage is usually: –anything outside of “primary memory” –storage that.
File Systems. Main Points File layout Directory layout.
Chapter 5 Part 2 Secondary Storage Mgt. File Mgt. in Popular OSs
File Systems (1). Readings r Silbershatz et al: 10.1,10.2,
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.
Filesystem Hierarchy Standard (FHS) –Standard of outlining the location of set files and directories on a Linux system –Gives Linux software developers.
1Fall 2008, Chapter 11 Disk Hardware Arm can move in and out Read / write head can access a ring of data as the disk rotates Disk consists of one or more.
Linux+ Guide to Linux Certification, Second Edition
File System Implementation Chapter 12. File system Organization Application programs Application programs Logical file system Logical file system manages.
Operating System Concepts and Techniques Lecture 17
NETW3005 File System Interface. Reading For this lecture, you should have read Chapter 10 (Sections 1-5) and Chapter 11 (Sections 1-4). NETW3005 (Operating.
File Systems CSCI What is a file? A file is information that is stored on disks or other external media.
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved Chapter 5 File Management File Overview.
File Systems (1). Readings r Reading: Disks, disk scheduling (3.7 of textbook; “How Stuff Works”) r Reading: File System Implementation ( of textbook)
CS 149: Operating Systems April 9 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
File Management Chapter 12. File Management File management system is considered part of the operating system Input to applications is by means of a file.
Managing Files. Module 5 Managing Files ♦ Introduction “On a Linux system, everything is a file; if something is not a file, it is a process.” ♦ Topics.
Module 4.0: File Systems File is a contiguous logical address space.
CS 241 Section Week #9 (11/05/09). Topics MP6 Overview Memory Management Virtual Memory Page Tables.
Project 6 Unix File System. Administrative No Design Review – A design document instead 2-3 pages max No collaboration with peers – Piazza is for clarifications.
Chapter 4: File Security & Permissions Also: Hard and Soft Links, see p77-80 &
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
CE Operating Systems Lecture 17 File systems – interface and implementation.
Managing Files CSCI N321 – System and Network Administration Copyright © 2000, 2007 by the Trustees of Indiana University except as noted.
File Systems. 2 What is a file? A repository for data Is long lasting (until explicitly deleted).
Lecture 10 Page 1 CS 111 Summer 2013 File Systems Control Structures A file is a named collection of information Primary roles of file system: – To store.
Annotated by B. Hirsbrunner File Systems Chapter Files 5.2 Directories 5.3 File System Implementation 5.4 Security 5.5 Protection Mechanism 5.6 Overview.
Slide: 1 UNIX FILE SYSTEM By:Qing Yang ID: Operating System Research Topic December, 2000.
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 File-System Interface.
THE FILE SYSTEM Files long-term storage RAM short-term storage Programs, data, and text are all stored in files, which is stored on.
Chapter 6 File Systems. Essential requirements 1. Store very large amount of information 2. Must survive the termination of processes persistent 3. Concurrent.
Operating Systems 1 K. Salah Module 4.0: File Systems  File is a contiguous logical address space (of related records)  Access Methods  Directory Structure.
Lecture Topics: 12/1 File System Implementation –Space allocation –Free Space –Directory implementation –Caching Disk Scheduling File System/Disk Interaction.
File Systems.  Issues for OS  Organize files  Directories structure  File types based on different accesses  Sequential, indexed sequential, indexed.
CS4432: Database Systems II
CIT 140: Introduction to ITSlide #1 CSC 140: Introduction to IT Files and Filesystems.
Chapter 2: Exploring the UNIX File System (For Tuesday Section) File and File Systems.
W4118 Operating Systems Instructor: Junfeng Yang.
Fall 2011 Nassau Community College ITE153 – Operating Systems 1 Session 5 Files.
File and File System Structure
Filesystems.
Lecture 45 Syed Mansoor Sarwar
Operation System Program 4
Chapter 11: File System Implementation
File system(conti..) Lecture November 2018.
CS510 Operating System Foundations
File System B. Ramamurthy B.Ramamurthy 11/27/2018.
Introduction to Operating Systems
Chapter 16 File Management
Software I: Utilities and Internals
Lecture Topics: 11/20 HW 7 What happens on a memory reference Traps
Presentation transcript:

CS 241 Section (04/29/2010)

In Section Today… MP7 HW3 Clarifications File System Topics

MP7 In MP7, the task is simple: reimplement malloc(), calloc(), realloc(), and free(). As part of MP7, a contest is running comparing all submissions.

HW3 Clarifications The professors have announced a few clarifications on HW3… (All these clarifications are also posted online on the “MP & Homeworks” page of the course website.)

HW3 Clarifications Question 1(B): – When implementing alarm(20) without the alarm() call, you can just use sleep(20) call to wait 20 seconds.

HW3 Clarifications Question 3(C): – When calculating statistics regarding a page table (eg: given a 64-bit logical address, 16 KB pages, …), you may want to refer to the lecture on April 15 in the section “Multilevel Page Tables” Quesiton 3(C), Part 3: – Instead of just the first level of the page table needing to fit into the page table, all levels must.

HW3 Clarifications Question 4(C): – When evaluating the FIFO, SSTF, SCAN, and C- SCAN algorithms, the “total time” to serve the requests should include only the seek times (5ms /cylinder moved).

HW3 Clarifications Question 5(A): – When writing the bitmap overview after a series of file write/delete requests, remember that: The search for free blocks always begin at the lowest number blocks Files to not have to be sequentially ordered/contiguous. This bitmap should not include space needed for i- nodes, we only care about data blocks in this question.

HW3 Clarifications Question 5(C): – For [Part 1] and [Part 2], we care only about the data blocks allocated and not about the i-nodes allocated. – One of the lines has a typo, where a file4 should be created inside the folder “subdir”

HW3 Due Tomorrow Homework #3 is due in your svn at 11:00am, the beginning of class. No late submissions.

UNIX File Systems inode: per-file data structure Advantage Efficient for small files Flexible if the size changes Disadvantage File must fit in a single disk partition

inodes Stores almost all “metadata” about a file: – Size, owner, permissions, creation time, access time, etc, etc – Also stores a “link count”, which indicates how many hard links exist to the file. (We’ll look at what a hard link is later.) – Also stores the “block index table” that was talked about extensively in lecture.

inodes Block index table, illustrated:

Directory Files The one major attribute that inodes do NOT store is the name of the file. Instead, the names of the file inside a directory are stored in a file that describes the contents of a directory. – Remember, a directory is a file too!

Directory Files Instead of storing data, directory files store a table that associates a name of the file with the files inode.

Directory Files The command “ls –i“ lists the contents of the directory file. This is “ls –i /” on a csil-linux-ts box: – bin/ 2 boot/ 1377 dev/ etc/ home/ …

…back to inodes. In the inode files, the “metadata” about the file, there is a series of bytes that describe the permissions of the file. – Who can read the file? – Who can write to the file? – Who can execute the file?

File Permissions In UNIX, the file permissions system is relatively basic. – Each file has a single owner and a single group associated with it. – Each file also has permissions associated with itself for the owner, members of the group the file is in, and for everyone else.

File Permissions These permissions are stored as a three-octal- digit number (000 to 777). 755

File Permissions The most-significant number is the owner’s permission. 755 Owner

File Permissions The middle number is the group’s permission. 755 Group

File Permissions The least-significant number is everyone else’s permission. 755 Other

File Permissions Each octal number is simply three bits: a read bit, a write bit, and an execute bit Read: Write: Execute:

File Permissions Thus: – 755 means “everyone can read and execute by file, but only the owner can write to (edit) my file” – 644 means “everyone can read my file, only the owner can write to my file, and no one can execute it” – 660 means “only members of the file’s group and the file’s owner may read or edit the file; others cannot even read it”

File Permissions on Directory Files If the inode contains “metadata” about a directory file, the execute permission takes on a different meaning: – The execute bit determines if a user/group/everyone can get a list of the contents of the directory. – If you don’t have “execute access” on a directory, you cannot “ls” it or “cd” into it, since you’re unable to access the list of files in the directory.

File Permissions The command “ls –l” will list various permissions information about a file. – lrwxrwxrwx 1 root root 27 Oct local -> … drwx root root Oct lost+found/ drwxr-xr-x 2 root root 4096 Mar media drwxr-xr-x 2 root root 4096 Oct misc/ drwxr-xr-x 2 root root 4096 Mar mnt/ drwxr-xr-x 6 root root 4096 Jan 15 17:04 opt/ dr-xr-xr-x 717 root root 0 Apr 23 05:08 proc/ drwxr-xr-x 2 root root 4096 Oct reserved/ drwxr-x root root 4096 Apr 27 12:09 root/

Hard Links You know about inodes, you know about permissions, but how do we “link” an inode to a file? A hard link is simply a direct directory file reference to an inode. – Remember, directory files simply list (file name inode) pairs.

Hard Links To create a hard link, you simple use: ln

Hard Links If you’re at “/”, “/dirA/name1” exists, and you want to create a hard link to that file at location “/dirB/name2”: – ln /dirA/name1 /dirB/name2

Hard Links If you’re at “/”, “/dirA/name1” exists, and you want to create a hard link to that file at location “/dirB/name2”: – ln /dirA/name1 /dirB/name2 – Remember: inodes store a “link count”

Hard Link Example (contd) Q: What happens if /dirA/name1 is deleted and recreated?

Hard Link Example (contd) A: /dirA/name1 and /dirB/name2 are now two distinct files.

Symbolic Links (“Soft Links”) Q: What if we want the file to only be in one single directory? Having pointers in different directories to the exact same file seems like it could get messy…

Symbolic Links (“Soft Links”) A: Symbolic links (aka “soft link”) are “shortcuts”, which references an existing file’s path and NOT the existing file’s inode number. A soft link is a special file that simply stores a path to another file/directory. – Eg: “/home/class/sp10/cs241/”

Symbolic Links (“Soft Links”) The command “ln” also creates soft links: ln -s

Symbolic Links (“Soft Links”) ln -s /dirA/name1 /dirB/name2

Soft Link Example (contd) Q: What happens if /dirA/name1 to is deleted and recreated?

Soft Link Example (contd) A: /dirA/name1 has a different inode, but /dir/name2 still links to it.

Key Differences If you delete a file: – With hard links, since the reference count is still greater than 0, the file itself is not deleted and still can be referenced to at a different location. – With soft links, if you delete the file that’s being pointed to, that file is now deleted and the link will be unable to resolve (eg: “unable to fild /path/to/file”).

File Permissions The command “ls –l” will show the link count in the second column: – lrwxrwxrwx 1 root root 27 Oct local -> … drwx root root Oct lost+found/ drwxr-xr-x 2 root root 4096 Mar media drwxr-xr-x 2 root root 4096 Oct misc/ drwxr-xr-x 2 root root 4096 Mar mnt/ drwxr-xr-x 6 root root 4096 Jan 15 17:04 opt/ dr-xr-xr-x 717 root root 0 Apr 23 05:08 proc/ drwxr-xr-x 2 root root 4096 Oct reserved/ drwxr-x root root 4096 Apr 27 12:09 root/

File Permissions For most user storage space, it makes sense that the link count (number of hard links) is only 1: – -rw wfagen2 csGrads 8254 Apr 27 19:11 alloc.c – -rw wfagen2 csGrads 9 Apr 27 19:11 ALLOCNAME.txt – -rw wfagen2 csGrads 3581 Apr 29 06:26 contest-alloc.c – -rw wfagen2 csGrads 253 Apr 29 06:27 contest.h – -rw wfagen2 csGrads 842 Apr 27 19:03 Makefile – -rw wfagen2 csGrads 3427 Apr 29 06:27 mcontest.c – -rw wfagen2 csGrads 1387 Apr 27 16:57 mreplace.c – -rw wfagen2 csGrads 129 Apr 27 15:51 README.txt – drwx wfagen2 csGrads 64 Apr 27 15:51 testers/

Overview of Topics as a PDF… The course professors have also prepared an overview of these topics, attached with the HW #3 clarifications.