HPlogo Resource Management Programmer's Guide: HP 3000 MPE/iX Computer Systems

Chapter 2 Managing Shared Resources with RINs

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

When you are developing an application you may wish to manage a specific resource that is being shared by a set of processes in a way that guarantees that one process at a time has exclusive access to that resource. MPE XL provides Resource Identification Numbers (RINs) that enable you to manage shared resources.

You can use RINs described in this chapter to manage anything you may consider a resource to your program, be it a device, a portion of a file, or a section of code in your program. In addition, the operating system provides a resource management scheme similar to RIN management through the use of the FLOCK and FUNLOCK intrinsics to guarantee your process exclusive access to a file being shared by a set of processes located in different jobs/sessions. Refer to Accessing Files Programmer's Guide (32650-90017) for details on using FLOCK and FUNLOCK.

A RIN is not assigned by MPE XL to any particular resource. The association of a RIN and a resource is established by cooperating programmers whose programs are sharing the resource. The RIN value is known to the operating system, but the resource with which it is associated is known only to you and other programmers who have agreed to manage the resource through RIN management.

Within the programs being executed by different processes, you and other programmers must first agree to associate a RIN to a particular resource. When the process executing your program seeks exclusive access to that resource, the process must successfully lock the associated RIN prior to accessing the resource. Successfully locking the RIN means that your process can access the resource exclusively, so long as the RIN remains locked.

If the attempt to lock the RIN is unsuccessful, it means that the RIN is locked and another process has exclusive access to the associated resource.

NOTE: The successful management of resources using RINs is predicated upon the assumption that all accessors of a particular resource have agreed to access the resource through RIN-locking intrinsics. If a process does not use this RIN management scheme to access the resource, exclusive access to that resource cannot be guaranteed.
Feedback to webmaster