Concurrency: Deadlock and Starvation Chapter 6. Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate.

Slides:



Advertisements
Presentaciones similares
Control en cascada.
Advertisements

Deadlocks Caracterización de deadlock Métodos para manejar deadlock Prevenir, Predecir, detección Recuperación de deadlock Emely Arráiz Ene-Mar 08.
Writing A Lab Report.
Concurrencia: Deadlock e Inhanición
The subjunctive is not a tense; rather, it is a mood. Tense refers to when an action takes place (past, present, future), while mood merely reflects how.
EL IMPERFECTO What’s the story?. “Used to” Expresses the idea that something happened repeatedly in the past.
Los verbos regulares – ar What is an infinitive? An infinitive in both Spanish and English is the base form of the verb. In English, the infinitive.
Review, test strategies and packet answers.  1. Read through once for understanding, while HIGHLIGHTING key words (refer to handout from 9/18)  2. Go.
Stem-changing verbs.
El subjuntivo con verbos y frases de emoción, opinión y recomendación
REQUISITOS PARA LA GRADUATION DE LAS HIGH SCHOOLS DE ALLIANCE Alliance High School Graduation Requirements.
PRUEBA DE UBICACION PARA HISPANOHABLANTES
Future. Before learning to form the future it in English: I will speak. The future tense in English ALWAYS has the word “will” (or “shall”). It can be.
La Hora... Telling Time in Spanish. ¿Que hora es? The verb ser is used to express the time of day. Use es when referring to "one o'clock" and use son.
Telling Time.
1 – 999,999,999.
4.1 Continuidad en un punto 4.2 Tipos de discontinuidades 4.3 Continuidad en intervalos.
CPU 8088 vs. Pentium TEEL 4011 Prof. Jaime José Laracuente-Díaz.
Objective: I can recognize and accurately use gender agreement. Do Now: Match the following Spanish and English words: 1. Pelirroja a. Good-looking 2.
IRREGULAR VERBS. Remember how regular verbs are formed? You drop the –ar, -er, or –ir and add the appropriate ending.
Time Expression with Hacer Grammar Essential #106.
Some “boolean” concepts The following series of slides is not supposed to give you answers, but to provide substance for thought and ponder. The placenta.
Español 3 Sra. Carpinella.  Because each tense is used for very specific things, there are some key words that indicate whether you would use the imperfect.
What has to be done today? It can be done in any order. Make a new ALC form Do the ALC Get two popsicle sticks Get 16 feet of yarn. That is 4 arms width.
JERARQUÍA DE MEMORIA  MEMORIA VIRTUAL SEMANA NO.15 SEMESTRE PROF. EUGENIO DUQUE PÉREZ PROF. GUSTAVO PATIÑO
Objectivos de esta leccion: Usar los pronombres indirectos correctamente Usar los pronombres directos correctamente Usar los pronombres dobles correctamente.
Hace + Time Expressions
ALC #7 Do the math problems and write the answer in Spanish.
Digital Photography: Selfie Slides
Teaching Pronunciation A case for the lenient allophone of the voiced stop /b/ Manuela González-Bueno CASPSLaP University of KansasGeorgetown University.
¿Qué haces en la escuela? Question words, objects, yo-go’s.
Indirect Object Pronouns
Las Preguntas (the questions) Tengo una pregunta… Sí, Juan habla mucho con el profesor en clase. No, Juan no habla mucho en clase. s vo s vo Forming.
Time in Spanish Nivel 1. Telling time inSpanish  Time is not TOO different in Spanish.  It is formatted the way time used to be told in English.  It.
Tecnología y Estructura de Costos. Technologies u A technology is a process by which inputs are converted to an output. u E.g. labor, a computer, a projector,
1. Escribe la fecha y el objetivo. 2. Saca la tarea! 3. Translate the following sentences from Spanish to English. 1. Me gustan los deportes porque son.
Time Telling time is rather easy. You only need to know the numbers up to 59 to be able to tell the time.
Regular –AR verbs.  In Spanish there are three types of regular verbs, those that end in –AR, -ER and –IR  This ending sets up a pattern for how the.
SPANISH 8 TH GRADE With Señorita Hall Classes #1-5 – August- September 2013 Capítulo 1: Lectura 1 ● El cuento del gato Warm-Up In your carpeta fill out.
+ Four Square Vocabulary. + What it is. Whole class, small group or individual activity that: Presents new vocabulary Reviews vocabulary Practices sentence.
The Future Tense -original PowerPoint created by Mrs. Shirley of North Intermediate High School in Broken Arrow, OK.
 The Spanish Present Tense is generally used, as in English, to describe actions that are happening right now. I eat – Como However, it is also used.
