Download presentation
Presentation is loading. Please wait.
1
IT320 Operating System Concepts
Unit 4: Processes, Threads & Deadlocks June 2011 Kaplan University
2
Unit 4 Overview Readings Discussion Questions Assignments
Lecture on Processes, Threads & Deadlocks Prepping your computer for simulations Kaplan University
3
Unit 4: Reading & Assignments
Textbook Reading Chapter 3 – Process Description & Control Chapter 4 – Threads, SMP, & Microkernels Chapter 6 – Concurrency: Deadlocks & Starvation Start with chapter summaries first! Web Articles Reading 2 Discussion Questions 4 page essay (due Tuesday) Kaplan University
4
Unit 4: Discussion Questions
DQ1 Deadlocks are a dreaded state for modern computer systems and do take place quite often. But for deadlocks to happen, four conditions must be met. What are they? Explain. Note: Your response should only list one condition. The responses to follow should list conditions not yet discussed. DQ2 (optional – non-graded topic) The second discussion thread in this unit is an opportunity for you to ask questions. Use this thread to post questions about running task manager for Linux and Windows; issues, observations, suggestions, etc... Use this thread to post questions about running task manager for Linux and Windows: issues, observations, suggestions… Kaplan University
5
Unit 4: Essay on Windows vs Linux
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: Download the utility “Process Monitor” in this link and run it to aid you understand more about processes running on your Windows OS Run the utility on your Windows computer. Capture several screenshots of the interface and processes running on your PC. Kaplan University
6
Unit 4: Essay on Windows vs. Linux
For Linux: 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. To do that, at theconsole type: man top “man top” is short for “manual on the top command”. 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 University
7
Unit 4: Essay on Windows vs. Linux
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 University
8
Unit 4: Grading Rubric Kaplan University
9
Assignment Guidelines
DO NOT use Wikipedia as a source for your paper! Papers that use wiki sites as sources will lose 10% (-5 pts) Use “quotation marks” if you are directly quoting from the sources. 1st Offense – You will be asked to rewrite the paper 2nd Offense – You will be reported to the university and the paper will receive a zero Always include a title paper (with your name), intro, conclusion, content, & references. Kaplan University
10
Chapter 3 - Processes What is a process? Kaplan University
11
What are processes? 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 University
12
Process Elements A process includes: Program code (possibly shared)
A set of data A number of attributes describing the state of the process Kaplan University
13
Process Elements 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 University
14
Process Control Block Contains the process elements
Created and managed by the operating system Allows support for multiple processes Kaplan University
15
Process State Process may be in one of two states Running Not-running
Kaplan University
16
Queuing Diagram Processes are moved by the dispatcher of the OS to the CPU then back to the queue until the task is completed Kaplan University
17
Five State Process Model
Kaplan University
18
Operating System Control Structures
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 University
19
OS Control Tables Kaplan University
20
Chapter 4 -Processes & Threads
What is a Thread? Kaplan University
21
Processes & Threads 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 University
22
What is a thread? 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 University
23
Threads vs. Processes Kaplan University
24
Benefits of Threads 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 University
25
Different approaches to different threads
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 University
26
Windows Processes 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 University
27
Windows Thread State Kaplan University
28
Linux Tasks 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 University
29
Linux Process/Thread Model
Kaplan University
30
Chapter 6 - Deadlock What is meant by the term “deadlock”?
Kaplan University
31
Deadlock 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 University
32
Potential Deadlock I need quad C and B I need quad B and C
I need quad A and B I need quad D and A Kaplan University
33
Actual Deadlock HALT until D is free HALT until C is free
HALT until B is free HALT until A is free Kaplan University
34
Conditions for a Possible Deadlock
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 University
35
How to Deal with Deadlock
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 University
36
Unit 4: Essay on Windows vs. Linux
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 University
37
Other Resources Textbook imations.html Topic Notes on Deadlock ock.pdf Kaplan University
38
Any Questions? Pam Van Hook
Office Hours: Wednesday pm ET Sunday pm ET AIM: Kaplan University
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.