SAZ4B/SAE5A Operating System Unit : I - V

Similar documents
Chapter 13: I/O Systems

Chapter 12: I/O Systems

Chapter 13: I/O Systems

Chapter 12: I/O Systems. Operating System Concepts Essentials 8 th Edition

I/O Systems. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic)

Chapter 13: I/O Systems. Operating System Concepts 9 th Edition

Chapter 13: I/O Systems

Chapter 13: I/O Systems

Device-Functionality Progression

Chapter 12: I/O Systems. I/O Hardware

Module 12: I/O Systems

Chapter 13: I/O Systems

Chapter 13: I/O Systems. Chapter 13: I/O Systems. Objectives. I/O Hardware. A Typical PC Bus Structure. Device I/O Port Locations on PCs (partial)

by I.-C. Lin, Dept. CS, NCTU. Textbook: Operating System Concepts 8ed CHAPTER 13: I/O SYSTEMS

Lecture 13 Input/Output (I/O) Systems (chapter 13)

CS370 Operating Systems

CS370 Operating Systems

CSE 4/521 Introduction to Operating Systems. Lecture 24 I/O Systems (Overview, Application I/O Interface, Kernel I/O Subsystem) Summer 2018

To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization

Module 12: I/O Systems

Chapter 13: I/O Systems

Chapter 8: Deadlocks. The Deadlock Problem

The Deadlock Problem. Chapter 8: Deadlocks. Bridge Crossing Example. System Model. Deadlock Characterization. Resource-Allocation Graph

Unit-03 Deadlock and Memory Management Unit-03/Lecture-01

CSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008.

Deadlock. Operating Systems. Autumn CS4023

ROEVER ENGINEERING COLLEGE, PERAMBALUR DEPARTMENT OF INFORMATION TECHNOLOGY OPERATING SYSTEMS QUESTION BANK UNIT-I

Lecture 1 Introduction (Chapter 1 of Textbook)

CSI3131 Final Exam Review

Deadlocks. Minsoo Ryu. Real-Time Computing and Communications Lab. Hanyang University.

Chapter 1: Introduction

Following are a few basic questions that cover the essentials of OS:

Chapter 1: Introduction

I/O Systems. 04/16/2007 CSCI 315 Operating Systems Design 1

Chapter 1: Introduction

CHAPTER NO - 1 : Introduction:

Chapter 13: I/O Systems

Chapter 7: Deadlocks. Operating System Concepts 8 th Edition,

The Deadlock Problem. A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set.

Course Details. Operating Systems with C/C++ Course Details. What is an Operating System?

QUESTION BANK UNIT I

CONTENTS. Computer-System Structures

Chapter 7: Deadlocks

7/20/2008. What Operating Systems Do Computer-System Organization

Module 1. Introduction:

Chapter 13: I/O Systems

System Model. Types of resources Reusable Resources Consumable Resources

Chapter 13: I/O Systems

The control of I/O devices is a major concern for OS designers

Chapter 7: Deadlocks. Operating System Concepts 8 th Edition,! Silberschatz, Galvin and Gagne 2009!

19.1. Security must consider external environment of the system, and protect it from:

Chapter 1: Introduction. Operating System Concepts 8th Edition,

CSE Opera+ng System Principles

COT 4600 Operating Systems Fall Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 3:00-4:00 PM

Chapter 1: Introduction. Chapter 1: Introduction

Che-Wei Chang Department of Computer Science and Information Engineering, Chang Gung University

Operating Systems. Lecture Course in Autumn Term 2015 University of Birmingham. Eike Ritter. September 22, 2015

Instruction Cycle. Computer-System Architecture. Computer-System Operation. Common Functions of Interrupts. Chapter 2: Computer-System Structures

November 13, Networking/Interprocess Communication (25 pts)

Module 20: Security. The Security Problem Authentication Program Threats System Threats Threat Monitoring Encryption. Operating System Concepts 20.


Chapter 7: Deadlocks. Operating System Concepts 8 th Edition,

MC7204 OPERATING SYSTEMS

