From the course: Migrating COBOL Apps

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

The deadly embrace

The deadly embrace - COBOL Tutorial

From the course: Migrating COBOL Apps

Start my 1-month free trial

The deadly embrace

- [Instructor] The solution to buried updates is to lock a file before processing it, which COBOL can do with its lock clauses. However, this introduces a second issue known as the deadly embrace which can occur at a file level or a record level. Let's see how this happens. Here we have two programs which can both access the same two files. Program 1 accesses file 1 in order to write to it and establishes its lock on that file. Program 2 accesses file 2 in order to write to it and establishes its lock on that file. It then attempts to access file 1 to write to it, but can't do that as it's locked. So it waits for the lock to be released. Meanwhile, program 1 now attempts to write to file 2, which it also can't do as it's locked and so it waits. However, it doesn't plan on releasing the file lock on file 1 until it's completed writing to file 2. Similarly program 2 doesn't plan on releasing the file lock on file 2 until…

Contents