Mr. M. D. Jamadar Assistant Professor

Slides:



Advertisements
Similar presentations
UNIX File Systems (Chap 4. in the book “the design of the UNIX OS”) Acknowledgement : Soongsil Univ. Presentation Materials.
Advertisements

CMPT 300: Final Review Chapters 8 – Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.
Process Description and Control
Introduction to Kernel
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
OS Spring’03 Introduction Operating Systems Spring 2003.
Unix & Windows Processes 1 CS502 Spring 2006 Unix/Windows Processes.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
1 I/O Management in Representative Operating Systems.
Chapter 3 Buffer Cache TOPICS UNIX system Architecture Buffer Cache
OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements.
Chapter 4. INTERNAL REPRESENTATION OF FILES
10/23/ File System Architecture. 10/23/ / bin unixdev etc user jim mike x y z tty00 tty01 File System architecture.
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.
LINUX System : Lecture 7 Bong-Soo Sohn Lecture notes acknowledgement : The design of UNIX Operating System.
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
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
1 Chapter 4. INTERNAL REPRESENTATION OF FILES THE DESIGN OF THE UNIX OPERATING SYSTEM Maurice J. bach Prentice Hall.
Linux File system Implementations
Process Description and Control Chapter 3. Source Modified slides from Missouri U. of Science and Tech.
Introduction Contain two or more CPU share common memory and peripherals. Provide greater system throughput. Multiple processor executing simultaneous.
General overview of the Unix System Kernel Sub In-charge: Mr. V. V. Bhujade Dept. of CSE DMIETR, Wardha.
OPERATING SYSTEMS STRUCTURES Jerry Breecher 2: Operating System Structures 1.
File-System Management
Introduction to Kernel
Chapter 3 Buffer Cache TOPICS UNIX system Architecture Buffer Cache
Chapter 2: Computer-System Structures(Hardware)
Chapter 2: Computer-System Structures
Process concept.
Process Management Process Concept Why only the global variables?
Chapter 11: File System Implementation
Chapter 9: Virtual Memory
Structure of Processes
The Buffer Cache.
Chapter 2: System Structures
Lecture Topics: 11/1 Processes Process Management
Chapter 11: File System Implementation
Buffer Cache.
Intro to Processes CSSE 332 Operating Systems
KERNEL ARCHITECTURE.
System Structure and Process Model
System Structure and Process Model
Structure of Processes
System Structure B. Ramamurthy.
CPSC 457 Operating Systems
Chapter 11: File System Implementation
System Structure and Process Model
Module 2: Computer-System Structures
Process Description and Control
Lecture Topics: 11/1 General Operating System Concepts Processes
Process Description and Control
Process Description and Control
Chapter 2: Operating-System Structures
Introduction to Operating Systems
Process Description and Control
Module 2: Computer-System Structures
LINUX System : Lecture 7 Lecture notes acknowledgement : The design of UNIX Operating System.
Processes in Unix and Windows
Chapter 2 Processes and Threads 2.1 Processes 2.2 Threads
UNIX File Systems (Chap 4. in the book “the design of the UNIX OS”)
Chapter 11: File System Implementation
Chapter 2: Computer-System Structures
Chapter 2: Computer-System Structures
Module 2: Computer-System Structures
Chapter 2: Operating-System Structures
Module 2: Computer-System Structures
Memory Management and I/O Subsystem
Internal Representation of Files
Structure of Processes
Presentation transcript:

Mr. M. D. Jamadar Assistant Professor Introduction to Unix Mr. M. D. Jamadar Assistant Professor

Architecture of Unix OS

Unix File System The UNIX file system Characterized by A Hierarchical structure, Consistent treatment of file data, The ability to create and delete file, Dynamic growth of the file, The protection of the data, The treatment of peripheral devices as files

OS Services Controlling the execution of process by allowing their creation, termination or suspension, and communication Scheduling Processes fairly for execution on the CPU. Allocating Main memory for an executing process Allocating secondary memory for efficient storage and retrieval of user data. Allowing processes controlled access to peripheral devices such as terminals, tape driver, disk driver, and network devices

Block Diagram of System Kernel

Overview of File Subsystem The File System Has the following Structure The boot block occupies the beginning of a file system, may contain the bootstarp code that is read into the machine to boot or initialize the OS The Super Block Describes the state of a file system—How large it is , how many no. of files it an store, where to find free space, and so on The inode List is a list of inodes. Administrators specify the size of the inode list when configuring a file system. The data Block Start sat the end of the inode list and contain file data and administrative data.

Process Control SubSystem Fields in the Process Table A State Field ID Indicating the owner Event descriptor set when a process is suspended Fields in the u-Area A pointer to the process table slot of the current executing process Parameters of the current system call, return value and error codes, File descriptors for all open files, Internal I/o Parameters, Current directory and current root Process and file size limit

