operating systems chapter 4

20
Operating Systems Chapter 4 The File System

Upload: kirk-walsh

Post on 03-Jan-2016

28 views

Category:

Documents


0 download

DESCRIPTION

Operating Systems Chapter 4. The File System. File Attributes. Name – only information kept in human-readable form. Type – needed for systems that support different types. Location – pointer to file location on device. Size – current file size. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Operating Systems Chapter 4

Operating SystemsChapter 4

The File System

Page 2: Operating Systems Chapter 4

File Attributes

Name – only information kept in human-readable form. 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.

Page 3: Operating Systems Chapter 4

File Operations

create write read reposition within file – file seek delete truncate open(Fi) – search the directory structure on disk for

entry Fi, and move the content of entry to memory. close (Fi) – move the content of entry Fi in memory to

directory structure on disk.

Page 4: Operating Systems Chapter 4

Access Methods

Sequential Accessread nextwrite next reset

Direct Access (Random)read nwrite nposition to n

n = relative block number

Page 5: Operating Systems Chapter 4

Directory Structure

A collection of nodes containing information about all files.

F 1 F 2F 3

F 4

F n

Directory

Files

Page 6: Operating Systems Chapter 4

Tree-Structured Directories

Page 7: Operating Systems Chapter 4

Acyclic-Graph Directories

Page 8: Operating Systems Chapter 4

Acyclic-Graph Directories (Cont.)

Two different names (aliasing) If dict deletes w/list dangling pointer.

Solutions:• Backpointers, so we can delete all pointers ->

Variable size records a problem.

• Entry-hold-count solution.

Page 9: Operating Systems Chapter 4

Acyclic-Graph Directories (Cont.)

How do we guarantee no cycles?• Allow only links to file not

subdirectories.

• Every time a new link is added use a cycle detectionalgorithm to determine whether it is OK.

Page 10: Operating Systems Chapter 4

Access Lists and Groups

Mode of access: read, write, execute Three classes of users

RWXa) owner access 7 1 1 1

RWXb) groups access 6 1 1 0

RWXc) public access 1 0 0 1

Attach a group to a file

chgrp G game

owner group public

chmod 761 game

Page 11: Operating Systems Chapter 4

In-Memory File System Structures

Page 12: Operating Systems Chapter 4

File-System Allocation Methods

Contiguous Allocation Linked Allocation Indexed Allocation

Page 13: Operating Systems Chapter 4

Contiguous Allocation

Page 14: Operating Systems Chapter 4

Linked Allocation

Each file is a linked list of disk blocks: blocks may be scattered anywhere on the disk.• Simple – need only starting address

• Free-space management system – no waste of space

• No random access

• Allocate as needed, link together; e.g., file starts at block 9

Page 15: Operating Systems Chapter 4

Linked Allocation (cont.)

Page 16: Operating Systems Chapter 4

File-Allocation Table

File-allocation table (FAT) – disk-space allocation used by MS-DOS and OS/2.

Page 17: Operating Systems Chapter 4

Indexed Allocation

Brings all pointers together into the index block.

index table

Page 18: Operating Systems Chapter 4

Example of Indexed Allocation

Page 19: Operating Systems Chapter 4

Indexed Allocation (Cont.)

Need index table Random access have overhead of index block. Mapping from logical to physical in a file of

maximum size of 256K words and block size of 512 words. We need only 1 block for index table.

Page 20: Operating Systems Chapter 4

UNIX inode (UFS)