Download presentation
Presentation is loading. Please wait.
1
File system(conti..) Lecture 24 14 November 2018
2
File Sharing Sharing of files on multi-user systems is desirable.
Sharing may be done through Duplicating files Common login for members of a team Setting appropriate access permissions Common groups for members of a team Links 14 November 2018
3
Protection File owner/creator should be able to control
What can be done By whom Types of access Read Write Execute Append Delete List 14 November 2018
4
UNIX Protection Mode of access: read, write, and execute (r, w, x)
Three classes of users: owner, group, and others r w x a) Owner access: 7 b) Group access: 6 1 1 0 c) Public access: 1 0 0 1 14 November 2018
5
UNIX Protection Ask system administrator to create a group and add some users to the group For a particular file or subdirectory, set appropriate access permissions for proper protection 14 November 2018
6
Default Permissions 777 for executable files and directories
666 for text files Can be changed with the umask command 14 November 2018
7
UNIX Protection chmod 761 game1 owner group others Read Write Execute
14 November 2018
8
UNIX Protection chmod 755 projectAthena owner group others
Read Write Search Read Search Read Search 14 November 2018
9
UNIX Protection Sample commands chmod 700 ~ chmod 744 ~/file
chmod 755 ~/directory ls –l ~ ls –ld ~ ls –l prog1.c ls –ld ~/courses 14 November 2018
10
UNIX Protection The umask Command
Sets default permissions on newly created files and directories as (default permissions – mask value) umask umask 022 touch temp1 ls –l temp1 14 November 2018
11
File Control Block UNIX inode 14 November 2018
12
In-Memory Data Structures
The following upper-level data structures needed for file system support. Mapping directory entry for the file to the file control block at the time of opening a file. Mapping used while reading or writing a file. 14 November 2018
13
In-Memory Data Structures
14 November 2018
14
Per Process File Descriptor Table
File Descriptor to File Contents Per Process File Descriptor Table File Table Inode Table File Descriptor 1 2 3 4 OPEN_MAX — 1 File’s contents … … … … … 14 November 2018
15
Space Allocation Methods
Contiguous allocation Linked allocation Indexed allocation 14 November 2018
16
Contiguous Allocation
Each file occupies a set of contiguous blocks on the disk Best-fit, first-fit, or worst-fit algorithm Directory entry contains starting block number and file size (in blocks) Good sequential and random access External fragmentation User needs to declare file size Expensive file growth 14 November 2018
17
Contiguous Allocation
14 November 2018
18
Linked Allocation Each file is a linked list of disk blocks: blocks may be scattered anywhere on the disk. Simple – need only starting address No wastage of space No random access 14 November 2018
19
Linked Allocation 14 November 2018
20
Index Allocation Brings all pointers together into the index block
Logical view Index table Data blocks 14 November 2018
21
Index Allocation 14 November 2018
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.