OPERATING SYSTEMS: Lesson 1: Introduction to Operating Systems

Chapter 7: Deadlocks. Operating System Concepts with Java 8 th Edition

Main Points of the Computer Organization and System Software Module

The Deadlock Problem

CSE 421/521 - Operating Systems Fall Lecture - XXV. Final Review. University at Buffalo

Deadlocks. Operating System Concepts - 7 th Edition, Feb 14, 2005

Fall COMP3511 Review

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

Chapter 8: Deadlocks

Chapter 8: Deadlocks. The Deadlock Problem. System Model. Bridge Crossing Example. Resource-Allocation Graph. Deadlock Characterization

Chapter 7 : 7: Deadlocks Silberschatz, Galvin and Gagne 2009 Operating System Concepts 8th Edition, Chapter 7: Deadlocks

SPOS MODEL ANSWER MAY 2018

Process Synchronisation (contd.) Deadlock. Operating Systems. Spring CS5212

Department of Computer applications. [Part I: Medium Answer Type Questions]

Techno India Batanagar Department of Computer Science & Engineering. Model Questions. Multiple Choice Questions:

CS6401- OPERATING SYSTEM

Chapter 7: Deadlocks. Chapter 7: Deadlocks. The Deadlock Problem. Chapter Objectives. System Model. Bridge Crossing Example

Ref: Chap 12. Secondary Storage and I/O Systems. Applied Operating System Concepts 12.1

Module 7: Deadlocks. The Deadlock Problem. Bridge Crossing Example. System Model

Introduction. CS3026 Operating Systems Lecture 01

CS330: Operating System and Lab. (Spring 2006) I/O Systems

Chendu College of Engineering & Technology

Chapter 7: Deadlocks

Computer-System Architecture (cont.) Symmetrically Constructed Clusters (cont.) Advantages: 1. Greater computational power by running applications

Module 2: Computer-System Structures. Computer-System Architecture

Module 3. DEADLOCK AND STARVATION

Chapter 7: Deadlocks

Input/Output Management

European University of Lefke. Instructor: Dr. Arif SARI

Chapter 8: Memory- Management Strategies. Operating System Concepts 9 th Edition

Chapter 7: Deadlocks

The Deadlock Problem (1)

Final Exam Review. CPSC 457, Spring 2016 June 29-30, M. Reza Zakerinasab Department of Computer Science, University of Calgary

CSc33200: Operating Systems, CS-CCNY, Fall 2003 Jinzhong Niu December 10, Review

SNS COLLEGE OF ENGINEERING

Model answer of AS-4159 Operating System B.tech fifth Semester Information technology

Concurrency: Deadlock and Starvation. Chapter 6

Transcription:

SAZ4B/SAE5A Operating System Unit : I - V

TM Unit I: Contents Views, Goals & Types of system OS Structure, Components & Services System Structures &Layered Approach Virtual Machines System Design and Implementation. Process Management & Scheduling Cooperating Process,Threads Interprocess Communication. CPU Scheduling criteria & Algorithms 1

TM OS VIEWS A modern computer consists of: One or more processors Main memory Disks Printers Various input/output devices. Managing all these varied components requires a layer of software the Operating System (OS). 2

TM OS GOALS Control/execute user/application programs. Make the computer system convenient to use. Ease the solving of user problems. Use the computer hardware in an efficient manner. 3

Types of Operating Systems TM 1. Realtime Operating System (RTOS) 2. Singleuser, Single task 3. Singleuser, multitasking 4. Multiuser 4

TM OS Structure OS Layer Structure gives the internal design of operating system. 5

OS ComponentsTM Components used in operating system. 6

TM OS-Services The following are examples of services provided by an operating system: Context Switching & Scheduling, Memory Management Inter-process Communication File Systems High level I/O facilities 7

OS System Structure TM Operating system internal system structure 8

OS Layered Structure TM Layers starts from layer 0 to layer N functions and operations in lower level layer Used for modularization of OS Higher level invokes lower level layers Less layers provide more functionality 9

