![]() | Note |
---|---|
Transaction Processing may offer a more efficient and more easily managed solution to the issue of potentially conflicting updates. For more information, see General Language Features of M chapter of the GT.M Programmer's Guide. |
At the GT.M prompt of John, execute the following commands:
GTM>lock +^ABC
Then execute the following command to display the status of the LOCK database.
GTM>zsystem "lke show -all"
This command produces an output like the following:
DEFAULT ^ABC Owned by PID= 3657 which is an existing process
Now, without releasing lock^ABC
, execute the
following commands at the GT.M prompt of Tom.
GTM>lock +^ABC
Now, at the GT.M prompt of John, execute the following command:
GTM>zsystem "LKE -show -all -wait"
This command produces an output like the following:
DEFAULT ^ABC Owned by PID= 3657 which is an existing process Request PID= 3685 which is an existing process
A deadlock situation can occur in the following situation:
John Tom LOCK +file_1 LOCK +file_2 LOCK +file_2 LOCK +file_1
Let us now create this situation.
At the GT.M prompt of John, execute the following commands:
GTM>set file1="file_1.txt" GTM>lock +file1 GTM>open file1:APPEND GTM>use file1 GTM>write "John",! GTM>close file1
Note that John has not released the LOCK on resource "file1".
At the GT.M prompt of Tom, execute the following commands:
GTM> set file2="file_2.txt" GTM> lock +file2 GTM> open file2:APPEND GTM> use file2 GTM>write "Tom",! GTM>close file2
Note that Tom has not released the LOCK on resource "file2".
Now, at the GT.M prompt of John, execute the following commands.
GTM>set file2="file_2.txt" GTM>lock +file2
Execute the following command at LKE prompt to view this deadlock situation.
LKE>show -all -wait file1 Owned by PID= 2080 which is an existing process Request PID= 2089 which is an existing process file2 Owned by PID= 2089 which is an existing process Request PID=2080 which is an existing process
![]() | Caution |
---|---|
Avoid using the |