home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / vmsnet / internal / 1196 < prev    next >
Encoding:
Internet Message Format  |  1992-08-25  |  3.9 KB

  1. Path: sparky!uunet!mcsun!sunic!dkuug!tfl.dk!karsten
  2. From: karsten@tfl.dk (Karsten Nyblad)
  3. Newsgroups: vmsnet.internals
  4. Subject: Re: Searching the lock list for locks associated with a file
  5. Message-ID: <1992Aug26.123720.274@tfl.dk>
  6. Date: 26 Aug 92 10:37:20 GMT
  7. References: <920825142952.20201d28@vax4>
  8. Organization: TFL, A Danish Telecommunication Research Laboratory
  9. Lines: 69
  10.  
  11. In article <920825142952.20201d28@vax4>, RSPECTOR@vax4.bear.com writes:
  12. > I am trying to create a utility that will search the lock list database on all
  13. > systems in a cluster and return lock information about all the locks for a
  14. > specified file or records within the file.
  15. > I wrote a program that runs on every system in the cluster.  It executes the
  16. > system service $GETLKI in kernal mode to search all the locks on a given system.
  17. > This program looks for a matching resource name.  If one is found, the lock
  18. > information will be displayed.  If there is no match, the lock could possibly
  19. > be for a record within the specified file.  The program will check to see if
  20. > this lock has a parent lock id.  If the id exists, the parent's resource name
  21. > will be checked for a match.  If a match is found, then the lock information
  22. > will be displayed.  If there is no match, then the lock will be skipped.
  23. > This solution will not work.  It is very slow.  There are about 30,000 locks
  24. > at any one time in use.  It also appears that my process uses a lot of the CPU
  25. > and goes into RWSCS state quite often.  Therefore, I am looking for an
  26. > alternative.
  27. > I would like to be able to write some privileged code to calculate a hash value
  28. > for the specified file and find the resource block from the hash table.
  29. > Once I have this I will be able to find the sub resource blocks and all the
  30. > locks associated with the resource and sub resources.
  31. > I would appreciate any help with this matter.
  32. > Robin Spector
  33. > Bear Stearns Inc. & Co.
  34. > New York, N.Y. 10167
  35. > (212) 272-3696
  36.  
  37. First, listing the locks taken by the XCP wont help you much.  The locks
  38. are on node basis, i.e. owned by the node in the cluster.  Within the
  39. single node, access is synchronize by the XCP.  The easiest way to get
  40. the lock on a file is geting the reference for the FCB, which has a
  41. field containing the lockid on the lock of the file.  The reference
  42. for the FCB is optained by a QIO to the XCP asking for the statistics
  43. block.  Refer to chapter 1 of the I/O control manuals.  To find the single
  44. processes locking a file you need to track the WCBs (Window Control Block),
  45. which lists the processes locking the file on the current node.
  46. I will send you a program that does the trick.  It needs SYSLCK
  47. WORLD and CMKNRL priviledges.  The program is not completed,
  48. but it does what you need on VMS version 5.4 and later.  DEC
  49. cleaned up some symbol names in version 5.4, so it will not
  50. compile on earlier versions.  The program will not list processes
  51. locking the file as a global sections.  The program does not synchronizes
  52. with the XCP, but is written with handlers so that it will not crash
  53. your computer.  Refer to VMS file Systems Internals for details and
  54. for information on how to synchronize properly with the XCP (order
  55. number EY-F575E-DP).
  56.  
  57. The RMS locks are as far as I know organized into a lock tree with
  58. a parent lock consisting of the prefix RMS$, the file id, and the
  59. volume lock name.  The file id takes up 4 bytes if the file is not
  60. located on a volume set and the file number is less than 2**16.
  61. Otherwise it takes up 6 bytes.  You can chase through the
  62. resource database and find all sublocks in that way.  Refer to
  63. VAX/VMS Internals and Data Structures for details (order number
  64. EY-C171E-DP)
  65.  
  66. What do you really want?  Finding the process locking the
  67. ressource somebody wants?  It can be done by going through
  68. the list of locks associated to "somebodies" process.  That list is
  69. refered from the PCB.
  70.  
  71. Karsten Nyblad
  72. TFL, A Danish Telecommunication Research Laboratory
  73. E-mail: karsten@tfl.dk
  74.