Los Sustantivos, Los Artículos Y Género [Nouns, Articles and Gender]
Essential ?: How do I say what multiple people are doing.
El presente indicativo ESPAÑOL 1. A. What is the present tense? It is when the action of a verb occurs at the moment. Verbs can be divided into two categories:
Indirect Object Pronouns Original PowerPoint was by Ms. Martin of Tri-Center Community Schools.
Double Object Pronouns What happens when we have both direct and indirect object pronouns in the same sentence? What goes where? Information for this lesson.
Matter and changes in state Classification of Matter Physical and Chemical Properties More questions
To be, or not to be? Let’s start out with one of the most important verbs in Spanish: ser, which means “to be.”
Los regulares del pretérito Voces 1 Cap. 15. Los usos del pretérito Used to talk about a one time event that occurred in the past or to narrate a sequence.
Un juego de adivinanzas: ¿Dónde está el tesoro? A1B1C1D1E1F1 A4B4C4D4E4F4 A2B2C2D2E2F2 A5B5C5D5E5F5 A3B3C3D3E3F3 A6B6C6D6E6F6 Inténtalo de nuevo Inténtalo.
Essential question: How do I say what I like and what interests/bores me?
The time.  ¿Qué hora es? What time is it?  Es la.../Son las… It is…o’clock To say at what time something happens use:  ¿A qué hora es…? At what time.
¡Bienvenidos a clase! lunes, el 6 de abril. ¿Que vamos a hacer hoy? 1.tener + que + infinitive 2.hace + time expressions 3.adverbios.
SCAFFOLDING & DIFFERENTIATION
Los Artículos Los Nombres (Nouns)  Name of a person, place or thing is a noun  In Spanish, every noun has a gender, either masculine or feminine 
AQA Unit 2 Speaking Los medios La televisión La publicidad Las tecnologías de la comunicación La cultura de todos los días El cine La música La moda La.
EQUILIBRIUM OF A PARTICLE IN 2-D Today’s Objectives: Students will be able to : a) Draw a free body diagram (FBD), and, b) Apply equations of equilibrium.
To be, or not to be? Let’s start out with one of the most important verbs in Spanish: ser, which means “to be.”
To be, or not to be? Let’s start out with one of the most important verbs in Spanish: ser, which means “to be.”
PREGUNTAS: Questions and Question Words
First Grade Dual High Frequency Words
¿Qué hora es?.
Los números.
Quasimodo: Tienes que hacer parte D de la tarea..
Apuntes: La hora Lección 1: Hola, ¿Qué tal?.
Fabian López, Jordi Martí, Galdric Ruiz
CONSEQUENCES OF ACCIDENTS AT WORK GLORIANA RUIZ. CONSEQUENCE OF WORKING WITHOUT GLOVES 1. A person can have side effects if he sprays a plant with chemicals.
The causative is a common structure in English. It is used when one thing or person causes another thing or person to do something.
Las Preguntas (the questions) Tengo una pregunta… Sí, Juan habla mucho con el profesor en clase. No, Juan no habla mucho en clase. s vo s vo Forming.
Transcripción de la presentación:

Concurrency: Deadlock and Starvation Chapter 6

Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate with each other No efficient solution Involve conflicting needs for resources by two or more processes

Joint progress diagram Paths 3 and 4 enter the gray-shaded area. –Referred to as a fatal region If an execution path enters this fatal region, then deadlock is inevitable. The existence of a fatal region depends on the logic of the processes. Whether or not deadlock occurs depends on both the dynamics of the execution and on the details of the application.

Reusable Resources Used by one process at a time and not depleted by that use Processes obtain resources that they later release for reuse by other processes Processors, I/O channels, main and secondary memory, files, databases, and semaphores Deadlock occurs if each process holds one resource and requests the other

Example of Deadlock

Another Example of Deadlock Space is available for allocation of 200K bytes, and the following sequence of events occur Deadlock occurs if both processes progress to their second request P1... Request 80K bytes; Request 60K bytes; P2... Request 70K bytes; Request 80K bytes;

Consumable Resources Created (produced) and destroyed (consumed) by a process Interrupts, signals, messages, and information in I/O buffers Deadlock may occur if a Receive message is blocking May take a rare combination of events to cause deadlock

Example of Deadlock Deadlock occurs if receive is blocking P1... Receive(P2); Send(P2, M1); P2... Receive(P1); Send(P1, M2);

Conditions for 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 other resources

Conditions for Deadlock No preemption –No resource can be forcibly removed from a process holding it. –Preemption should not be arbitrary. –Must be supported by a rollback recovery mechanism.

Conditions for Deadlock Circular wait

