18.10.2014 Views

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>SIMSCRIPT</strong> <strong>II.5</strong> <strong>Programming</strong> <strong>Language</strong><br />

tity is not available, the process is put in a passive state and filed in the queue of processes waiting<br />

for the particular resource.<br />

An optional with priority expression may be added to the request statement. The queue is<br />

ranked on high priority. If the phrase is not present, the priority is treated as zero. An optional<br />

comma may be placed before the with priority phrase. Examples of the request statement<br />

are:<br />

request 1 WORKER(2) with priority 2<br />

request 2 MACHINE(JOB.TYPE)<br />

request 3 UNITS OF MATERIAL with priority 5<br />

As the resource name is in fact a permanent entity name, it should be subscripted. If it is not, the<br />

variable of the same name is used as an implicit subscript. This variable is initialized to 1 at resource<br />

creation, but care should be taken if it is subsequently altered, by for each resource<br />

statements, for example. Note that some implementations use an implicit subscript value of 1. It is<br />

recommended that explicit subscripting be used in all cases.<br />

A process that has requested some units of a resource may relinquish some number of these, but<br />

not necessarily all it has. The number of units of the resource being relinquished is added to the<br />

total quantity available. If any processes are queued awaiting the resource, they are scanned from<br />

the front of the queue. Each is reactivated, with a corresponding reduction in the quantity of available<br />

units of resource, until one is found whose request cannot be satisfied. The scan is then terminated.<br />

The process relinquishing the resource continues execution at the statement immediately following<br />

the relinquish statement. The relinquish statements corresponding to the above resource<br />

request statements would be:<br />

relinquish 1 WORKER(2)<br />

relinquish 2 MACHINE(JOB.TYPE)<br />

relinquish 3 UNITS OF MATERIAL<br />

By way of explanation, it was stated that processes may be filed in queues, either waiting for, or<br />

executing with, resources. This is not quite correct. Since a process may, in practice, require several<br />

resources concurrently, a special temporary entity (qc.e) is created at each request for a resource.<br />

It is these qc.e entities that are filed both in the set of resources associated with this<br />

process, (process), and also in either of the sets x.resource or q.resource, depending on<br />

whether the request has or has not been satisfied. Each qc.e also has a pointer attribute (who.a)<br />

pointing to the process notice of the requesting process. The attributes of the qc.e entity are shown<br />

in table 5-3. The q.resource set is ranked by high pty.a, thus permitting preemptive queuing<br />

prior to allocation of resources. The q.resource and x.resource pointers are equivalenced, as<br />

a process is either queuing or executing with any given resource.<br />

204

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!