Unit 4: Processes, Threads & Deadlocks June 2012 Kaplan University 1.

Slides:



Advertisements
Similar presentations
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Advertisements

Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community.
Chapter 3 Process Description and Control
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
Chapter 4 Threads, SMP, and Microkernels Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design.
Chapter 6 Concurrency: Deadlock and Starvation
1 CMSC421: Principles of Operating Systems Nilanjan Banerjee Principles of Operating Systems Acknowledgments: Some of the slides are adapted from Prof.
Computer Systems/Operating Systems - Class 8
6/9/2015B.Ramamurthy1 Process Description and Control B.Ramamurthy.
1 Threads, SMP, and Microkernels Chapter 4. 2 Process: Some Info. Motivation for threads! Two fundamental aspects of a “process”: Resource ownership Scheduling.
Process Description and Control
Process Description and Control Module 1.0. Major Requirements of an Operating System Interleave the execution of several processes to maximize processor.
Process Description and Control Chapter 3. Major Requirements of an Operating System Interleave the execution of several processes to maximize processor.
Page 1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
Modified from Silberschatz, Galvin and Gagne Lecture 13 Chapter 7: Deadlocks.
Concurrency: Deadlock & Starvation
1 Process Description and Control Chapter 3. 2 Process Management—Fundamental task of an OS The OS is responsible for: Allocation of resources to processes.
CPSC 4650 Operating Systems Chapter 6 Deadlock and Starvation
Chapter 11 Operating Systems
1 Concurrency: Deadlock and Starvation Chapter 6.
1 Chapter 4 Threads Threads: Resource ownership and execution.
Process Description and Control A process is sometimes called a task, it is a program in execution.
1 Threads Chapter 4 Reading: 4.1,4.4, Process Characteristics l Unit of resource ownership - process is allocated: n a virtual address space to.
Process Description and Control Chapter 3. Major Requirements of an OS Interleave the execution of several processes to maximize processor utilization.
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic,
Chapter 3 Process Description and Control Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Chapter 3 Process Description and Control Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
IT320 OPERATING SYSTEM CONCEPTS Unit 6: Processor Scheduling September 2012 Kaplan University 1.
Processes and Threads Processes have two characteristics: – Resource ownership - process includes a virtual address space to hold the process image – Scheduling/execution.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
1 Announcements The fixing the bug part of Lab 4’s assignment 2 is now considered extra credit. Comments for the code should be on the parts you wrote.
Threads G.Anuradha (Reference : William Stallings)
1 Threads, SMP, and Microkernels Chapter Multithreading Operating system supports multiple threads of execution within a single process MS-DOS.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
IT320 OPERATING SYSTEM CONCEPTS Unit 7: File Management May 2012 Kaplan University 1.
Unit 9: Distributing Computing & Networking Kaplan University 1.
Concurrency, Processes, and System calls Benefits and issues of concurrency The basic concept of process System calls.
Deadlock Operating Systems: Internals and Design Principles.
Process Description and Control Chapter 3. Source Modified slides from Missouri U. of Science and Tech.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Processes and Threads.
IT320 OPERATING SYSTEM CONCEPTS Unit 7: File Management July 2011 Kaplan University 1.
1 Process Description and Control Chapter 3. 2 Requirements of an Operating System Interleave the execution of multiple processes to maximize processor.
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
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.
Slides created by: Professor Ian G. Harris Operating Systems  Allow the processor to perform several tasks at virtually the same time Ex. Web Controlled.
1 Threads, SMP, and Microkernels Chapter 4. 2 Process Resource ownership - process includes a virtual address space to hold the process image Scheduling/execution-
Introduction to operating systems What is an operating system? An operating system is a program that, from a programmer’s perspective, adds a variety of.
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community.
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
IT320 Operating System Concepts
Process Management Process Concept Why only the global variables?
Chapter 4 Threads.
Intro to Processes CSSE 332 Operating Systems
Threads, SMP, and Microkernels
Process Description and Control
Process Description and Control
Lecture 4- Threads, SMP, and Microkernels
Threads Chapter 4.
Process Description and Control
Operating Systems Lecture 1.
Process Description and Control
Process Description and Control
Process Description and Control
Operating Systems : Overview
Process Description and Control
Operating Systems : Overview
Chapter 2 Processes and Threads 2.1 Processes 2.2 Threads
Process Description and Control
Chapter 3: Process Management
Presentation transcript:

Unit 4: Processes, Threads & Deadlocks June 2012 Kaplan University 1

 Readings  Discussion Questions  Assignments  Lecture on Processes, Threads & Deadlocks  Prepping your computer for simulations Kaplan University2

 Textbook Reading ◦ Chapter 3 – Process Description & Control ◦ Chapter 4 – Threads ◦ Chapter 6 – Concurrency: Deadlocks & Starvation ◦ Start with chapter summaries first!  Web Articles Reading  1 Discussion Question  4 page essay (due Tuesday) Kaplan University3