Dealing with Deadlocks Three general approaches exist for dealing with deadlock: –Prevent, by adopting a policy that eliminates one of the four conditions. –Avoid, by making appropiate dynamic choices based on the current state of resource allocation. –Detect the presence of deadlock and take action to recover.

Deadlock Prevention (indirect) Mutual exclusion: –Can not be disallowed. –If access to a resource requires mutual exclusion, then mutual exclusion must be supported.

Deadlock Prevention (indirect) Hold and Wait: –Process requests all of its required resources at one time –Block process until all requests can be granted simultaneously. Process may be held up for a long time waiting. Resources allocated may remain unused for a considerable period. Process may not know in advance all of the resources that it will require.

Deadlock Prevention (indirect) No preemption: –If a process is denied a further request it must release its original resources. –If a process requests a resource held by another process, the OS may preempt the second process and require it to release its resources. –Only applies when the state of a resource can be easily saved and restored later.

Deadlock Prevention (direct) Circular wait: –Define linear ordering of resource types. –If a process has been allocated resources of type Ri, then it may subsequently request only resources Rj, with i < j.

Deadlock Avoidance Allows the three necessary conditions. A decision is made dynamically whether the current resource allocation request will, if granted, potentially lead to a deadlock Requires knowledge of future process request

Two Approaches to Deadlock Avoidance Do not start a process if its demands might lead to deadlock Do not grant an incremental resource request to a process if this allocation might lead to deadlock

Resource Allocation Denial Referred to as the banker’s algorithm State of the system is the current allocation of resources to process Safe state is where there is at least one sequence that does not result in deadlock Unsafe state is a state that is not safe

Algoritmo del banquero 1.Para cada petición de recurso, verificar que el proceso que la realiza está autorizado a presentar la petición en virtud de tener un número suficiente de reclamaciones no efectuadas sobre el tipo solicitado de recurso. (Rehusar peticiones no autorizadas).

Algoritmo del banquero 1.Si un proceso solicita un recurso que no está disponible para asignación, suspender al proceso solicitante hasta que la petición pueda ser concedida con seguridad. 2.Si un proceso solicita un recurso disponible, pretender que el recurso le es concedido actualizando las estructuras de datos ASIGNADOS, NECESIDAD y DISPONIBLES. 3.Desmarcar todos los procesos.

Algoritmo del banquero 1.Hallar un proceso i desmarcado tal que: NECESIDADi <= DISPONIBLES Si se encuentra, marcar el proceso i, actualizar el vector DISPONIBLES: DISPONIBLES=DISPONIBLES+ASIG NADOSi Repetir este paso mientras puedan encontrarse procesos que califiquen.

Algoritmo del banquero 1.Si todos los procesos están marcados, el estado del sistema es seguro; por tanto, asignar el recurso solicitado. Restaurar el vector DISPONIBLES a su valor establecido en el paso 2 y salir. En caso contrario, el estado del sistema no es seguro, y por tanto suspender el proceso solicitante, restaurar ASIGNADOS, NECESIDAD y DISPONIBLES a sus valores anteriores a la ejecución del Paso 2 y salir.

Determination of a Safe State Initial State (P2 req 0-0-1)

Determination of a Safe State P2 Runs to Completion

Determination of a Safe State P1 Runs to Completion

Determination of a Safe State P3 Runs to Completion

Determination of an Unsafe State (P1 req 1-0-1)

Determination of an Unsafe State

P1 pide R1R2R3 P1365 P2325 P3633 P4424 P5202 necesidad R1R2R3 P1000 P2111 P3221 P4011 P5222 asignados 312 disponibles 877 total recursos

Deadlock Avoidance Maximum resource requirement must be stated in advance Processes under consideration must be independent; no synchronization requirements There must be a fixed number of resources to allocate No process may exit while holding resources

Deadlock Detection Request matrix Q, such that Qij represents the amount of resources of type j requested by process i. A is allocation matrix. Initially all process are unmarked. –1. Mark each process that has a row in the Allocation matrix of all zeros. –2. Initialize W=V (Available) –3. Find an i such that Pi is unmarked and Qik<=Wk for k=1…m, if none found terminate. –4. If such i is found, mark process i and set Wk=Wk+Aik for k=1…m. Return to step 3

Deadlock Detection

Strategies once Deadlock Detected Abort all deadlocked processes Back up each deadlocked process to some previously defined checkpoint, and restart all process –original deadlock may occur Successively abort deadlocked processes until deadlock no longer exists Successively preempt resources until deadlock no longer exists

Selection Criteria Deadlocked Processes Least amount of processor time consumed so far Least number of lines of output produced so far Most estimated time remaining Least total resources allocated so far Lowest priority