TM Virtual Machines It is completely isolated guest Operating System It creates an illusion of multiple processors each capable of executing independently. It has two categories: 1. System virtual machines. 2. Process virtual machines 10

OS System Design and TM Implementation At the highest level, system design is dominated by the choice of hardware and system type. Beyond this level, the requirements can be divided into two groups: user goals, and system goals. User goals include convenience, reliability, security, and speed. System goals include ease of design, implementation, maintenance, flexibility, and efficiency. 11

Process Management TM 12

Process Scheduling TM A process is an instance of a computer program that is being executed. It contains the program code and its current activity. Depending on the operating system (OS), a process may be made up of multiple threads of execution that execute instructions concurrently. 13

Cooperating process TM A process is independent if it cannot affect other other process or be affected by it. Any process that does not share data with others is independent. Otherwise the process is cooperating. Cooperation is done to provide information sharing, computational speedups, modularity and convenience. 14

Threads & Interprocess TM Communication A thread of execution is the smallest sequence of programmed instructions that can be managed independently by a scheduler, which is typically a part of the operating system. Inter-process communication (IPC) refers specifically to the mechanisms an operating system provides to allow the processes to manage shared data. 15

TM Scheduling Criteria and Algorithm Scheduling Criteria Scheduling Algorithm CPU utilization Throughput Turnaround Time Waiting Time Response Time https://www.youtube.com/ watch?v=6txxa3hbx8y 16

TM Unit II: Contents Process Synchronization: Critical-Section problem Synchronization Hardware Semaphores Classic Problems of Synchronization Critical Region Deadlock Characterization Methods for handling Deadlocks Prevention, Avoidance, and Detection of Deadlock Recovery from deadlock 17

Process Synchronization Process Synchronization means sharing system resources by processes in a such a way that, Concurrent access to shared data is handled thereby minimizing the chance of inconsistent data 18

Critical Section Problem 19

Semaphores A semaphore is a variable or abstract data type used to control access to a common resource by multiple processes in a concurrent system such as a multiprogramming operating system. concurrent accesses to shared resources can lead to unexpected or erroneous behavior, so parts of the program where the shared resource is accessed are protected. This protected section is the critical section or critical region. Semaphores Critical Region 20

Classification Problem of Synchronization Dining Philosophers problem is an example of synchronization problem 21

Deadlock A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set. Example - System has 2 tape drives - P1 and P2 each hold one tape drive and each needs another one. https://www.youtube.com/watch?v=8dc6zz6fkda 22

Deadlock Characterization Deadlock can arise if four conditions hold simultaneously. 1. Mutual exclusion: at least one process must be held in a nonsharable mode. 2. Hold and wait: there must be a process holding one resource and waiting for another. 3. No preemption: resources cannot be preempted. 4. Circular wait: There must exist a set {p 0, p 1,...p n } of waiting processes such that p 0 is waiting for a resource which is held by p 1, p 1 is waiting for a resource which is held by p 2,..., p n-1 is waiting for a resource which is held by p n and p n is waiting for a resource which is held by p 0. 23

Methods for Handling Deadlock Ensure that the system will never enter a deadlock state. Allow the system to enter a deadlock state and then recover. Ignore the problem and pretend that deadlocks never occur in the system; used by most operating systems, including UNIX. 24

Prevention, Avoidance and Detection of Deadlock Deadlock Prevention. Disallow one of the four necessary conditions for deadlock. Deadlock Avoidance. Do not grant a resource request if this allocation have the potential to lead to a deadlock. Deadlock Detection. Always grant resource request when possible. Periodically check for deadlocks. If a deadlock exists, recover from it. Ignore the problem... Makes sense if the likelihood is very low. 25

Recovery from Deadlock Process Termination Abort all deadlocked processes: - Fast - A lot of process work is lost. Abort one deadlocked process at a time and check for deadlocks again: - More work to resolve a deadlock. - Better in terms of process work. - What is a good order to abort processes? Resource Preemption what is a good way to select a victim How can we rollback and then recover from preemption? How can we protect from starvation 26

