[Robelle] [SmugBook] [Index] [Prev] [Next]

What Does MR Stand For?

Unfortunately, MPE uses MR as shorthand for both Multiple-RIN capability and Multi-Record access, which are totally unrelated concepts.

MR Stands for "Multiple-RIN"

MR is a capability of MPE that allows you to hang the computer by locking two semaphores at once. If the system manager does not give you MR capability, you can only lock one thing at a time. The second lock is rejected with an error.

The reason why MR is a dangerous capability only given to experienced programmers is that you can deadlock the system. Here is how it happens. You lock A. Someone else locks B. Then you attempt to lock B and are suspended to wait for B to be available. The other user tries to lock A and suspends because you have it locked. Result: a deadlock known as the Deadly Embrace. You are both suspended, each waiting for the other.

There is a solution to this programming dilemma: everyone must lock the resources in a fixed order (for example, don't lock B unless you lock A first). Unlock resources in the reverse order. If you follow this guideline in your applications, you can be trusted with MR capability.

MR Stands for "Multi-Record"

Normally when you call the MPE file system intrinsics you can only transfer one record at a time. If your requested length is longer than a record, it is truncated. However, if you open a file with MR access requested in the Aoptions, you can read or write several records at the same time. MPE splits them based on the record length of the file. This is a cheap trick for folding lines of output to the screen. It is also a valuable performance feature when combined with NOBUF access.

NOBUF/MR Means "Multi-Record Non-buffered"

To increase the speed of MPE file access, you can bypass the buffering software of the file system. You do this with the NOBUF access option. MPE then returns physical blocks rather than logical records. If you want to go even faster, you can also ask for Multi-Record Access. When used with NOBUF, Multi-Record really means Multi-Block. You specify NOBUF and MR in the Access Options when you open a file.

With NOBUF/MR access, MPE allows you to ask for multiple blocks in a single read or write call. MR only works on disc files and is faster because it retrieves many records with a single invocation of the file system overhead. NOBUF/MR works for reading and writing, for serial access, and for directed access.

When using NOBUF/MR, you should expect to have some trouble on the last serial read, unless it happens to return exactly the number of blocks you asked for. The best strategy is to calculate the size of the last read as a special case.

[Robelle] [SmugBook] [Index] [Mpetips] [Prev] [Next]