Concurrency - PowerPoint PPT Presentation

About This Presentation
Title:

Concurrency

Description:

preemption losses. Avoidance. midway between conservative and liberal ... no preemption needed. resources must be known, long blockings ... – PowerPoint PPT presentation

Number of Views:18
Avg rating:3.0/5.0
Slides: 12
Provided by: DrAlB
Learn more at: http://home.ubalt.edu
Category:

less

Transcript and Presenter's Notes

Title: Concurrency


1
Concurrency

2
  • Modern OS central themes
  • Multiprogramming
  • "the management of multiple processes within a
    single computer system"
  • Distributed processing
  • "the management of multiple processes executing
    on multiple, distributed computer systems"

Fundamental to both themes is concurrency
3
  • The concept of concurrency
  • Processes are concurrent if they exist at the
    same time
  • Processes that are either interleaved or
    overlapped in time to yield the appearance of
    simultaneous execution

P1
P2
P3
time
4
  • A simple example
  • A program to provide character echo input
    character from keyboard and output character on
    display

repeat parbegin out in output
(out, display) input (in, keyboard) parend
This program will work or not depending on the
sequence the concurrent operations take place
(copy is wrong)
5
  • How to implement concurrency
  • Programming language structures and mechanisms
  • most programs can be decomposed in at least three
    processes input, process, output
  • Operating systems structures and mechanisms
  • process interaction
  • mutual exclusion

6
  • Process Interaction

Degree of Awareness
Relationship
Influence one process has on another
Control problems
unaware
competition
results idependent timing may be affected
mutual exclusion deadlock (renewable) starvation
indirectly aware
cooperation- sharing
results may depend timing may be affected
mutual exclusion deadlock (renewable) starvation
coherence
directly aware
cooperation- communication
results may depend timing may be affected
deadlock (consumable) starvation
7
  • Competition for resources
  • Mutual exclusion
  • critical resources (nonsharable)
  • a process manages each critical resource
  • Deadlock
  • a process is holding a critical resource (c1)
    and waiting for another critical resource (c2)
  • another process is holding (c2) and waiting for
    (c1)
  • Starvation
  • one process is never granted access to a
    critical resource for other processes always get
    higher priority (and access) to the critical
    resource

8
  • Mutual exclusion requirements
  • only one process at a time is allowed access to a
    critical resource
  • a process that halts in a noncritical section
    should not affect others
  • a process should not be allowed to deadlock or
    starve
  • no delays should occur when a process requires a
    critical resource no others are using
  • a process remains in its critical section for a
    finite time only

Technical Dekker and Peterson algorithms,
and Dijkstra semaphores
9
  • Monitors
  • " a concurrency construct that contains both the
    data and procedures to perform allocation of a
    particular serially reusable shared resource or
    group of resources"
  • only one process is allowed to enter the monitor
  • if a process calls the monitor and a resource is
    already allocated the monitor calls wait (outside
    of monitor)
  • when a process releases a resource the monitor
    calls signal (and grants the resource to a
    process waiting for it)
  • it gives priority to waiting versus new

10
  • Deadlock
  • "the permanent blocking of a set of processes
    that either compete for systems resources or
    communicate with each other"
  • resources
  • reusable (not depleted with use)
  • consumable (produced and consumed)
  • conditions for deadlock
  • mutual exclusion
  • hold-and-wait
  • no preemption
  • circular wait (deadly embrace)

11
  • Deadlock management

Principle
Resource allocation policy
schemas
advantages
disadvantages
Prevention
conservative
request all resources at once preemption reso
urce ordering
processes with single burst of activity resources
whose state can be saved and restored
easily problem solved by design
inefficient, delays process initiation preempts
more than necessary, needs to be
restarted preempts without need
Detection
very liberal
invoked periodically to test deadlock
does not delay process initiation
preemption losses
Avoidance
midway between conservative and liberal
search to find at least one safe path
no preemption needed
resources must be known, long blockings
Write a Comment
User Comments (0)
About PowerShow.com