TM Unit III: Contents Memory Management & Address Binding Dynamic Loading and Linking Overlays Logical and Physical Address Space Contiguous Allocation Internal & External Fragmentation Non Contiguous Allocation Paging and Segmentation schemes Implementation, Hardware Protection Sharing Fragmentation. 27

Memory Management Memory management is the function responsible for managing the computer's primary memory. The memory management function keeps track of the status of each memory location, either allocated or free. When memory is allocated it determines which memory locations will be assigned. 28

Address Binding Address binding is the process of mapping the program's logical or virtual addresses to corresponding physical or main memory addresses. 29

Dynamic Loading and Linking Dynamic loading is a mechanism by which a computer program can, at run time, load a library into memory, retrieve the addresses of functions and variables contained in the library A dynamic linker is the part of an operating system that loads and links the shared libraries needed by an executable program. 30

Overlays Overlaying is a programming method that allows programs to be larger than the computer's main memory. An embedded system would normally use overlays because of the limitation of physical memory, which is internal memory for a system-on-chip, and the lack of virtual memory facilities. 31

Logical and Physical Address Space Logical address space is set of logical addresses that generated by a program. The physical address is address that seen by memory unit and used to access memory units. Virtual addresses are mapped with physical addresses by memory management unit. 32

Contiguous Allocation Relocation-register scheme used to protect user processes from each other, and from changing operatingsystem code and data. Relocation register contains value of smallest physical address; limit register contains range of logical addresses each logical address must be less than the limit register. https://www.youtube.com/watch?v=uejwx ynip2m 33

Non Contiguous Allocation The Non-contiguous memory allocation allows a process to acquire the several memory blocks at the different location in the memory according to its requirement. The noncontiguous memory allocation also reduces the memory wastage caused due to internal and external fragmentation. As it utilizes the memory holes, created during internal and external fragmentation. 34

Internal & External Fragmentation The disadvantage of contiguous memory allocation is fragmentation. There are two types of fragmentation, namely, Internal fragmentation and External fragmentation. Internal Fragmenation - allocated memory may be slightly larger than requested memory; this size difference is memory internal to a partition, but not being used.occurs when memory is allocated in fixed size pieces. External fragmentation - When the total memory space that is got by adding the scattered holes is sufficient to satisfy a request but it is not available contiguously, then this type of fragmentation is called external fragmentation. 35

Paging Physical address space of a process can be noncontiguous; process is allocated physical memory whenever the latter is available - Avoids external fragmentation - Avoids problem of varying sized memory chunks Divide physical memory into fixed-sized blocks called frames - Size is power of 2, between 512 bytes and 16 Mb Divide logical memory into blocks of same size called pages - To run a program of size N pages, need to find N free frames and load program - Set up a page table to translate logical to physical addresses -- Backing store likewise split into pages Still have Internal fragmentation 36

Segmentation schemes A Memory Management technique in which memory is divided into variable sized chunks which can be allocated to processes. Each chunk is called a Segment. Advantages of Segmentation: - No Internal fragmentation. - Segment Table consumes less space in comparison to Page table in paging. Disadvantage of Segmentation: - As processes are loaded and removed from the memory, the free memory space is broken into little pieces, causing External fragmentation. https://www.youtube.com/watch?v=gjfiuj3lm2o 37

Hardware Protection I/O Protection : All I/O instruction should be privileged instructions. The user can only perform I/O operations through the OS Memory Protection : Protect the OS from access by users program, protect user programs from each other. CPU Protection : A timer to prevent a user program from getting stuck in an infinite loop. 38

Sharing Sharing is a technique which enables many people, located at various terminals, to use a particular computer system at the same time. Time-sharing or multitasking is a logical extension of multiprogramming. Processor's time which is shared among multiple users simultaneously is termed as time-sharing. Advantages of Timesharing operating systems are as follows Provides the advantage of quick response. Reduces CPU idle time. Disadvantages of Time-sharing operating systems are as follows Problem of reliability. Question of security and integrity of user programs and data. 39