Process Control SubSystem

Process States The process is currently executing in user mode. The process is currently executing in kernel mode. The process is not executing, but it is ready to run as soon as the scheduler chooses it. The process is sleeping.

The Buffer Cache

Buffer Cache During System Initialization, The Kernel allocates space for a number of buffers, configurable according to memory performance constraints. A buffer consist of two parts A memory (Data) array Buffer Header There is a one to one mapping of buffer headers to data array hence collectively called as “Buffer”. The buffer is the in-memory copy of the disk block. The kernel identifies the buffer content by examining identifier field in the buffer header. The content of disk block map into the buffer, but mapping is temporary until the kernel decides to map another disk block into the buffer. A disk block can never map into more than one buffer

Buffer Header The Status of a buffer is a combination of the following condition The buffer is currently locked The buffer contains valid data The kernel must write the buffer content to the disk before reassigning the buffer the condition is known as “Delayed Write.” The kernel is reading or writing the content of the buffer to the disk A process is currently waiting for the buffer to become free

Buffer Pool Buffer Pool Free List The kernel caches data in the buffer pool according to a least recently used algorithm After it allocates a buffer to a disk block, it cannot use the buffer for another block until all other buffer have been used more recently. The kernel maintains a free list of buffers that preserves the least recently used order The free list is a doubly linked circular list of buffers with dummy buffer header that marks its beginning and end. Every buffer is put on the free list when the system is booted. The kernel takes a buffer from head of the free list when it wants any free buffer, but it can take a buffer from the middle of the free list if it identifies a particular block in the buffer pool

Buffer Pool Cont….. When the kernel accesses a disk block, it searches for a buffer with the appropriate device – block number combination It organizes the buffers into separate queues, hashed as a function of the device and block number. The kernel links the buffer on a hash queue into a circular, doubly linked list. The kernel uses a hashing function that distributes the buffers uniformly across the set of hash queues System administrators configure the number of hash ques when generating the OS.

Scenarios for Retrieval of Buffer High-level kernel algorithm in the file subsystem invoke the algorithms for managing the buffer cache. The high level algorithm determines the logical device number and block number to retrieve the block The kernel checks weather the block is in the buffer pool and, if it is not there, assigns it a free buffer. The algorithms for reading and writing disk block use the algorithm getblk to allocate buffer from the pool. Scenarios the kernel may follow in getblk to allocate a buffer for a disk block The kernel finds the block on its hash queue, and its buffer is free The kernel cannot find the block on the hash queue and, so it allocates a buffer from the free list. The kernel cannot find the block on the hash queue and, finds a buffer on the free list that has been marked “Delayed write”. The kernel cannot find the block on the hash queue, and the free list is empty The kernel find the block on the hash queue, but its buffer is currently busy

Scenarios for Retrieval of Buffer Scenario 1: The kernel finds the block on its hash queue, and its buffer is free

Scenarios for Retrieval of Buffer Scenario 2: The kernel cannot find the block on the hash queue and, so it allocates a buffer from the free list.

Scenarios for Retrieval of Buffer Scenario 3: The kernel cannot find the block on the hash queue and, finds a buffer on the free list that has been marked “Delayed write”.

Scenarios for Retrieval of Buffer Scenario 4: The kernel cannot find the block on the hash queue, and the free list is empty

Scenarios for Retrieval of Buffer Scenario 5: The kernel find the block on the hash queue, but its buffer is currently busy

Algorithm for buffer allocation

Algorithm for releasing a buffer Buffer is old when it is marked “Delayed Write”

Algorithm for Reading a Disk Block Steps for BREAD Algorithm Process uses algorithm getblk to search for block in the buffer cache, if it is in the cache, the kernel returns it immediately.(Without Reading from disk) If it is not in the cache, the kernel calls the disk driver to schedule a read request and goes to sleep The disk driver notifies the disk controller hardware to read data The disk controller transmits the data to the buffer The disk controller interrupts the processor when the I/O is complete and the disk interrupt handler awakens the sleeping process

Algorithm for Block Read Ahead Higher level kernel module (file subsystem) may anticipate the need for a second disk block when a process read a file sequentially. The module request the second I/O asynchronously In the hope that the data will be in memory when needed, improving performance. To do this the kernel executes the block read-ahead algorithm(breada)

Algorithm for Writing a Disk Block Steps for Buffer Write The kernel informs the disk driver that it has buffer whose content should be output(Write) The disk driver schedules the block for I/O. If the write is synchronous, the calling process goes to sleep awaiting I/O completion and release the buffer when it awaken If the write is asynchronous, the kernel starts the disk write but doesn't wait for the I/O to complete. The kernel will release the buffer when the I/O Completes

References The design of Unix Operating System - Maurice J. Bach (PHI)