Review for Quiz-2 Applied Operating System Concepts Chap.s 1,2,6,7 - ECE3055b, Spring 2005.

Slides:



Advertisements
Similar presentations
Chapter 7: Deadlocks.
Advertisements

Chapter 7: Deadlocks.
Chap 5 Process Scheduling. Basic Concepts Maximum CPU utilization obtained with multiprogramming CPU–I/O Burst Cycle – Process execution consists of a.
Chapter 5 CPU Scheduling. CPU Scheduling Topics: Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 7: Deadlocks.
5/25/2015Page 1 Deadlock Management B. Ramamurthy.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks.
1 CMSC421: Principles of Operating Systems Nilanjan Banerjee Principles of Operating Systems Acknowledgments: Some of the slides are adapted from Prof.
Review: Chapters 1 – Chapter 1: OS is a layer between user and hardware to make life easier for user and use hardware efficiently Control program.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 8: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks.
1 Wednesday, June 28, 2006 Command, n.: Statement presented by a human and accepted by a computer in such a manner as to make the human feel that he is.
Chapter 7: Deadlocks. 7.2 Chapter Objectives To develop a description of deadlocks, which prevent sets of concurrent processes from completing their tasks.
1 Chapter 7: Deadlock. 2 The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
02/19/2008CSCI 315 Operating Systems Design1 Deadlock Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 Chapter 7: Deadlocks The Deadlock.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 7: Deadlocks.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Bridge Crossing Example Traffic only in one direction. Each section.
Deadlocks Gordon College Stephen Brinton. Deadlock Overview The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks.
What we will cover…  The Deadlock Problem  System Model  Deadlock Characterization  Methods for Handling Deadlocks  Deadlock Prevention  Deadlock.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Chapter 1. Introduction What is an Operating System? Mainframe Systems
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Deadlocks.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 8: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks.
SWE202 Review. Processes Process State As a process executes, it changes state – new: The process is being created – running: Instructions are being.
System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention, Avoidance, and Detection Recovering from Deadlock Combined Approach.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks Modified.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks.
Chapter 7 Deadlocks. 7.2 Modified By Dr. Khaled Wassif Operating System Concepts – 7 th Edition Silberschatz, Galvin and Gagne ©2005 Chapter 7: Deadlocks.
Cosc 4740 Chapter 6, Part 4 Deadlocks. The Deadlock Problem A set of blocked processes each holding a resource and waiting to acquire a resource held.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-6 Deadlocks Department of Computer Science and Software Engineering.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 AE4B33OSS Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria.
1 11/29/2015 Chapter 6: CPU Scheduling l Basic Concepts l Scheduling Criteria l Scheduling Algorithms l Multiple-Processor Scheduling l Real-Time Scheduling.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks.
 The Deadlock Problem  System Model  Deadlock Characterization  Methods for Handling Deadlocks  Deadlock Prevention  Deadlock Avoidance  Deadlock.
Dr. Kalpakis CMSC 421, Operating Systems Deadlocks.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 Chapter 7: Deadlocks The Deadlock.
Deadlocks System Model RAG Deadlock Characterization
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 7: Deadlocks System Model Deadlock Characterization Methods.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 7 Operating Systems.
Operating Systems Unit VI Deadlocks and Protection Department of Computer Science Engineering and Information Technology.
Chapter 8 Deadlocks. Objective System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection.
Chapter 7: Deadlocks. 7.2CSCI 380 – Operating Systems Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling.
7.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock.
Chap 7 Deadlocks. Chapter Objectives To develop a description of deadlocks, which prevent sets of concurrent processes from completing their tasks To.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 6 Deadlocks Slide 1 Chapter 6 Deadlocks.
Deadlock. Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock.
7.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 7: Deadlocks.
Silberschatz, Galvin and Gagne ©2009 Edited by Khoury, 2015 Operating System Concepts – 9 th Edition, Chapter 7: Deadlocks.
1 Module 5: Scheduling CPU Scheduling Scheduling Algorithms Reading: Chapter
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 Chapter 7: Deadlocks The Deadlock.
Chapter 7: Deadlocks. The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks.
Chapter 7: Deadlocks.
Applied Operating System Concepts
Applied Operating System Concepts -
Chapter 7: Deadlocks Source & Copyright: Operating System Concepts, Silberschatz, Galvin and Gagne.
Chapter 1: Intro (excerpt)
Deadlock B.Ramamurthy CSE421 1/11/2019 B.Ramamurthy.
Deadlock B.Ramamurthy CSE421 2/23/2019 B.Ramamurthy.
Deadlock B.Ramamurthy CSE421 4/23/2019 B.Ramamurthy.
Deadlock B.Ramamurthy CSE421 5/1/2019 B.Ramamurthy.
Chapter 8: Deadlocks Deadlock Characterization
Deadlock B.Ramamurthy CSE421 8/28/2019 B.Ramamurthy.
Deadlock B.Ramamurthy CSE421 9/3/2019 B.Ramamurthy.
Presentation transcript:

Review for Quiz-2 Applied Operating System Concepts Chap.s 1,2,6,7 - ECE3055b, Spring 2005

What is an operating system? Simple Batch Systems Multiprogramming Batched Systems Time-Sharing Systems Personal-Computer Systems Parallel Systems Distributed Systems Real -Time Systems 2

