~FILE SYSTEM~ SUNU WIBIRAMA OUTLINE FILE SYSTEM ACCESS METHODS - - PowerPoint PPT Presentation

file system
SMART_READER_LITE
LIVE PREVIEW

~FILE SYSTEM~ SUNU WIBIRAMA OUTLINE FILE SYSTEM ACCESS METHODS - - PowerPoint PPT Presentation

~FILE SYSTEM~ SUNU WIBIRAMA OUTLINE FILE SYSTEM ACCESS METHODS DIRECTORY STRUCTURE FILE SYSTEM MOUNTING PROTECTION EXTERNAL VIEW OF THE FILE MANAGER FILE MANAGEMENT FILE, IS A NAMED AND ORDERED COLLECTION OF INFORMATION COMPUTER SHOULD


slide-1
SLIDE 1

~FILE SYSTEM~

SUNU WIBIRAMA

slide-2
SLIDE 2

OUTLINE

FILE SYSTEM ACCESS METHODS DIRECTORY STRUCTURE FILE SYSTEM MOUNTING PROTECTION

slide-3
SLIDE 3

EXTERNAL VIEW OF THE FILE MANAGER

slide-4
SLIDE 4

FILE MANAGEMENT

FILE, IS A NAMED AND ORDERED COLLECTION OF INFORMATION COMPUTER SHOULD BE CONVENIENT TO BE USED OPERATING SYSTEM HANDLES IT WITH ITS FILE MANAGEMENT FUNCTION FILE MANAGER’S JOB:

  • STORING THE INFORMATION ON A DEVICE
  • MAPPING THE BLOCK STORAGE TO LOGICAL VIEW
  • ALLOCATING /DEALLOCATING STORAGE
  • ORGANIZING FILE EFFICIENTLY
slide-5
SLIDE 5

FILE STRUCTURE

 File represents program (source and object forms) and data  General file structure: sequence of bits, bytes, lines, or records  Simple record structure:

 Lines  Fixed length  Variable length

 Complex Structures:

 Formatted document  Relocatable load file

 Who decides:

 Operating system  Program

slide-6
SLIDE 6

FILE ATTRIBUTES

NAME – ONLY INFORMATION KEPT IN HUMAN- READABLE FORM IDENTIFIER – 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 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

slide-7
SLIDE 7

FILE OPERATIONS

File is an abstract data type Create Write Read Reposition within file (FILE SEEK) Delete Truncate

slide-8
SLIDE 8

OPEN AND CLOSE FILE

 Open(Fi) – search the directory structure on disk for entry Fi,

and move the content of entry to memory. OS provides open-file table to containing information about all open files (no need to search directory structures when a file operation is requested)

 Close (Fi) – move the content of entry Fi in memory to directory

structure on disk. Erase the entry in open-file table related to the closed file.

slide-9
SLIDE 9

FILE TYPES

 Operating System must

recognize the file type in

  • rder to operate on the file

in reasonable ways.

 File types are recognized

as an extension : *.exe, *.doc, *.psd, etc.

slide-10
SLIDE 10

ACCESS METHOD (1)

Sequential Access:

  • read next
  • write next
  • reset
  • no read after last write
  • rewrite
slide-11
SLIDE 11

ACCESS METHOD (2)

Direct Access (Relative Access):

  • no restrictions on the order of read or write
  • read n
  • write n
  • position to n
  • read next
  • write next
  • rewrite n

n = relative block number

HOW TO TRANSLATE SEQUENTIAL-ACCESS ON A DIRECT-ACCESS FILE

slide-12
SLIDE 12

BASIC DISK STRUCTURES

DISK CAN BE SUBDIVIDED INTO PARTITIONS ENTITY CONTAINING FILE SYSTEM ALSO KNOWN AS VOLUME DIRECTORY IS LIKE A TABLE OF CONTENTS - RECORDS INFORMATION, SUCH AS NAME, LOCATION, SIZE, TYPE OF ALL FILES IN A VOLUME

slide-13
SLIDE 13

DIRECTORY

SET OF FILES USED TO ORGANIZE FILES TREATED AS A FILE, BUT WITH SPECIAL OPERATIONS ON IT:

  • CREATE A FILE
  • DELETE A FILE
  • SEARCH A FILE
  • LIST A DIRECTORY
  • RENAME A FILE
slide-14
SLIDE 14

SINGLE-LEVEL DIRECTORY

SINGLE DIRECTORY FOR ALL USERS IF THE NUMBER OF FILES INCREASES OR MORE THAN ONE USERS --> PROBLEM OCCURES LENGTH OF FILE NAME LIMITATION: MS-DOS (11) DIFFERS WITH UNIX (255)

slide-15
SLIDE 15

TWO-LEVEL DIRECTORY

SEPARATE DIRECTORY FOR EACH USER CAN HAVE THE SAME FILE NAME FOR DIFFERENT USER ISOLATES ONE USER TO THE OTHERS

slide-16
SLIDE 16

TREE-STRUCTURED DIRECTORY

TREE: THE MOST COMMON STRUCTURES

slide-17
SLIDE 17

TREE-STRUCTURED DIRECTORY

Efficient searching Grouping Capability Current directory (working directory) Absolute or relative path name

CURRENT DIRECTORY ABSOLUTE PATH RELATIVE PATH

