Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Friday, July 07, 2006 “Vision without action is a daydream, Action without a vision is a nightmare.” - Japanese Proverb.

Similar presentations


Presentation on theme: "1 Friday, July 07, 2006 “Vision without action is a daydream, Action without a vision is a nightmare.” - Japanese Proverb."— Presentation transcript:

1 1 Friday, July 07, 2006 “Vision without action is a daydream, Action without a vision is a nightmare.” - Japanese Proverb

2 2 Segmentation vs. Paging §Linear address spaces? §Can address space exceed the size of physical memory? §Can procedures and data be distinguished separately? §Is sharing of procedures facilitated?

3 3 Long-term Information Storage 1.Must store large amounts of data 2.Information stored must survive the termination of the process using it 3.Multiple processes must be able to access the information concurrently

4 4 File naming §Shield user from details of how information is stored §Names can be as long as 255 characters §Upper case and lower case

5 5 Extensions §Unix does not enforce extensions l Convenience for the user §May be required by programs e.g. C compilers §Windows is aware of extensions and we can specify which program is associated with an extension

6 6 File Structure §Three kinds of files l Unstructured sequence of bytes OS does not know what is inside the file Any meaning is imposed by the user programs Approach used by UNIX and Windows l Record sequence Fixed length records l Tree Record retrieved through a key Large mainframe computers for commercial data processing

7 7 §The DECSYSTEM-20 minicomputer example.

8 8 §Flexibility lost if OS enforces all file types

9 9 §Every Operating system must recognize one file type: its own executable file. §Executable binary file in UNIX l Will execute file only if it has a proper format l Header with Magic number, sizes of text and data segments, address where execution starts etc.

10 10 File Access §Sequential access l read all bytes/records from the beginning l cannot jump around, could rewind or back up l convenient when medium was mag tape §Random access (Modern OSs) l bytes/records read in any order l essential for data base systems l read can be … move file marker (seek), then read or … read and then move file marker

11 11 File Attributes §Name §Owner §Date and time of creation §Modification §Protection information §Size §…

12 12 File Operations 1. Create 2. Delete 3. Open 4. Close 5. Read 6. Write 7. Append 8. Seek 9. Get attributes 10. Set Attributes 11. Rename

13 13 §open system call l Fetch file attributes and disk addresses into main memory do that later accesses can be carried out quickly. l File descriptor (small integer for use in subsequent operations) §close system call l file should be closed to free up internal disk space.

14 14 Directories Single-Level Directory Systems §A single level directory system l contains 4 files l owned by 3 different people, A, B, and C

15 15 Two-level Directory Systems Letters indicate owners of the directories and files Shared system programs

16 16 Hierarchical Directory Systems A hierarchical directory system (used in modern file systems)

17 17 A UNIX directory tree Path Names

18 18 File System Implementation A possible file system layout Master Boot Record, usually in sector 0, is used to boot the computer. One partition is marked as active. Super block contains key parameters about the file system, such as number of blocks, magic number etc.

19 19 Implementing Files (a) Contiguous allocation of disk space for 7 files (b) State of the disk after files D and E have been removed

20 20 Contiguous allocation §Simple to implement §Easy to locate blocks given the disk address of first block §Read performance for the entire file is very good l Why? How many Seeks?

21 21 Contiguous allocation §Problems: Fragmentation §Files can grow in size §Is declaring the maximum size of file a good idea?

22 22 Contiguous allocation §Widely used on CD-ROMs

23 23 Implementing Files (cont’d) Storing a file as a linked list of disk blocks

24 24 §No space lost to external fragmentation. §We need to store only the disk address of the first block. §Random access is slow: To get to block N, must read n-1 blocks before it. §Amount of data stored is no longer power of two because the pointer takes some bytes.

25 25 Implementing Files (cont’d) Linked list allocation using a file allocation table in RAM Take the pointer away from each disk block and put it in a table in memory. We need to store only the starting block number.

26 26 FAT §Main disadvantage: l Entire table must be kept in memory l The table holding linked lists is proportional to the size of disk l 40GB disk with 1KB block size  40 million entries

27 27 Implementing Files (cont’d) An example i-node Index-node or i-node A data structure associated with each file to keep track of which blocks belong to which file. I-node need only be in memory when the corresponding file is open. Using i-nodes require an array that is proportional to the maximum number of files that may be open at once.

28 28 §Nearly all file system store files as fixed- size blocks. §Internal fragmentation §Small blocks l Good for disk utilization l Bad for performance §In Unix: 1KB blocks are commonly used

29 29 §Every file in Unix has a unique number (i- number) that identifies it. §This i-number is used as an index into the table of i-nodes. §A directory is simply a file that contains a set of (i-number, file name) pairs.

30 30 Implementing Directories (a) A simple directory (Windows) fixed size entries disk addresses and attributes in directory entry (b) Directory in which each entry just refers to an i-node (Unix)

31 31 Shared Files File system containing a shared file

32 32 (a) Two directories before linking /usr/jim/memo to ast's directory (b) The same directories after linking

33 33 Shared Files Hard Link (a) Situation prior to linking (b) After the link is created (c) Increments the counter in the file’s i-node

34 34 Symbolic linking §Create a new file of type LINK. §This file contains just the path name of the file to which it is linked

35 35 Links Hard links §What if the original owner removes the file. §Owner’s quota being used Symbolic links §File to store path takes up one disk block of space. §Extra i-node needed for each symbolic link. §Need to parse the path to get to its i-node.

36 36 Sharing Files Two processes can share a mapped file. A new file mapped simultaneously into two processes

37 37 Unix System calls §mmap §unmap

38 38 UNIX File System Disk layout in classical UNIX systems

39 39 UNIX File System The relation between the file descriptor table, the open file description


Download ppt "1 Friday, July 07, 2006 “Vision without action is a daydream, Action without a vision is a nightmare.” - Japanese Proverb."

Similar presentations


Ads by Google