What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer hardware. Operating system goals: –Execute user programs and make solving user problems easier. –Make the computer system convenient to use. Use the computer hardware in an efficient manner. Make it easy to write programs by handling common tasks like text editing and file-selection dialog boxes. 3

1.Hardware – provides basic computing resources (CPU, memory, I/O devices). 2.Operating system – controls and coordinates the use of the hardware among the various application programs for the various users. 3.Applications programs – define the ways in which the system resources are used to solve the computing problems of the users (compilers, database systems, video games, business programs). 4.Users (people, machines, other computers). Computer System Components 4

OS Features Needed for Multiprogramming I/O routine supplied by the system. Memory management – the system must allocate the memory to several jobs. CPU scheduling – the system must choose among several jobs ready to run. Allocation of devices. Types: Batch, Parallel, Real Time, Interactive (special features) 5

Module 2: Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection General System Architecture 6

I/O devices and the CPU can execute concurrently. Each device controller is in charge of a particular device type. Each device controller has a local buffer. CPU moves data from/to main memory to/from local buffers I/O is from the device to local buffer of controller. Device controller informs CPU that it has finished its operation by causing an interrupt. Interrupt transfers control to the interrupt service routine generally, through the interrupt vector, which contains the addresses of all the service routines. Interrupt architecture must save the address of the interrupted instruction. Incoming interrupts are disabled while another interrupt is being processed to prevent a lost interrupt. A trap is a software-generated interrupt caused either by an error or a user request. An operating system is interrupt driven. Interrupts 7

8 Module 5: Threads Thread Management Done by User-Level Threads Library Examples - POSIX Pthreads - Mach C-threads - Solaris threads Supported by the Kernel Examples - Windows 95/98/NT - Solaris - Digital UNIX

9 Solaris 2 Threads

Java Thread Management 10 suspend() – suspends execution of the currently running thread. sleep() – puts the currently running thread to sleep for a specified amount of time. resume() – resumes execution of a suspended thread. stop() – stops execution of a thread.

UNIX (POSIX) THREAD MANAGEMENT 11 MAIN() thread ptread_create() pthread_join() thread-1 terminates pthread_exit() I/O block

Classical Problems 12 Producer-Consumer (Bounded-Buffer) Readers-Writers Dining Philosophers Resource Allocation Mutual Exclusion Critical Sections

13 Module 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation Maximum CPU utilization obtained with multiprogramming CPU–I/O Burst Cycle – Process execution consists of a cycle of CPU execution and I/O wait. CPU burst distribution

Histogram of CPU-burst Times 14

CPU Scheduler Selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them. CPU scheduling decisions may take place when a process: 1.Switches from running to waiting state. 2.Switches from running to ready state. 3.Switches from waiting to ready. 4.Terminates. Scheduling under 1 and 4 is nonpreemptive. All other scheduling is preemptive. 15

Find the order of processing and the run times for P1 (3 ticks), P2 (5 ticks), P3 (4 ticks), and P4 (1 tick) using (delta = 2 ticks, *where applicable) First-Come, First-Served (FCFS) Scheduling Shortest-Job-First (SJR) Scheduling Preemptive* Non-preemptive Round Robin* ========================================= Find the exponential average T of the last 5 burst lengths (67, 89, 13, 56, 45) using a factor a =0.8 (67 is most recent) T = a*67 + a^2*89 + a^3*13 + a^4 * 56 + a^5 * 45 = a * ( 67 + a*( 89 + a*( 13 + a*(56 + a*( ))))) Find the next value if t=76 using one * and one + operation. T = a * ( 76 + ) 16

Thread Scheduling Local Scheduling – How the threads library decides which thread to put onto an available LWP. Global Scheduling – How the kernel decides which kernel thread to run next. JAVA –JVM Uses a Preemptive, Priority-Based Scheduling Algorithm –FIFO Queue is Used if There Are Multiple Threads With the Same Priority. JVM Schedules a Thread to Run When: –The Currently Running Thread Exits the Runnable State. –A Higher Priority Thread Enters the Runnable State JVM Does Not Specify Whether Threads are Time-Sliced or Not. 17

Module 8: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined Approach to Deadlock Handling 18

Deadlock can arise if four conditions hold simultaneously. Mutual exclusion: only one process at a time can use a resource. Hold and wait: a process holding at least one resource is waiting to acquire additional resources held by other processes. No preemption: a resource can be released only voluntarily by the process holding it, after that process has completed its task. Circular wait: there exists a set {P0,P1,...,Pn} of waiting processes such that P0 is waiting for a resource that is held by P1, P1 is waiting for a resource that is held by P2,... 19

Resource Allocation Graph 20

Example of a Graph With Cycle 21

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. Methods for Handling Deadlocks 22

Requires that the system has some additional a priori information available. Simplest and most useful model requires that each process declare the maximum number of resources of each type that it may need. The deadlock-avoidance algorithm dynamically examines the resource-allocation state to ensure that there can never be a circular-wait condition. Resource-allocation state is defined by the number of available and allocated resources, and the maximum demands of the processes. Deadlock Avoidance 23

Example of Banker’s Algorithm Which Order can P’s Run? (P1, P3, P4, P2, P0) What resources are available after P3 runs? ( 7 4 3) 24

Allow system to enter deadlock state Detection algorithm Recovery scheme Deadlock Detection Security Must be considered in: Computer Hardware design Operating System Design Application Software Design All of the Above 25