Lecture 04 Process Interaction - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Lecture 04 Process Interaction

Description:

W. Stalling s& M.B. Ib ez. Lecture 04. Process Interaction ... W. Stalling s& M.B. Ib ez. Operating System Concerns. Keep track of active processes ... – PowerPoint PPT presentation

Number of Views:37
Avg rating:3.0/5.0
Slides: 13
Provided by: eam80
Category:

less

Transcript and Presenter's Notes

Title: Lecture 04 Process Interaction


1
Lecture 04Process Interaction
  • Competition among Processes for Resources
  • Cooperation among Processes by Sharing
  • Cooperation among Processes by Communication

2
Operating System Concerns
  • Keep track of active processes
  • Allocate and deallocate resources
  • processor time memory files I/O devices
  • Protect data and resources
  • Result of process must be independent of the
    speed of execution since other processes share
    the processor time

3
Process Interaction
  • Processes unaware of each other
  • Competition (example, multiprogramming)
  • Processes indirectly aware of each other
  • Cooperation by sharing (example, processes
    sharing a common object such as an I/O buffer)
  • Process directly aware of each other
  • Cooperation by communication (example, processes
    that are able to communicate with each other)

4
Competition Among Processes for Resources
  • Execution of one process may affect the behavior
    of competing processes
  • If two processes wish access to a single
    resource, one process will be allocated the
    resource and the other will have to wait
  • Possible the blocked process will never get
    access to the resource and never terminate

5
Control Problems I
  • Mutual Exclusion
  • critical sections
  • only one program at a time is allowed in its
    critical section
  • example only one process at a time is allowed to
    send command to the printer

6
Control Problems IIDeadlock
  • process P uses R1 uses R2
  • process Q uses R2 uses R1
  • parbegin PQ parend
  • S.O. R1 -gt P
  • S.O. R2 -gt Q
  • P needs R2 but it does not release R1
  • Q needs R1 but it does not release R2

7
Control Problems IIIStarvation
  • Processes P1, P2, P3 require periodically
    resource R
  • R -gt P1
  • P2 and P3 are delayed waiting for R
  • R -gt P2
  • (R -gt P1 R-gt P2)
  • P3 is starving

8
Cooperation Among Processes by Sharing
  • Processes use and update shared data such as
    shared variables, files, and data bases
  • Writing must be mutually exclusive
  • Critical sections are used to provide data
    integrity

9
RequirementData coherence
  • a b
  • P1 a a 1
  • b b 1
  • P2 b 2 b
  • a 2 a
  • a b
  • P1 a a 1
  • P2 b 2 b
  • P1 b b 1
  • P2 a 2 a
  • a ! b

10
Cooperation Among Processes by Communication
  • Communication provides a way to synchronize, or
    coordinate, the various activities
  • Possible to have deadlock
  • each process waiting for a message from the other
    process
  • Possible to have starvation
  • two processes sending message to each other while
    another process waits for a message

11
Requirements for Mutual Exclusion
  • Only one process at a time is allowed in the
    critical section for a resource
  • If a process halts in its critical section, it
    must not interfere with other processed
  • A process requiring the critical section must not
    be delayed indefinitely no deadlock or starvation

12
Requirements for Mutual Exclusion
  • A process must not be delayed access to a
    critical section when there is no other process
    using it
  • No assumptions are made about relative process
    speeds or number of processes
  • A process remains inside its critical section for
    a finite time only
Write a Comment
User Comments (0)
About PowerShow.com