deadlock - Dante Cannarozzi Washington University...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Dante Cannarozzi Washington University [email protected] www.cse.wustl.edu/~djc2 Deadlock (CSE 422S) 2-Ken Wong, Oct 2008 Deadlock Example FIFO (Named Pipe) Communication » A named pipe (FIFO) is a special file that is similar to a pipe except that it is accessed as part of the file system Can be opened by multiple processes for reading or writing Kernel passes data between processes without writing to file system See fifo(4) » By default, the open call blocks until there is a reading process and a writing process (a rendezvous occurs) Server Process: Client Process: . . . . . . open(“reqFifo,O_RDONLY); open(“respFifo”,O_RDONLY); open(“respFifo”,O_WRONLY); open(“reqFifo”, O_WRONLY); . . . . . . 3-Ken Wong, Oct 2008 Definitions Resource » Some reusable object » e.g., memory, I/O device, variable Preemptable Resource » It can be taken away from the owning process with no ill effects » e.g., memory Nonpreemtable Resource » It can not be taken away from the owning process without adversely affecting its computation » e.g., a write-once device that has already started writing 4-Ken Wong, Oct 2008 Two Dining Philosophers Deadlock » A set of processes S is deadlocked if each member of S is permanently waiting for a resource held by some other member of S What can be done about deadlocks ??? 1 B A Process (0): do forever { Get A stick; Get B stick; Eat; Drop B stick; Drop A stick; } Process (1): do forever { Get B stick; Get A stick; Eat; Drop B stick; Drop A stick; } // potential deadlock Process (1a): do forever { Get A stick; Get B stick; Eat; Drop A stick; Drop B stick; } // deadlock free 5-Ken Wong, Oct 2008 Dining Philosopher Progress Diagram Deadlock is possible but depends on timing Progress (Philosopher 0) Progress (Philosopher 1) Get A Get B Drop B Drop A Get A Get B Drop B Drop A Has A Has A Has B Has B Contention for B Contention for A Deadlock Region 6-Ken Wong, Oct 2008 Deadlock Necessary Conditions » Mutual Exclusion : Only one process at a time can use a resource » Hold and Wait : A process holding one resource is waiting to acquire additional resources held by other processes » No Preemption : No resource can be forcibly taken from a processing holding it Sufficient Condition » Circular Waiting : There exists a permanent, circular sequence of processes such that each process is waiting for a resource held by the preceding process 7...
View Full Document

{[ snackBarMessage ]}

Page1 / 24

deadlock - Dante Cannarozzi Washington University...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online