slide-18
SLIDE 18

TREE-STRUCTURED DIRECTORY

 Creating a new file is done in current directory  Delete a file

  • rm <file-name>

 Creating a new subdirectory is done in current directory

mkdir <dir-name>

  • Example: if in current directory /mail
  • mkdir count

mail copy prt exp count

slide-19
SLIDE 19

TREE-STRUCTURED DIRECTORY

 Creating a new file is done in current directory  Delete a file

  • rm <file-name>

 Creating a new subdirectory is done in current directory

mkdir <dir-name>

  • Example: if in current directory /mail
  • mkdir count

mail copy prt exp count

what’s happened, if i execute rm -rf /home?

slide-20
SLIDE 20

ACYCLIC-GRAPH DIRECTORIES

HAVE SHARED SUBDIRECTORIES AND FILES

SHARED FILE

SHARED SUBDIRECTORY

slide-21
SLIDE 21

ACYCLIC-GRAPH DIRECTORIES

ALIASING: DIFFERENT FILE NAMES FOR SAME FILE A POINTER TO SHARED FILE IS NAMED LINK DELETION PROBLEM, IF THE SHARED SUBDIRECTORY “LIST” IS DELETED, WE HAVE DANGLING POINTER SYMBOLIC LINKS:

  • IF LINK IS DELETED, PRESERVE THE ORIGINAL FILE
  • IF ORIGINAL FILE IS DELETED, ACCESS TO THE DELETED FILE

USING LINKS IS TREATED AS ILLEGAL ACCESS. NON-SYMBOLIC LINKS (HARD LINKS):

  • PRESERVE THE FILE UNTIL ALL REFERENCES TO IT ARE DELETED
  • KEEP ONLY A COUNT OF THE NUMBER OF REFERENCES. WHEN

THE COUNT = 0, FILE CAN BE DELETED BECAUSE NO REFERENCE TO IT.

slide-22
SLIDE 22

GENERAL GRAPH DIRECTORY

 How do we guarantee no cycles?

 Allow only links to file not subdirectories  Garbage collection: detect when the last reference has been deleted  Every time a new link is added use a cycle detection algorithm to

determine whether it is OK, but it’s computationally expensive

slide-23
SLIDE 23

ACYCLIC-GRAPH DIRECTORIES

LINK IN UBUNTU LINUX 10.10

slide-24
SLIDE 24

FILE SYSTEM MOUNTING

(A) MOUNTED (B) UNMOUNTED MOUNTED

you can see how it works on unix, instead of windows

slide-25
SLIDE 25

FILE SYSTEM MOUNTING

SOMETIME YOU SHOULD DEFINE THE TYPE OF YOUR MOUNTED FILE SYSTEM

BEFORE MOUNTING

Mount point: /mnt/public

AFTER MOUNTING

slide-26
SLIDE 26

FILE SYSTEM MOUNTING

Automatic mounting on booting: /etc/fstab

mounted file mount point file system type

slide-27
SLIDE 27

FILE SHARING

Multiple users: problem arises on file sharing, file naming, and file protection Add more attributes to file and directory Most systems use concept of OWNER and GROUP User IDs identify users, allowing permissions and protections to be per-user Group IDs allow users to be in groups, permitting group access rights We will elaborate on the last section : PROTECTION

slide-28
SLIDE 28

REMOTE FILE SHARING

 Uses networking to allow file system access between systems

 Manually via programs like FTP  Automatically, seamlessly using distributed file systems  Semi automatically via the world wide web

 Client-server model allows clients to mount remote file systems from servers

 Server can serve multiple clients  Client and user-on-client identification is insecure or complicated  NFS is standard UNIX client-server file sharing protocol  CIFS is standard Windows protocol  Standard operating system file calls are translated into remote calls

 Distributed Information Systems (distributed naming services) such as

LDAP, DNS, NIS, Active Directory implement unified access to information needed for remote computing

slide-29
SLIDE 29

PROTECTION

 Keep the file safe from physical damage (reliability) and improper access

(protection)

 File owner/creator should be able to control:

 what can be done  by whom

 Types of access

 Read  Write  Execute  Append  Delete  List

slide-30
SLIDE 30

PROTECTION

Field Meaning

  • File type / directory

rw-r--r-- Permission 1 Hard link number to file sunu

  • wner of file

sunu group of file 323 file size in byte 2010-11-18 13:55 modification date execute.txt file name

Owner (o) Group (g) Public/Universe (p)

  • rwxr-x---

file [o] [g] [p]

slide-31
SLIDE 31

PROTECTION

 Mode of access and octal: read (r = 4), write (w = 2), execute (x = 1)  Three classes of users

  • RWX
  • a) owner access

7 ⇒ 1 1 1

  • RWX
  • b) group access

6 ⇒ 1 1 0

  • RWX
  • c) public access

1 ⇒ 0 0 1

 Ask manager to create a group (unique name), say G, and add some users

to the group.

 For a particular file (say game) or subdirectory, define an appropriate

access.

  • wner

group public chmod 761 game

Attach a group to a file:

chgrp G game

slide-32
SLIDE 32

PROTECTION

ACCESS CONTROL LIST IN WINDOWS XP

ADMIN USERS

slide-33
SLIDE 33

/EOF

end of file