File Sharing 4 Sharing of files on multiuser

  • Slides: 26
Download presentation
File Sharing 4 Sharing of files on multi-user systems is desirable 4 Sharing may

File Sharing 4 Sharing of files on multi-user systems is desirable 4 Sharing may be done through a protection scheme 4 On distributed systems, files may be shared across a network 4 Network File System (NFS) is a common distributed file-sharing method 10/28/2021 CSE 30341: Operating Systems Principles page 1

File Sharing – Multiple Users 4 User IDs identify users, allowing permissions and protections

File Sharing – Multiple Users 4 User IDs identify users, allowing permissions and protections to be per-user 4 Group IDs allow users to be in groups, permitting group access rights 10/28/2021 CSE 30341: Operating Systems Principles page 2

File Sharing – Consistency Semantics 4 Consistency semantics specify how multiple users are to

File Sharing – Consistency Semantics 4 Consistency semantics specify how multiple users are to access a shared file simultaneously < Similar to Ch 7 process synchronization algorithms =Tend to be less complex due to disk I/O and network latency (for remote file systems < Andrew File System (AFS) implemented complex remote file sharing semantics < Unix file system (UFS) implements: =Writes to an open file visible immediately to other users of the same open file =Sharing file pointer to allow multiple users to read and write concurrently < AFS has session semantics =Writes only visible to sessions starting after the file is closed 10/28/2021 CSE 30341: Operating Systems Principles page 3

Protection 4 File owner/creator should be able to control: < what can be done

Protection 4 File owner/creator should be able to control: < what can be done < by whom 4 Types of access < Read < Write < Execute < Append < Delete < List 10/28/2021 CSE 30341: Operating Systems Principles page 4

Access Lists and Groups 4 Mode of access: read, write, execute 4 Three classes

Access Lists and Groups 4 Mode of access: read, write, execute 4 Three classes of users RWX a) owner access 7 111 RWX b) group access 6 110 RWX c) public access 1 001 4 Ask manager to create a group (unique name), say G, and add some users to the group. 4 For a particular file (say game) or subdirectory, define an appropriate access. owner group chmod 761 public game Attach a group to a file chgrp 10/28/2021 G game CSE 30341: Operating Systems Principles page 5

Windows XP Access-control List Management 10/28/2021 CSE 30341: Operating Systems Principles page 6

Windows XP Access-control List Management 10/28/2021 CSE 30341: Operating Systems Principles page 6

A Sample UNIX Directory Listing 10/28/2021 CSE 30341: Operating Systems Principles page 7

A Sample UNIX Directory Listing 10/28/2021 CSE 30341: Operating Systems Principles page 7

Chapter 11: File System Implementation 4 File structure < Logical storage unit < Collection