Fragmentation Reduce external fragmentation by compaction - Shuffle memory contents to place all free memory together in one large block - Compaction is possible only if relocation is dynamic, and is done at execution time Now consider that backing store has same fragmentation problems. Types of Fragmentations External Fragmentation total memory space exists to satisfy a request, but it is not contiguous Internal Fragmentation allocated memory may be slightly larger than requested memory; this size difference is memory internal to a partition, but not being used. 40

TM Unit IV: Contents Virtual Memory Demand Paging Page Replacement Algorithms Thrashing File System Concepts & Access methods Directory Structure Protection Consistency Semantics File System Structures Allocation methods Free Space Management 41

Virtual Memory o Virtual memory is a common part of operating system on desktop computers. o The team virtual memory refers to something which appears to be present but actually it is not o The virtual memory technique allows users to use more memory for a program than the real memory of a computer. 42

Demand Paging Demand paging is a method of virtual memory management. In a system that uses demand paging, the operating system copies a disk page into physical memory only if an attempt is made to access it and that page is not already in memory. It follows that a process begins execution with none of its pages in physical memory, and many page faults will occur until most of a process's working set of pages is located in physical memory. 43

Page Replacement Algorithm When a fault occurs, the OS loads the faulted page from disk into a page of memory. At some point, the process has used all of the page frames it is allowed to use. When this happens, the OS must replace a page for each page faulted in. That is, it must select a page to throw out of primary memory to make room. How it does this is determined by the page replacement algorithm. The goal of the replacement algorithm is to reduce the fault rate by selecting the best victim page to remove. 44

Thrashing If a process does not have enough pages, the page-fault rate is very high low CPU utilization OS thinks it needs increased multiprogramming adds another process to system Thrashing is when a process is busy swapping pages in and out 45

File System Concepts File System Interface The user level (more visible) portion of the file system. Access methods Directory Structure Protection File System Implementation The OS level (less visible) portion of the file system. Allocation and Free Space Management Directory Implementation https://www.youtube.com/watch?v=mzuymy7ihk0 46

File System- Access Methods Sequential access read all bytes/records from the beginning cannot jump around, could rewind or back up convenient when medium was magenatic tape Random access bytes/records read in any order essential for data base systems read can be move file marker (seek), then read or read and then move file marker https://www.youtube.com/watch?v=zg-t2zqq9ye 47

Directory Structure A single level directory system Two level directory system Tree directory system Single level directory system Two level directory system Tree directory system 48

File System Structures Three kinds of files byte sequence record sequence tree (a) An executable file (b) An archive 49

Allocation Methods The main idea behind allocation is effective utilization of file space and fast access of the files. There are three types of allocation: - contiguous allocation - linked allocation - Indexed allocation To keep track of the free space, the file system maintains a free-space list which tracks all the disk blocks which are free. To create a file, the required space is reserved for the file and the corresponding space is removed from the free list linked to each other. 50

Free Space Management 51

TM Unit V: Contents I/O Systems Overview I/O Hardware Application I/O Interface Kernel I/O subsystem Transforming I/O Requests to Hardware Operations Performance of I/O System Secondary Storage Structures Protection, Goals, Domain Access matrix Security problem, Authentication Threats, Threat Monitoring, Encryption 52

I/O System - Overview I/O management is a major component of operating system design and operation Important aspect of computer operation I/O devices vary greatly Various methods to control them Performance management New types of devices frequent Ports, busses, device controllers connect to various devices Device drivers encapsulate device details Present uniform device-access interface to I/O subsystem 53

I/O hardware Incredible variety of I/O devices Storage Transmission Human-interface Common concepts signals from I/O devices interface with computer Sometimes integrated Sometimes separate circuit board (host adapter) Contains processor, microcode, private memory, bus controller, etc Some talk to per-device controller with bus controller, microcode, memory, etc 54