o Deadlocks are a dreaded state for modern computer systems and do take place quite often. o For deadlocks to happen, four conditions must be met. What are they? Explain. o Note: Your response should only list one condition. The responses to follow should list conditions not yet discussed. Kaplan University4

 The project for this Unit is a “hands-on” one. You are required to submit screenshots of both your Linux and windows task managers.  You will explore the tools available for Linux and Windows for examining processes and threads and write a report in the usual APA format.  For Windows: o Download the utility “Process Monitor” in this link and run it to aid you understand more about processes running on your Windows OS o o Run the utility on your Windows computer. Capture several screenshots of the interface and processes running on your PC. Kaplan University5

 For Linux: o Logon to your installed distribution, open a terminal window also called Xterm, and run the command “top” without the quotation marks followed by the return key. For better results with the top command, use the “man”pages to see all available switches for you to use with top. o To do that, at theconsole type: man top “man top” is short for “manual on the top command”. o You will get several options and switches, read through them and use what you deem needed. To quit the man pages, simply type the letter “q”. Kaplan University6

 Write a four-page detailed report on what you observed and relate it to what you learned about processes, threads, deadlocks, preventions, avoidance, and detection.  Be sure to submit a screen shot for each task manager output for Linux and Windows. To make screenshots, Windows users just need to press the "Print Screen" key. Mac users press Command+Shift+3.  Your paper should include at least four pages of content. Note that your paper will be longer than four pages as it will have a title page, table of contents, and a reference page in addition to the actual content pages required. Kaplan University7

8  10 pts – The content of the paper is clear and demonstrates the student’s understanding of the topics.  15 pts – Student explained the concept of processes/threads in modern computing and correlated them to what was observed in Process Monitor & Top  10 pts – Student provided screenshots for Process Monitor & Top (NOTE: You must use Process Monitor not Task Manager)  15 pts – Student compared and explained the concept of deadlock & related topics (avoidance, preventions, & detection).

Kaplan University9

 In your own words (based on your reading and research for this week):  Define “process”  Describe how an operating system uses processes Kaplan University10

 A program in execution  An instance of a program running on a computer  The entity that can be assigned to and executed on a processor  A unit of activity characterized by the execution of a sequence of instructions, a current state, and an associated set of system instructions Kaplan University11

 A process includes: ◦ Program code (possibly shared) ◦ A set of data ◦ A number of attributes describing the state of the process Kaplan University12

 While the process is running it has a number of elements including ◦ Identifier ◦ State ◦ Priority ◦ Program counter ◦ Memory pointers ◦ Context data ◦ I/O status information ◦ Accounting information Kaplan University13

 Contains the process elements  Created and managed by the operating system  Allows support for multiple processes Kaplan University14

 Process may be in one of two states ◦ Running ◦ Not-running Kaplan University15

Kaplan University16 Processes are moved by the dispatcher of the OS to the CPU then back to the queue until the task is completed

Kaplan University17

 For the OS is to manage processes and resources, it must have information about the current status of each process and resource.  Tables are constructed for each entity the operating system manages Kaplan University18

Kaplan University19

What is a Thread? Kaplan University20

 Processes have two characteristics: ◦ Resource ownership Process includes a virtual address space to hold the process image ◦ Scheduling/execution Follows an execution path that may be interleaved with other processes  These two characteristics are treated independently by the operating system Kaplan University21

 The unit of dispatching is referred to as a thread or lightweight process  The unit of resource ownership is referred to as a process or task  One way to view a thread is as an independent program counter operating within a process. Kaplan University22

Kaplan University23

 Takes less time to create a new thread than a process  Less time to terminate a thread than a process  Switching between two threads takes less time that switching processes  Threads can communicate with each other without invoking the kernel Kaplan University24

 Differences between different Operating Systems support of processes include: ◦ How processes are named ◦ Whether threads are provided ◦ How processes are represented ◦ How process resources are protected ◦ What mechanisms are used for inter-process communication and synchronization ◦ How processes are related to each other Kaplan University25

 Processes and services provided by the Windows Kernel are relatively simple and general purpose  Implemented as objects  An executable process may contain one or more threads  Both processes and thread objects have built- in synchronization capabilities Kaplan University26

Kaplan University27

 A process, or task, in Linux is represented by a task_struct data structure  This contains a number of categories including: ◦ State ◦ Scheduling information ◦ Identifiers ◦ Interprocess communication ◦ And others Kaplan University28

Kaplan University29

 In your own words, describe two differences between Windows and Linux, in terms of processes and threads. Kaplan University30

What is meant by the term “deadlock”? Kaplan University31

 A set of processes is deadlocked when each process in the set is blocked awaiting an event that can only be triggered by another blocked process in the set ◦ Typically involves processes competing for the same set of resources  No efficient solution for the general case Kaplan University32

Kaplan University33 I need quad A and B I need quad B and C I need quad C and B I need quad D and A

Kaplan University34 HALT until B is free HALT until C is free HALT until D is free HALT until A is free

 Mutual exclusion ◦ Only one process may use a resource at a time  Hold-and-wait ◦ A process may hold allocated resources while awaiting assignment of others  No pre-emption ◦ No resource can be forcibly removed from a process holding it  Circular Wait ◦ Each process is waiting for a resource held by the next process in the chain Kaplan University35

 Three general approaches exist for dealing with deadlock. ◦ Prevent Deadlock  Guarantee that one of the 4 conditions does not occur ◦ Avoid Deadlock  Gather info from processes and require processes to declare max number of resources it might need ◦ Detect Deadlock  Check for possible deadline by checking for resources and stop processes that might cause deadlock Kaplan University36

 Write a four-page detailed report on what you observed and relate it to what you learned about processes, threads, deadlocks, preventions, avoidance, and detection.  Be sure to submit a screen shot for each task manager output for Linux and Windows. To make screenshots, Windows users just need to press the "Print Screen" key. Mac users press Command+Shift+3.  Your paper should include at least four pages of content. Note that your paper will be longer than four pages as it will have a title page, table of contents, and a reference page in addition to the actual content pages required.  Use APA style. Kaplan University37

 Textbook imations.html imations.html  Topic Notes on Deadlock ock.pdf Kaplan University38

 Pam Van Hook ◦ ◦ Kaplan University39