This document discusses different approaches to handling deadlocks in operating systems, including prevention, avoidance, detection, and recovery. It describes the characteristics of deadlocks and introduces concepts like mutual exclusion, hold and wait, no preemption, and circular wait. Methods covered include deadlock prevention by restricting resource allocation, deadlock avoidance using safe state algorithms like the Banker's Algorithm, deadlock detection using resource allocation graphs, and recovery from detected deadlocks.
LAS16-101: Efficient kernel backporting
Speakers: Alex Shi
Date: September 26, 2016
★ Session Description ★
In computer/mobile product world, due to the stability, project timeline, etc considerations, latest upstream kernel isn’t their preference. The long term stable kernel is. But if you want to some of the latest features which only is in upstream kernel,you will have to backport them to old stable kernel. This presentation will share the kernel feature backport experience with audience, help them understand how to do backports quickly and effectively without detailed knowledge of the target feature, thus giving more flexibility and Improving productivity when making products. We will use some examples, to discuss how to get info from backport request, how to find necessary commits, how to get dependency, how to resolve conflicts, and finally how to test it.
★ Resources ★
Etherpad: pad.linaro.org/p/las16-101
Presentations & Videos: http://connect.linaro.org/resource/las16/las16-101/
★ Event Details ★
Linaro Connect Las Vegas 2016 – #LAS16
September 26-30, 2016
http://www.linaro.org
http://connect.linaro.org
RAC+ASM: Lessons learned after 2 years in production
Managing over 70 databases for 4 major customers, I have some good stories to share. Running almost all possible combinations of ASM, RAC, NETAPP and NFS.
Success, failure and gotchas. This presentation is the equivalent of years of experience, condensed in major highlights in 45 minutes. To list a few stories:
Embedded Recipes 2018 - Finding sources of Latency In your system - Steven Ro...Anne Nicolas
Having just an RTOS is not enough for a real-time system. The hardware must be deterministic as well as the applications that run on the system. When you are missing deadlines, the first thing that must be done is to find what is the source of the latency that caused the issue. It could be the hardware, the operating system or the application, or even a combination of the above. This talk will discuss how to determine where the latency is using tools that come with the Linux Kernel, and will explain a few cases that caused issues.
Session will discuss the design and work done to get S2I working on the qualcomm 410c platform. In addition, session will provide the implementation details/requirements to support suspend to idle on ARM platforms.
Show performance numbers for latency and power consumption for S2I vs S2R (if available). Highlight possible improvements to decrease latency for S2I.
From USENIX LISA 2010, San Jose.
Visualizations that include heat maps can be an effective way to present performance data: I/O latency, resource utilization, and more. Patterns can emerge that would be difficult to notice from columns of numbers or line graphs, which are revealing previously unknown behavior. These visualizations are used in a product as a replacement for traditional metrics such as %CPU and are allowing end users to identify more issues much more easily (and some issues are becoming nearly impossible to identify with tools such as vmstat(1)). This talk covers what has been learned, crazy heat map discoveries, and thoughts for future applications beyond performance analysis.
The objective of this conference is to explain how to develop on small machines that can boot fast, fanless … It’s convenient and often more realistic than to work in virtual machines, especially when working on developping drivers.
Willy will list all the necessary items to setup an optimal environment to be as efficient as possible. Among these one: the importance of investing time to speed up the boot, etc …
He will also speak a bit about crosstool-ng, used in this environement.
Linux Performance Analysis: New Tools and Old SecretsBrendan Gregg
Talk for USENIX/LISA2014 by Brendan Gregg, Netflix. At Netflix performance is crucial, and we use many high to low level tools to analyze our stack in different ways. In this talk, I will introduce new system observability tools we are using at Netflix, which I've ported from my DTraceToolkit, and are intended for our Linux 3.2 cloud instances. These show that Linux can do more than you may think, by using creative hacks and workarounds with existing kernel features (ftrace, perf_events). While these are solving issues on current versions of Linux, I'll also briefly summarize the future in this space: eBPF, ktap, SystemTap, sysdig, etc.
Linux 4.x Tracing: Performance Analysis with bcc/BPFBrendan Gregg
Talk about bcc/eBPF for SCALE15x (2017) by Brendan Gregg. "BPF (Berkeley Packet Filter) has been enhanced in the Linux 4.x series and now powers a large collection of performance analysis and observability tools ready for you to use, included in the bcc (BPF Complier Collection) open source project. BPF nowadays can do system tracing, software defined networks, and kernel fast path: much more than just filtering packets! This talk will focus on the bcc/BPF tools for performance analysis, which make use of other built in Linux capabilities: dynamic tracing (kprobes and uprobes) and static tracing (tracepoints and USDT). There are now bcc tools for measuring latency distributions for file system I/O and run queue latency, printing details of storage device I/O and TCP retransmits, investigating blocked stack traces and memory leaks, and a whole lot more. These lead to performance wins large and small, especially when instrumenting areas that previously had zero visibility. Tracing superpowers have finally arrived, built in to Linux."
LAS16-TR02: Upstreaming 101
Speakers: Shawn Guo, Daniel Thompson
Date: September 27, 2016
★ Session Description ★
This session is an introductory course on Linux kernel upstreaming fundamentals. The course covers the definition the Linux mainline kernel tree as well as the maintainer hierarchy and processes used to contribute software into the mainline kernel. Special focus is given to understanding what documentation will help understand the process and mechanics in more detail while breaking the workflow into the various steps of upstreaming software patches. The target audience is both software engineers and engineering managers preparing to upstream software into the kernel. The topic requires a solid background in software configuration management terminology and the git SCM tool as well as a good technical understanding of the Linux kernel itself.
★ Resources ★
Etherpad: pad.linaro.org/p/las16-tr02
Presentations & Videos: http://connect.linaro.org/resource/las16/las16-tr02/
★ Event Details ★
Linaro Connect Las Vegas 2016 – #LAS16
September 26-30, 2016
http://www.linaro.org
http://connect.linaro.org
This presentation is about a methodology which allows patching of a running Linux kernel, its technical details, limitations as well as kpatch tools.
The talk was delivered by Ruslan Bilovol (Associate Manager, Consultant, GlobalLogic) at GlobalLogic Embedded Career Day #2 on February 10, 2018.
More about GlobalLogic Embedded Career Day #2: https://www.globallogic.com/ua/events/globallogic-kyiv-embedded-career-day-2-materials
Kernel Recipes 2017: Using Linux perf at NetflixBrendan Gregg
Talk for Kernel Recipes 2017 by Brendan Gregg. "Linux perf is a crucial performance analysis tool at Netflix, and is used by a self-service GUI for generating CPU flame graphs and other reports. This sounds like an easy task, however, getting perf to work properly in VM guests running Java, Node.js, containers, and other software, has been at times a challenge. This talk summarizes Linux perf, how we use it at Netflix, the various gotchas we have encountered, and a summary of advanced features."
LAS16-101: Efficient kernel backporting
Speakers: Alex Shi
Date: September 26, 2016
★ Session Description ★
In computer/mobile product world, due to the stability, project timeline, etc considerations, latest upstream kernel isn’t their preference. The long term stable kernel is. But if you want to some of the latest features which only is in upstream kernel,you will have to backport them to old stable kernel. This presentation will share the kernel feature backport experience with audience, help them understand how to do backports quickly and effectively without detailed knowledge of the target feature, thus giving more flexibility and Improving productivity when making products. We will use some examples, to discuss how to get info from backport request, how to find necessary commits, how to get dependency, how to resolve conflicts, and finally how to test it.
★ Resources ★
Etherpad: pad.linaro.org/p/las16-101
Presentations & Videos: http://connect.linaro.org/resource/las16/las16-101/
★ Event Details ★
Linaro Connect Las Vegas 2016 – #LAS16
September 26-30, 2016
http://www.linaro.org
http://connect.linaro.org
RAC+ASM: Lessons learned after 2 years in production
Managing over 70 databases for 4 major customers, I have some good stories to share. Running almost all possible combinations of ASM, RAC, NETAPP and NFS.
Success, failure and gotchas. This presentation is the equivalent of years of experience, condensed in major highlights in 45 minutes. To list a few stories:
Embedded Recipes 2018 - Finding sources of Latency In your system - Steven Ro...Anne Nicolas
Having just an RTOS is not enough for a real-time system. The hardware must be deterministic as well as the applications that run on the system. When you are missing deadlines, the first thing that must be done is to find what is the source of the latency that caused the issue. It could be the hardware, the operating system or the application, or even a combination of the above. This talk will discuss how to determine where the latency is using tools that come with the Linux Kernel, and will explain a few cases that caused issues.
Session will discuss the design and work done to get S2I working on the qualcomm 410c platform. In addition, session will provide the implementation details/requirements to support suspend to idle on ARM platforms.
Show performance numbers for latency and power consumption for S2I vs S2R (if available). Highlight possible improvements to decrease latency for S2I.
From USENIX LISA 2010, San Jose.
Visualizations that include heat maps can be an effective way to present performance data: I/O latency, resource utilization, and more. Patterns can emerge that would be difficult to notice from columns of numbers or line graphs, which are revealing previously unknown behavior. These visualizations are used in a product as a replacement for traditional metrics such as %CPU and are allowing end users to identify more issues much more easily (and some issues are becoming nearly impossible to identify with tools such as vmstat(1)). This talk covers what has been learned, crazy heat map discoveries, and thoughts for future applications beyond performance analysis.
The objective of this conference is to explain how to develop on small machines that can boot fast, fanless … It’s convenient and often more realistic than to work in virtual machines, especially when working on developping drivers.
Willy will list all the necessary items to setup an optimal environment to be as efficient as possible. Among these one: the importance of investing time to speed up the boot, etc …
He will also speak a bit about crosstool-ng, used in this environement.
Linux Performance Analysis: New Tools and Old SecretsBrendan Gregg
Talk for USENIX/LISA2014 by Brendan Gregg, Netflix. At Netflix performance is crucial, and we use many high to low level tools to analyze our stack in different ways. In this talk, I will introduce new system observability tools we are using at Netflix, which I've ported from my DTraceToolkit, and are intended for our Linux 3.2 cloud instances. These show that Linux can do more than you may think, by using creative hacks and workarounds with existing kernel features (ftrace, perf_events). While these are solving issues on current versions of Linux, I'll also briefly summarize the future in this space: eBPF, ktap, SystemTap, sysdig, etc.
Linux 4.x Tracing: Performance Analysis with bcc/BPFBrendan Gregg
Talk about bcc/eBPF for SCALE15x (2017) by Brendan Gregg. "BPF (Berkeley Packet Filter) has been enhanced in the Linux 4.x series and now powers a large collection of performance analysis and observability tools ready for you to use, included in the bcc (BPF Complier Collection) open source project. BPF nowadays can do system tracing, software defined networks, and kernel fast path: much more than just filtering packets! This talk will focus on the bcc/BPF tools for performance analysis, which make use of other built in Linux capabilities: dynamic tracing (kprobes and uprobes) and static tracing (tracepoints and USDT). There are now bcc tools for measuring latency distributions for file system I/O and run queue latency, printing details of storage device I/O and TCP retransmits, investigating blocked stack traces and memory leaks, and a whole lot more. These lead to performance wins large and small, especially when instrumenting areas that previously had zero visibility. Tracing superpowers have finally arrived, built in to Linux."
LAS16-TR02: Upstreaming 101
Speakers: Shawn Guo, Daniel Thompson
Date: September 27, 2016
★ Session Description ★
This session is an introductory course on Linux kernel upstreaming fundamentals. The course covers the definition the Linux mainline kernel tree as well as the maintainer hierarchy and processes used to contribute software into the mainline kernel. Special focus is given to understanding what documentation will help understand the process and mechanics in more detail while breaking the workflow into the various steps of upstreaming software patches. The target audience is both software engineers and engineering managers preparing to upstream software into the kernel. The topic requires a solid background in software configuration management terminology and the git SCM tool as well as a good technical understanding of the Linux kernel itself.
★ Resources ★
Etherpad: pad.linaro.org/p/las16-tr02
Presentations & Videos: http://connect.linaro.org/resource/las16/las16-tr02/
★ Event Details ★
Linaro Connect Las Vegas 2016 – #LAS16
September 26-30, 2016
http://www.linaro.org
http://connect.linaro.org
This presentation is about a methodology which allows patching of a running Linux kernel, its technical details, limitations as well as kpatch tools.
The talk was delivered by Ruslan Bilovol (Associate Manager, Consultant, GlobalLogic) at GlobalLogic Embedded Career Day #2 on February 10, 2018.
More about GlobalLogic Embedded Career Day #2: https://www.globallogic.com/ua/events/globallogic-kyiv-embedded-career-day-2-materials
Kernel Recipes 2017: Using Linux perf at NetflixBrendan Gregg
Talk for Kernel Recipes 2017 by Brendan Gregg. "Linux perf is a crucial performance analysis tool at Netflix, and is used by a self-service GUI for generating CPU flame graphs and other reports. This sounds like an easy task, however, getting perf to work properly in VM guests running Java, Node.js, containers, and other software, has been at times a challenge. This talk summarizes Linux perf, how we use it at Netflix, the various gotchas we have encountered, and a summary of advanced features."
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
1. Silberschatz and Galvin19997.1
Operating System Concepts Silberschatz and Galvin19995.1Operating System Concepts Silberschatz and Galvin 19994.1
1 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
O P E R A T I N G S Y S T E M S
Chapter 7 : Deadlocks
• System Model
• Deadlock Characterization
• Methods for Handling Deadlocks
• Deadlock Prevention
• Deadlock Avoidance
• Deadlock Detection
• Recovery from Deadlock
• Combined Approach to Deadlock Handling
Operating System Concepts
2. Silberschatz and Galvin19997.2
Operating System Concepts Silberschatz and Galvin19995.2Operating System Concepts Silberschatz and Galvin 19994.2
2 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Chapter 7: Deadlocks
• System Model
• Deadlock Characterization
• Methods for Handling Deadlocks
• Deadlock Prevention
• Deadlock Avoidance
• Deadlock Detection
• Recovery from Deadlock
• Combined Approach to Deadlock Handling
Operating System Concepts
3. Silberschatz and Galvin19997.3
Operating System Concepts Silberschatz and Galvin19995.3Operating System Concepts Silberschatz and Galvin 19994.3
3 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
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.
• Example
– System has 2 tape drives.
– P1 and P2 each hold one tape drive and each needs
another one.
• Example
– semaphores A and B, initialized to 1
P0 P1
wait (A); wait(B)
wait (B); wait(A)Operating System Concepts
4. Silberschatz and Galvin19997.4
Operating System Concepts Silberschatz and Galvin19995.4Operating System Concepts Silberschatz and Galvin 19994.4
4 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Bridge Crossing Example
• Traffic only in one direction.
• Each section of a bridge can be viewed as a resource.
• If a deadlock occurs, it can be resolved if one car backs up
(preempt resources and rollback).
• Several cars may have to be backed upif a deadlock occurs.
• Starvation is possible.
Operating System Concepts
5. Silberschatz and Galvin19997.5
Operating System Concepts Silberschatz and Galvin19995.5Operating System Concepts Silberschatz and Galvin 19994.5
5 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
System Model
• Resource types R1, R2, . . ., Rm
CPU cycles, memory space, I/O devices
• Each resource type Ri has Wi instances.
• Each process utilizes a resource as follows:
– request
– use
– release
Operating System Concepts
6. Silberschatz and Galvin19997.6
Operating System Concepts Silberschatz and Galvin19995.6Operating System Concepts Silberschatz and Galvin 19994.6
6 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Deadlock Characterization
• 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, …, P0} 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, …, Pn–1 is
waiting for a resource that is held by Pn, and P0 is waiting for a
resource that is held by P0.
Deadlock can arise if four conditions hold simultaneously.
Operating System Concepts
7. Silberschatz and Galvin19997.7
Operating System Concepts Silberschatz and Galvin19995.7Operating System Concepts Silberschatz and Galvin 19994.7
7 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Resource-Allocation Graph
• V is partitioned into two types:
– P = {P1, P2, …, Pn}, the set consisting of all the processes in
the system.
– R = {R1, R2, …, Rm}, the set consisting of all resource types
in the system.
• request edge – directed edge P1 Rj
• assignment edge – directed edge Rj Pi
A set of vertices V and a set of edges E.
Operating System Concepts
8. Silberschatz and Galvin19997.8
Operating System Concepts Silberschatz and Galvin19995.8Operating System Concepts Silberschatz and Galvin 19994.8
8 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Resource-Allocation Graph (Cont.)
• Process
• Resource Type with 4 instances
• Pi requests instance of Rj
• Pi is holding an instance of Rj
Pi
Pi
Rj
Rj
Operating System Concepts
9. Silberschatz and Galvin19997.9
Operating System Concepts Silberschatz and Galvin19995.9Operating System Concepts Silberschatz and Galvin 19994.9
9 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Example of a Resource Allocation Graph
Operating System Concepts
10. Silberschatz and Galvin19997.10
Operating System Concepts Silberschatz and Galvin19995.10Operating System Concepts Silberschatz and Galvin 19994.10
10 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Resource Allocation Graph With A Deadlock
Operating System Concepts
11. Silberschatz and Galvin19997.11
Operating System Concepts Silberschatz and Galvin19995.11Operating System Concepts Silberschatz and Galvin 19994.11
11 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Resource Allocation Graph With A Cycle But No Deadlock
Operating System Concepts
12. Silberschatz and Galvin19997.12
Operating System Concepts Silberschatz and Galvin19995.12Operating System Concepts Silberschatz and Galvin 19994.12
12 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Basic Facts
• If graph contains no cycles no deadlock.
• If graph contains a cycle
– if only one instance per resource type, then deadlock.
– if several instances per resource type, possibility of
deadlock.
Operating System Concepts
13. Silberschatz and Galvin19997.13
Operating System Concepts Silberschatz and Galvin19995.13Operating System Concepts Silberschatz and Galvin 19994.13
13 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Methods for Handling Deadlocks
• 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.
Operating System Concepts
14. Silberschatz and Galvin19997.14
Operating System Concepts Silberschatz and Galvin19995.14Operating System Concepts Silberschatz and Galvin 19994.14
14 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Deadlock Prevention
• Mutual Exclusion – not required for sharable resources; must
hold for nonsharable resources.
• Hold and Wait – must guarantee that whenever a process
requests a resource, it does not hold any other resources.
– Require process to request and be allocated all its
resources before it begins execution, or allow process to
request resources only when the process has none.
– Low resource utilization; starvation possible.
Restrain the ways request can be made.
Operating System Concepts
15. Silberschatz and Galvin19997.15
Operating System Concepts Silberschatz and Galvin19995.15Operating System Concepts Silberschatz and Galvin 19994.15
15 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Deadlock Prevention (Cont.)
• No Preemption –
– If a process that is holding some resources requests
another resource that cannot be immediately allocated to it,
then all resources currently being held are released.
– Preempted resources are added to the list of resources for
which the process is waiting.
– Process will be restarted only when it can regain its old
resources, as well as the new ones that it is requesting.
• Circular Wait – impose a total ordering of all resource types, and
require that each process requests resources in an increasing
order of enumeration.
Operating System Concepts
16. Silberschatz and Galvin19997.16
Operating System Concepts Silberschatz and Galvin19995.16Operating System Concepts Silberschatz and Galvin 19994.16
16 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Deadlock Avoidance
• 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.
Requires that the system has some additional a priori information
available.
Operating System Concepts
17. Silberschatz and Galvin19997.17
Operating System Concepts Silberschatz and Galvin19995.17Operating System Concepts Silberschatz and Galvin 19994.17
17 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Safe State
• When a process requests an available resource, system must
decide if immediate allocation leaves the system in a safe state.
• System is in safe state if there exists a safe sequence of all
processes.
• Sequence <P1, P2, …, Pn> is safe if for each Pi, the resources
that Pi can still request can be satisfied by currently available
resources + resources held by all the Pj, with j<I.
– If Pi resource needs are not immediately available, then Pi
can wait until all Pj have finished.
– When Pj is finished, Pi can obtain needed resources,
execute, return allocated resources, and terminate.
– When Pi terminates, Pi+1 can obtain its needed resources,
and so on.
Operating System Concepts
18. Silberschatz and Galvin19997.18
Operating System Concepts Silberschatz and Galvin19995.18Operating System Concepts Silberschatz and Galvin 19994.18
18 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Basic Facts
• If a system is in safe state no deadlocks.
• If a system is in unsafe state possibility of deadlock.
• Avoidance ensure that a system will never enter an unsafe
state.
Operating System Concepts
19. Silberschatz and Galvin19997.19
Operating System Concepts Silberschatz and Galvin19995.19Operating System Concepts Silberschatz and Galvin 19994.19
19 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Safe, unsafe , deadlock state spaces
Operating System Concepts
20. Silberschatz and Galvin19997.20
Operating System Concepts Silberschatz and Galvin19995.20Operating System Concepts Silberschatz and Galvin 19994.20
20 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Resource-Allocation Graph Algorithm
• Claim edge Pi Rj indicated that process Pj may request
resource Rj; represented by a dashed line.
• Claim edge converts to request edge when a process requests a
resource.
• When a resource is released by a process, assignment edge
reconverts to a claim edge.
• Resources must be claimed a priori in the system.
Operating System Concepts
21. Silberschatz and Galvin19997.21
Operating System Concepts Silberschatz and Galvin19995.21Operating System Concepts Silberschatz and Galvin 19994.21
21 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Resource-Allocation Graph For Deadlock Avoidance
Operating System Concepts
22. Silberschatz and Galvin19997.22
Operating System Concepts Silberschatz and Galvin19995.22Operating System Concepts Silberschatz and Galvin 19994.22
22 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Unsafe State In A Resource-Allocation Graph
Operating System Concepts
23. Silberschatz and Galvin19997.23
Operating System Concepts Silberschatz and Galvin19995.23Operating System Concepts Silberschatz and Galvin 19994.23
23 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Banker’s Algorithm
• Multiple instances.
• Each process must a priori claim maximum use.
• When a process requests a resource it may have to wait.
• When a process gets all its resources it must return them in a
finite amount of time.
Operating System Concepts
24. Silberschatz and Galvin19997.24
Operating System Concepts Silberschatz and Galvin19995.24Operating System Concepts Silberschatz and Galvin 19994.24
24 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Data Structures for the Banker’s Algorithm
• Available: Vector of length m. If available [j] = k, there are k
instances of resource type Rj available.
• Max: n x m matrix. If Max [i,j] = k, then process Pi may request at
most k instances of resource type Rj.
• Allocation: n x m matrix. If Allocation[i,j] = k then Pi is currently
allocated k instances of Rj.
• Need: n x m matrix. If Need[i,j] = k, then Pi may need k more
instances of Rj to complete its task.
Need [i,j] = Max[i,j] – Allocation [i,j].
Let n = number of processes, and m = number of resources types.
Operating System Concepts
25. Silberschatz and Galvin19997.25
Operating System Concepts Silberschatz and Galvin19995.25Operating System Concepts Silberschatz and Galvin 19994.25
25 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Safety Algorithm
1. Let Work and Finish be vectors of length m and n, respectively.
Initialize:
Work := Available
Finish [i] = false for i - 1,3, …, n.
2. Find and i such that both:
(a) Finish [i] = false
(b) Needi Work
If no such i exists, go to step 4.
3. Work := Work + Allocationi
Finish[i] := true
go to step 2.
4. If Finish [i] = true for all i, then the system is in a safe state.
Operating System Concepts
26. Silberschatz and Galvin19997.26
Operating System Concepts Silberschatz and Galvin19995.26Operating System Concepts Silberschatz and Galvin 19994.26
26 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Resource-Request Algorithm for Process Pi
Requesti = request vector for process Pi. If Requesti [j] = k then
process Pi wants k instances of resource type Rj.
1. If Requesti Needi go to step 2. Otherwise, raise error
condition, since process has exceeded its maximum claim.
2. If Requesti Available, go to step 3. Otherwise Pi must
wait, since resources are not available.
3. Pretend to allocate requested resources to Pi by modifying
the state as follows:
Available := Available = Requesti;
Allocationi := Allocationi + Requesti;
Needi := Needi – Requesti;;
• If safe the resources are allocated to Pi.
• If unsafe Pi must wait, and the old resource-allocation
state is restored
Operating System Concepts
27. Silberschatz and Galvin19997.27
Operating System Concepts Silberschatz and Galvin19995.27Operating System Concepts Silberschatz and Galvin 19994.27
27 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Example of Banker’s Algorithm
• 5 processes P0 through P4; 3 resource types A (10 instances),
B (5instances, and C (7 instances).
• Snapshot at time T0:
Allocation Max Available
A B C A B C A B C
P0 0 1 0 7 5 3 3 3 2
P1 2 0 0 3 2 2
P2 3 0 2 9 0 2
P3 2 1 1 2 2 2
P4 0 0 2 4 3 3
Operating System Concepts
28. Silberschatz and Galvin19997.28
Operating System Concepts Silberschatz and Galvin19995.28Operating System Concepts Silberschatz and Galvin 19994.28
28 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Example (Cont.)
• The content of the matrix. Need is defined to be Max – Allocation.
Need
A B C
P0 7 4 3
P1 1 2 2
P2 6 0 0
P3 0 1 1
P4 4 3 1
• The system is in a safe state since the sequence < P1, P3, P4, P2, P0>
satisfies safety criteria.
Operating System Concepts
29. Silberschatz and Galvin19997.29
Operating System Concepts Silberschatz and Galvin19995.29Operating System Concepts Silberschatz and Galvin 19994.29
29 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Example (Cont.): P1 request (1,0,2)
• Check that Request Available (that is, (1,0,2) (3,3,2) true.
Allocation Need Available
A B C A B C A B C
P0 0 1 0 7 4 3 2 3 0
P1 3 0 2 0 2 0
P2 3 0 1 6 0 0
P3 2 1 1 0 1 1
P4 0 0 2 4 3 1
• Executing safety algorithm shows that sequence <P1, P3, P4, P0, P2>
satisfies safety requirement.
• Can request for (3,3,0) by P4 be granted?
• Can request for (0,2,0) by P0 be granted?
Operating System Concepts
30. Silberschatz and Galvin19997.30
Operating System Concepts Silberschatz and Galvin19995.30Operating System Concepts Silberschatz and Galvin 19994.30
30 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Deadlock Detection
• Allow system to enter deadlock state
• Detection algorithm
• Recovery scheme
Operating System Concepts
31. Silberschatz and Galvin19997.31
Operating System Concepts Silberschatz and Galvin19995.31Operating System Concepts Silberschatz and Galvin 19994.31
31 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Single Instance of Each Resource Type
• Maintain wait-for graph
– Nodes are processes.
– Pi Pj if Pi is waiting for Pj.
• Periodically invoke an algorithm that searches for acycle in the
graph.
• An algorithm to detect a cycle in a graph requires an order of n2
operations, where n is the number of vertices in the graph.
Operating System Concepts
32. Silberschatz and Galvin19997.32
Operating System Concepts Silberschatz and Galvin19995.32Operating System Concepts Silberschatz and Galvin 19994.32
32 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Resource-Allocation Graph And Wait-for Graph
Resource-Allocation Graph Corresponding wait-for graph
Operating System Concepts
33. Silberschatz and Galvin19997.33
Operating System Concepts Silberschatz and Galvin19995.33Operating System Concepts Silberschatz and Galvin 19994.33
33 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Several Instances of a Resource Type
• Available: A vector of length m indicates the number of available
resources of each type.
• Allocation: An n x m matrix defines the number of resources of
each type currently allocated to each process.
• Request: An n x m matrix indicates the current request of each
process. If Request [ij] = k, then process Pi is requesting k more
instances of resource type. Rj.
Operating System Concepts
34. Silberschatz and Galvin19997.34
Operating System Concepts Silberschatz and Galvin19995.34Operating System Concepts Silberschatz and Galvin 19994.34
34 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Detection Algorithm
1. Let Work and Finish be vectors of length m and n, respectively
Initialize:
(a) Work :- Available
(b) For i = 1,2, …, n, if Allocationi 0, then
Finish[i] := false;otherwise, Finish[i] := true.
2. Find an index i such that both:
(a) Finish[i] = false
(b) Requesti Work
If no such i exists, go to step 4.
Operating System Concepts
35. Silberschatz and Galvin19997.35
Operating System Concepts Silberschatz and Galvin19995.35Operating System Concepts Silberschatz and Galvin 19994.35
35 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Detection Algorithm (Cont.)
3. Work := Work + Allocationi
Finish[i] := true
go to step 2.
4. If Finish[i] = false, for some i, 1 i n, then the system is in
deadlock state. Moreover, if Finish[i] = false, then Pi is
deadlocked.
Algorithm requires an order of m x n2 operations to detect whether
the system is in deadlocked state.
Operating System Concepts
36. Silberschatz and Galvin19997.36
Operating System Concepts Silberschatz and Galvin19995.36Operating System Concepts Silberschatz and Galvin 19994.36
36 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Example of Detection Algorithm
• Five processes P0 through P4; three resource types
A (7 instances), B (2 instances), and C (6 instances).
• Snapshot at time T0:
Allocation Request Available
A B C A B C A B C
P0 0 1 0 0 0 0 0 0 0
P1 2 0 0 2 0 2
P2 3 0 3 0 0 0
P3 2 1 1 1 0 0
P4 0 0 2 0 0 2
• Sequence <P0, P2, P3, P1, P4> will result in Finish[i] = true for all i.
Operating System Concepts
37. Silberschatz and Galvin19997.37
Operating System Concepts Silberschatz and Galvin19995.37Operating System Concepts Silberschatz and Galvin 19994.37
37 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Example (Cont.)
• P2 requests an additional instance of type C.
Request
A B C
P0 0 0 0
P1 2 0 1
P2 0 0 1
P3 1 0 0
P4 0 0 2
• State of system?
– Can reclaim resources held by process P0, but insufficient
resources to fulfill other processes; requests.
– Deadlock exists, consisting of processes P1, P2, P3, and P4.
Operating System Concepts
38. Silberschatz and Galvin19997.38
Operating System Concepts Silberschatz and Galvin19995.38Operating System Concepts Silberschatz and Galvin 19994.38
38 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Detection-Algorithm Usage
• When, and how often, to invoke depends on:
– How often a deadlock is likely to occur?
– How many processes will need to be rolled back?
one for each disjoint cycle
• If detection algorithm is invoked arbitrarily, there may be many
cycles in the resource graph and so we would not be able to tell
which of the many deadlocked processes “caused” the deadlock.
Operating System Concepts
39. Silberschatz and Galvin19997.39
Operating System Concepts Silberschatz and Galvin19995.39Operating System Concepts Silberschatz and Galvin 19994.39
39 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Recovery from Deadlock: Process Termination
• Abort all deadlocked processes.
• Abort one process at a time until the deadlock cycle is eliminated.
• In which order should we choose to abort?
– Priority of the process.
– How long process has computed, and how much longer to
completion.
– Resources the process has used.
– Resources process needs to complete.
– How many processes will need to be terminated.
– Is process interactive or batch?
Operating System Concepts
40. Silberschatz and Galvin19997.40
Operating System Concepts Silberschatz and Galvin19995.40Operating System Concepts Silberschatz and Galvin 19994.40
40 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Recovery from Deadlock: Resource Preemption
• Selecting a victim – minimize cost.
• Rollback – return to some safe state, restart process fro that
state.
• Starvation – same process may always be picked as victim,
include number of rollback in cost factor.
Operating System Concepts
41. Silberschatz and Galvin19997.41
Operating System Concepts Silberschatz and Galvin19995.41Operating System Concepts Silberschatz and Galvin 19994.41
41 toOperating System Concepts | Silberschatz and Galvin 1999https://github.com/syaifulahdan/ 41
Combined Approach to Deadlock Handling
• Combine the three basic approaches
– prevention
– avoidance
– detection
allowing the use of the optimal approach for each of resources in
the system.
• Partition resources into hierarchically ordered classes.
• Use most appropriate technique for handling deadlocks within
each class.
Operating System Concepts