Download presentation
Presentation is loading. Please wait.
Published byMorgan Miller Modified over 9 years ago
1
CS 149: Operating Systems April 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak www.cs.sjsu.edu/~mak
2
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 2 Unofficial Field Trip Computer History Museum in Mt. View http://www.computerhistory.org/ Saturday, May 9, 11:30 – closing time Special free admission. Do a self-guided tour of the new Revolution exhibit. See a life-size working model of Charles Babbage’s Difference Engine in operation, a hand-cranked mechanical computer designed in the early 1800s. Experience a fully restored IBM 1401 mainframe computer from the early 1960s in operation. General info: http://en.wikipedia.org/wiki/IBM_1401http://en.wikipedia.org/wiki/IBM_1401 My summer seminar: http://www.cs.sjsu.edu/~mak/1401/http://www.cs.sjsu.edu/~mak/1401/ Restoration: http://ed- thelen.org/1401Project/1401RestorationPage.htmlhttp://ed- thelen.org/1401Project/1401RestorationPage.html
3
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 3 Unofficial Field Trip The new Revolution exhibit is now open! Walk through a timeline of the First 2000 Years of Computing History. Historic computer systems, data processing equipment, and other artifacts. Small theater presentations. Atanasoff-Berry Computer Hollerith Census Machine
4
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 4 Unofficial Field Trip Babbage Difference Engine, fully operational. Hand-cranked mechanical computer. Computed polynomial functions. Designed by Charles Babbage in the early to mid 1800s. Arguably the world’s first computer scientist, lived 1791-1871. He wasn’t able to build it because he lost his funding. Live demo at 1:00 His plans survived and this working model was built. Includes a working printer! http://www.computerhistory.org/babbage/
5
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 5 Unofficial Field Trip IBM 1401 computer, fully restored and operational A small transistor-based mainframe computer. Extremely popular with small businesses in the late 1950s through the mid 1960s Maximum of 16K bytes of memory. 800 card/minute card reader (wire brushes). 600 line/minute line printer (impact). 6 magnetic tape drives, no disk drives.
6
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 6 File Structure UNIX supports a minimal set of file structures. A file is simply a stream of bytes. Each byte is addressable by its offset from the file beginning or end. User programs can organize these bytes into fixed- or variable-length records. Other operating systems (especially on older machines) supported other file structures.
7
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 7 Sequential Access Method Programs access the records in forward order, one after another. The file pointer keeps track of the I/O location. Read the next record. Append to the end of the file. Rewind to the beginning of the file. Skip to record n Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved. 978-1-118-06333-0
8
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 8 Direct (Random) Access Method Programs can read or write records rapidly in any order. Each record has a position which is a relative block number n relative to the beginning of the file. Fixed-length records. read(n) write(n) position_to(n) read_next() write_next() rewrite(n) Why?
9
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 9 Other Access Methods Build other access methods on top of direct-access. Example: An indexed access method. Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved. 978-1-118-06333-0
10
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 10 Disk Structure A disk can be subdivided into partitions. Disks or partitions can be RAID-protected against failure. Raw disk or partition: without a file system Formatted: with a file system Volume: An entity containing a file system. Each volume tracks its file system’s information in a device directory or volume table of contents.
11
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 11 Disk Structure, cont’d Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved. 978-1-118-06333-0
12
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 12 Disk Structure, cont’d Along with general-purpose file systems, there are many special-purpose file systems. Frequently, all the file systems reside within the same operating system or computer.
13
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 13 Directories A directory is a container (“folder”) of files. Provides a way to organize a collection of files on disk.
14
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 14 Directory Operations Efficiency Locate a file quickly. Naming Convenient to users. Two users can have same name for different files. The same file can have several different names. Grouping Logical grouping of files by properties.
15
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 15 Directory Operations, cont’d Operations Create a file Delete a file Search for a file Rename a file List a directory Traverse the file system
16
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 16 Single-Level Directory A single directory for all users. Disadvantages: Naming Grouping Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved. 978-1-118-06333-0
17
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 17 Two-Level Directory The operating system maintains a master file directory. Each user has a user file directory. Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved. 978-1-118-06333-0
18
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 18 Two-Level Directory, cont’d Advantages Different users can use the same file names. More efficient searching. Disadvantages No grouping. Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved. 978-1-118-06333-0
19
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 19 Tree-Structured Directories Users can create their own subdirectories. Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved. 978-1-118-06333-0
20
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 20 Acyclic-Graph Directories Allow shared directories and files. Links Resolve a link by locating the actual file or directory. Symbolic links Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved. 978-1-118-06333-0
21
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 21 File Path Names Absolute path name Begins with the root / Example: /usr/local/make Relative path name Search begins with the current directory. current directory.. parent directory Example: cd /usr ls local/make
22
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 22 File Path Names, cont’d Modern Operating Systems, 3 rd ed. Andrew Tanenbaum (c) 2008 Prentice-Hall, Inc.. 0-13-600663-9 All rights reserved
23
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 23 Mounting a File System Mount an external file system in order to access it. This file system can be located on another disk or on some external removable medium (such as a DVD ROM). Define a mount point in the current file system. Usually, it’s an empty directory.
24
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 24 Mounting a File System, cont’d Mount the external file system onto the mount point. Now the contents of the external file system appear under the directory name of the mount point. If the mount point was not an empty directory, the files that were stored in that directory are now hidden and inaccessible.
25
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 25 Mounting a File System, cont’d a) The current file system b) A volume on /devices/dsk Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved. 978-1-118-06333-0
26
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 26 Mounting a File System, cont’d The result of mounting /devices/dsk onto /users. The previous contents of /users are no longer accessible. Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved. 978-1-118-06333-0
27
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 27 File Protection The file owner or creator should be able to control: What can be done to the file By whom Types of access: Read Write Execute Append Delete List
28
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 28 File Protection in UNIX Types of access: read, write, execute (RWX) Three classes of users and sample access: RWX a) owner access 7 1 1 1 b) group access 6 1 1 0 c) public access4 1 0 0 For a particular file or directory (such as game ), define an appropriate access with the chmod command. ownergrouppublic chmod 764 game
29
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 29 File Protection in UNIX, cont’d Sample UNIX file listing via the ls command. Access rights to each file and directory are at the left.
30
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 30 Layered File System Architecture I/O control Device drivers Interrupt handlers Basic file system Issue generic commands to the device drivers. Manage memory buffers and caches that hold file system, directory, and data blocks. Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved. 978-1-118-06333-0
31
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 31 Layered File System Architecture, cont’d File-organization module Manage logical and physical blocks of files. Translate logical block addresses to physical block address. Logical file system Manage file metadata. File control blocks (UNIX inodes) Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved. 978-1-118-06333-0
32
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 32 File System Layout on Disk Master Boot Record (MBR) Located at sector 0 of the disk Used to boot the computer Contains the disk partition table Contains code to boot the computer The MBR code locates the active disk partition. Read and execute the boot block of the active partition. Load the operating system residing in the partition.
33
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 33 File System Layout on Disk, cont’d The superblock Contains key parameters about the file system that is read into main memory. File-control blocks (UNIX inodes) Array of data structures, one per file. Information about each file: Where its disk blocks are located, etc.
34
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 34 File System Layout on Disk, cont’d Root directory Other directories and files Modern Operating Systems, 3 rd ed. Andrew Tanenbaum (c) 2008 Prentice-Hall, Inc.. 0-13-600663-9 All rights reserved
35
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 35 Contiguous File Allocation Each file occupies a set of contiguous blocks. Usually best performance. Simple: Requires only the starting location (block #) and length (block count). Problems Finding space for file Knowing the file size External fragmentation Need for compaction Still used today on CD ROMs and DVDs. Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved. 978-1-118-06333-0
36
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 36 Linked File Allocation Each file is a linked list of blocks. No external fragmentation. No compaction. Each block contains a pointer to the next block. Free space management system called when a new block needed. Improve efficiency by clustering blocks into groups, but increases internal fragmentation. Locating a block can take many I/Os and disk seeks. Poor random access performance. Reliability can be a problem. Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved. 978-1-118-06333-0
37
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 37 File Allocation Table (FAT) At the beginning of a volume Indexed by block number Much like a linked list. Used by Microsoft Windows. Needs to be cached in memory for performance. Simple to allocate a new block. Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved. 978-1-118-06333-0
38
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 38 Indexed File Allocation Each file has its own index block, an array of disk-block addresses. No external fragmentation. Overhead of the index block. Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved. 978-1-118-06333-0
39
Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 39 UNIX Inode Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved. 978-1-118-06333-0 UNIX inode has pointers to: direct blocks single indirect blocks double indirect blocks triple indirect blocks
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.