Application I/O Interface I/O system calls encapsulate device behaviors in generic classes Device-driver layer hides differences among I/O controllers from kernel New devices talking already-implemented protocols need no extra work Each OS has its own I/O subsystem structures and device driver frameworks Devices vary in many dimensions Character-stream or block Sequential or random-access Synchronous or asynchronous (or both) Sharable or dedicated Speed of operation read-write, read only, or write only 55

Kernel I/O Subsystem Scheduling Some I/O request ordering via per-device queue Some OSs try fairness Some implement Quality Of Service (i.e. IPQOS) Buffering - store data in memory while transferring between devices To cope with device speed mismatch To cope with device transfer size mismatch To maintain copy semantics Double buffering two copies of the data Kernel and user Varying sizes Full / being processed and not-full / being used Copy-on-write can be used for efficiency in some cases 56

Transforming I/O Requests to Hardware Operations Consider reading a file from disk for a process: Determine device holding file Translate name to device representation Physically read data from disk into buffer Make data available to requesting process Return control to process 57

I/O System Performance I/O a major factor in system performance: Demands CPU to execute device driver, kernel I/O code Context switches due to interrupts Data copying Network traffic especially stressful To improve performance - Reduce number of context switches - Reduce data copying - Reduce interrupts by using large transfers, smart controllers, polling - Use DMA - Use smarter hardware devices - Balance CPU, memory, bus, and I/O performance for highest throughput 58

Secondary Storage Structures Main memory only large storage media that the CPU can access directly. Secondary storage Extension of main memory that provides large nonvolatile storage capacity. Magnetic disks Rigid metal or glass platters covered with magnetic recording material. - Disk surface is logically divided into tracks, which are subdivided into sectors. - The disk controller determines the logical interaction between the device and the computer 59

Storage Protection Security and Protection services Protect OS from users Protect users from other users Prevent unauthorized entry to system Prevent unauthorized system use y authorized users. https://www.youtube.com/watch?v=h9kv2emjzxe 60

Storage System - Goals Describe factors that determine storage device performance. Choose appropriate secondary storage devices and their technologies Outlines characteristics common to all storage devices. Explains the technology strengths and weaknesses of primary storage an secondary storage. https://www.youtube.com/watch?v=kmets6onooi 61

Domain Access matrix CPU does not transfer data, only initiates operation DMA controller transfers data directly to/from main memory Interrupts when transfer completed Input protocol: https://www.youtube.com/watch?v=soy8fwt5uo4 62

Storage security problem Secure : resources use an accessed as intended under all circumstances Intruders (Crakers) : attempt to breach security Threat is potential security violation Attack is attempt to breach security Attack can e accidental or malicious Easier to protect against accidental than malicious. 63

Authentication Authentication is a process in which the credentials provided are compared to those on file in a database of authorized users information on a local operating system or within an authentication server. If the credentials match, the process is completed and the user is granted authorization for access. Types of Authentications User authentication Machine authentication Password-based authentication 64

Threats System threats refers to misuse of system services and network connections to put user in trouble. System threats can be used to launch program threats on a complete network called as program attack. System threats creates such an environment that operating system resources/ user files are misused. Following is the list of some well-known system threats. Worm Worm is a process which can choked down a system performance by using system resources to extreme levels. Port Scanning Port scanning is a mechanism or means by which a hacker can detects system vulnerabilities to make an attack on the system. Denial of Service Denial of service attacks normally prevents user to make legitimate use of the system. For example, a user may not be able to use internet if denial of service attacks browser's content settings. 65

Threat Monitoring Check for suspicious patterns of activity i.e., several incorrect password attempts may signal password guessing. Audit log records the time, user and type of all accesses to an object Scan the system periodically for security holes, done when the computer is relatively unused. 66

Encryption The translation of data into a secret code. Encryption is the most effective way to achieve data security. To read an encrypted file, you must have access to a secret key or password that enables you to decrypt it. Unencrypted data is called plain text ; encrypted data is referred to as cipher text. There are two main types of encryption: 1. Asymmetric encryption (also called public-key encryption) 2. Symmetric encryption. https://www.youtube.com/watch?v=beb_anpwpwy 69