Chapter 11: File System Implementation 4 File structure < Logical storage unit < Collection of related information 4 File system resides on secondary storage (such as disks) 1. Boot control block - information needed to boot 2. Volume control block - information about volume/partitions (# blocks, size of blocks, free block count, free block pointers) 3. Directory structure (inode) 4. Per file control blocks 4 File system organized into layers 10/28/2021 CSE 30341: Operating Systems Principles page 8

Layered File System 10/28/2021 CSE 30341: Operating Systems Principles page 9

Layered File System 10/28/2021 CSE 30341: Operating Systems Principles page 9

A Typical File Control Block 4 File control block – storage structure consisting of

A Typical File Control Block 4 File control block – storage structure consisting of information about a file 10/28/2021 CSE 30341: Operating Systems Principles page 10

In-Memory File System Structures 10/28/2021 CSE 30341: Operating Systems Principles page 11

In-Memory File System Structures 10/28/2021 CSE 30341: Operating Systems Principles page 11

Virtual File Systems 4 There are many different file systems available on any operating

Virtual File Systems 4 There are many different file systems available on any operating systems < Windows: NTFS, FAT 32 < Linux: ext 2/ext 3, ufs, vfat, ramfs, tmpfs, reiserfs, xfs. . . 4 Virtual File Systems (VFS) provide an objectoriented way of implementing file systems 4 VFS allows the same system call interface (the API) to be used for different types of file systems 4 The API is to the VFS interface, rather than any specific type of file system 10/28/2021 CSE 30341: Operating Systems Principles page 12

Schematic View of Virtual File System 10/28/2021 CSE 30341: Operating Systems Principles page 13

Schematic View of Virtual File System 10/28/2021 CSE 30341: Operating Systems Principles page 13

Directory Implementation 4 Directories hold information about files 4 Linear list of file names

Directory Implementation 4 Directories hold information about files 4 Linear list of file names with pointer to the data blocks. < simple to program < time-consuming to execute 4 Hash Table – linear list with hash data structure. < decreases directory search time < collisions – situations where two file names hash to the same location < fixed size 10/28/2021 CSE 30341: Operating Systems Principles page 14

Allocation Methods 4 An allocation method refers to how disk blocks are allocated for

Allocation Methods 4 An allocation method refers to how disk blocks are allocated for files: 4 Contiguous allocation 4 Linked allocation 4 Indexed allocation 10/28/2021 CSE 30341: Operating Systems Principles page 15

Contiguous Allocation 4 Each file occupies a set of contiguous blocks on the disk

Contiguous Allocation 4 Each file occupies a set of contiguous blocks on the disk 4 Simple – only starting location (block #) and length (number of blocks) are required 4 Random access 4 Wasteful of space (dynamic storageallocation problem) 4 Files cannot grow 10/28/2021 CSE 30341: Operating Systems Principles page 16

Contiguous Allocation of Disk Space 10/28/2021 CSE 30341: Operating Systems Principles page 17

Contiguous Allocation of Disk Space 10/28/2021 CSE 30341: Operating Systems Principles page 17

Extent-Based Systems 4 Many newer file systems (I. e. Veritas File System) use a

Extent-Based Systems 4 Many newer file systems (I. e. Veritas File System) use a modified contiguous allocation scheme 4 Extent-based file systems allocate disk blocks in extents 4 An extent is a contiguous block of disks < Extents are allocated for file allocation < A file consists of one or more extents. 10/28/2021 CSE 30341: Operating Systems Principles page 18

Linked Allocation 4 Each file is a linked list of disk blocks: blocks may

Linked Allocation 4 Each file is a linked list of disk blocks: blocks may be scattered anywhere on the disk. block = pointer 4 Simple – need only starting address 4 Free-space management system – no waste of space 4 No random access 10/28/2021 CSE 30341: Operating Systems Principles page 19

Linked Allocation 10/28/2021 CSE 30341: Operating Systems Principles page 20

Linked Allocation 10/28/2021 CSE 30341: Operating Systems Principles page 20

File-Allocation Table (DOS FAT) 10/28/2021 CSE 30341: Operating Systems Principles page 21

File-Allocation Table (DOS FAT) 10/28/2021 CSE 30341: Operating Systems Principles page 21

Indexed Allocation 4 Brings all pointers together into the index block. 4 Logical view.

Indexed Allocation 4 Brings all pointers together into the index block. 4 Logical view. index table 10/28/2021 CSE 30341: Operating Systems Principles page 22

Example of Indexed Allocation 10/28/2021 CSE 30341: Operating Systems Principles page 23

Example of Indexed Allocation 10/28/2021 CSE 30341: Operating Systems Principles page 23

Indexed Allocation (Cont. ) 4 Need index table 4 Random access 4 Dynamic access

Indexed Allocation (Cont. ) 4 Need index table 4 Random access 4 Dynamic access without external fragmentation, but have overhead of index block. 4 Mapping from logical to physical in a file of maximum size of 256 K words and block size of 512 words. We need only 1 block for index table. 10/28/2021 CSE 30341: Operating Systems Principles page 24

Indexed Allocation – Mapping (Cont. ) � outer-index table 10/28/2021 CSE 30341: Operating Systems

Indexed Allocation – Mapping (Cont. ) � outer-index table 10/28/2021 CSE 30341: Operating Systems Principles file page 25

Combined Scheme: UNIX (4 K bytes per block) 10/28/2021 CSE 30341: Operating Systems Principles

Combined Scheme: UNIX (4 K bytes per block) 10/28/2021 CSE 30341: Operating Systems Principles page 26