Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Unit 4: Processes, Threads & Deadlocks June 2012 Kaplan University 1."— Presentation transcript:

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

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

3  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

4 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

5  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 http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx o Run the utility on your Windows computer. Capture several screenshots of the interface and processes running on your PC. Kaplan University5

6  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

7  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 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).

9 Kaplan University9

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

11  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

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

13  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

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

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

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

17 Kaplan University17

18  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

19 Kaplan University19

20 What is a Thread? Kaplan University20

21  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

22  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

23 Kaplan University23

24  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

25  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

26  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

27 Kaplan University27

28  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

29 Kaplan University29

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

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

32  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

33 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

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

35  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

36  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

37  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

38  Textbook http://www.williamstallings.com/OS/Animation/An imations.html http://www.williamstallings.com/OS/Animation/An imations.html  Topic Notes on Deadlock http://courses.teresco.org/cs322_s08/notes/deadl ock.pdf Kaplan University38

39  Pam Van Hook ◦ Email: pvanhook@kaplan.edupvanhook@kaplan.edu ◦ Email: pvanhook@gmail.compvanhook@gmail.com Kaplan University39


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

Similar presentations


Ads by Google