An overview of the kernel structure

Slides:



Advertisements
Similar presentations
Chapter 12: File System Implementation
Advertisements

Chapter 4 : File Systems What is a file system?
1 UNIX 1 History of UNIX 2 Overview of UNIX 3 Processes in UNIX 4 Memory management in UNIX 5 The UNIX file system 6 Input/output in UNIX.
1 Case Study 1: UNIX and LINUX Chapter History of unix 10.2 Overview of unix 10.3 Processes in unix 10.4 Memory management in unix 10.5 Input/output.
File System Implementation: beyond the user’s view A possible file system layout on a disk.
Yukon Chang, Fall 1996 Operating System (II) Chapter 11 Supplement Slide 1 UNIX File System Layout u boot block contains bootstrap code that is read into.
Files. System Calls for File System Accessing files –Open, read, write, lseek, close Creating files –Create, mknod.
Introduction to Kernel
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
6/24/2015B.RamamurthyPage 1 File System B. Ramamurthy.
1 File Management in Representative Operating Systems.
Operating Systems File systems
7/15/2015B.RamamurthyPage 1 File System B. Ramamurthy.
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.
1Fall 2008, Chapter 11 Disk Hardware Arm can move in and out Read / write head can access a ring of data as the disk rotates Disk consists of one or more.
Chapter 4. INTERNAL REPRESENTATION OF FILES
File System Review bottomupcs.com J. Kubiatowicz, UC Berkeley.
File Systems CSCI What is a file? A file is information that is stored on disks or other external media.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
UNIX Files File organization and a few primitives.
Chapter 4. INTERNAL REPRESENTATION OF FILES
Files & File system. A Possible File System Layout Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved
CE Operating Systems Lecture 17 File systems – interface and implementation.
1 Chapter 4. INTERNAL REPRESENTATION OF FILES THE DESIGN OF THE UNIX OPERATING SYSTEM Maurice J. bach Prentice Hall.
Why Do We Need Files? Must store large amounts of data. Information stored must survive the termination of the process using it - that is, be persistent.
File Systems. 2 What is a file? A repository for data Is long lasting (until explicitly deleted).
Linux File system Implementations
Operating Systems, Spring 2003 Local File Systems in UNIX Ittai Abraham Zinovi Rabinovich (recitation)
THE FILE SYSTEM Files long-term storage RAM short-term storage Programs, data, and text are all stored in files, which is stored on.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Lecture 19 Linux/Unix – File System
Linux file systems Name: Peijun Li Student ID: Prof. Morteza Anvari.
1 Process Description and Control Chapter 3. 2 Process A program in execution An instance of a program running on a computer The entity that can be assigned.
File Systems.  Issues for OS  Organize files  Directories structure  File types based on different accesses  Sequential, indexed sequential, indexed.
MINIX Presented by: Clinton Morse, Joseph Paetz, Theresa Sullivan, and Angela Volk.
Part III Storage Management
File System Department of Computer Science Southern Illinois University Edwardsville Spring, 2016 Dr. Hiroshi Fujinoki CS 314.
W4118 Operating Systems Instructor: Junfeng Yang.
File Systems and Disk Management
File-System Management
EXT in Detail High-Performance Database Research Center
Introduction to Kernel
Chapter 11: File System Implementation
Structure of Processes
Protection of System Resources
Day 27 File System.
File System Implementation
File System Structure How do I organize a disk into a file system?
Filesystems.
Operating Systems: What and Why
File Management.
Structure of Processes
Chapter 11: File System Implementation
File Structure 2018, Spring Pusan National University Joon-Seok Kim
File System B. Ramamurthy B.Ramamurthy 11/27/2018.
Computer-System Architecture
Module 2: Computer-System Structures
Process Description and Control
Advanced UNIX progamming
Module 2: Computer-System Structures
UNIX File Systems (Chap 4. in the book “the design of the UNIX OS”)
File Management System Simulation
Module 2: Computer-System Structures
Department of Computer Science
Module 2: Computer-System Structures
Internal Representation of Files
Structure of Processes
Chapter 12: File-System Implementation CSS503 Systems Programming
Lecture Topics: 11/20 HW 7 What happens on a memory reference Traps
Mr. M. D. Jamadar Assistant Professor
Presentation transcript:

An overview of the kernel structure

UNIX File Types Most files on a UNIX system are either regular files or directories, but there are additional types of files. The types are: Regular file. Directory file Block special file Character special file FIFO Socket Symbolic link.

File type macros in <sys/stat.h> Macro Type of file S_ISREG() regular file S_ISDIR() directory file S_ISCHR() character special file S_ISBLK() block special file S_ISFIFO() pipe or FIFO S_ISLNK() symbolic link S_ISSOCK() socket

FILE SUBSYSTEM A file system consists of a sequence of logical blocks, each containing 512, 1024, 2048, or any convenient multiple of 512 bytes, depending on the system implementation. The size of a logical block is homogeneous within a file system but may vary between different file systems in a system configuration. Using large logical blocks increases the effective data transfer rate between disk and memory, because the kernel can transfer more data per disk operation and therefore make fewer time-consuming operations. For example, reading 1K bytes from a disk in one read operation is faster than reading 512 bytes twice. However, if a logical block is too large,effective storage capacity may drop.

FILE SUBSYSTEM

The boot block occupies the beginning of a file system, typically the first sector, and may contain the bootstrap code that is read into the machine to boot, or initialize, the operating system. Although only one boot block is needed to boot the system, every file system has a (possibly empty) boot block. The super block describes the state of a file system - how large it is, how many files it can store, where to find free space on the file system, and other information.

The inode list is a list of inodes that follows the super block in the file system. Administrators specify the size of the inode list when configuring a file system. The kernel references inodes by index into the inode list. The data blocks start at the end of the inode list and contain file data and administrativedata. An allocated data block can belong to one and only one file in the file system.

The i-node contains all the information about the file: the file type, the file's access permission bits, the size of the file, pointers to the data blocks for the file, and so on. Most of the information in the stat structure is obtained from the i-node.

INTERNAL REPRESENTATION OF A FILE

The internal representation of a file is given by an inode,which contains a description of the disk layout of the file data and other information such as -file owner -access permissions -access times. Ex: open(“/fs2/mjb/rje/sourcefile”,1);

File sharing The UNIX System supports the sharing of open files among different processes 1.Every process has an entry in the process table. a. The file descriptor flags b. A pointer to a file table entry 2. The kernel maintains a file table for all open files. Each file table entry contains a. The file status flags for the file, such as read, write, append, sync, and non blocking. b. The current file offset. c. A pointer to the v-node table entry for the file 3. Each open file (or device) has a v-node structure that contains information about the type of file and pointers to functions that operate on the file.

Two independent processes with the same file open

UNIX SYSTEM CALL Typically, UNIX kernels execute the following secure seven steps on a system call: Arguments (if present) for the system call are determined. Arguments (if present) for the system call are pushed in a stack. 3. The state of calling process is saved in a user structure. 4. The process switches to kernel mode. 5. The system call vector is used as an interface to the kernel routine. 6. The kernel initiates the services routine and a return value is obtained from the 7. Kernel service routine. 8. The return value is converted to a c version (usually an integer or a long integer).

An Example of a System Call User process executes a system call open a file. • User process links to a c runtime library for open and sets up the needed parameters in registers. • A S/W trap is executed now and the operation switches to the kernel mode. - The kernel looks up the system call vector to call "open" - The kernel tables are modified to open the file. - Return to the point of call with exit status. • Return to the user process with value and status. • The user process may resume now with modified status on file or abort on error with exit status.