DataMuseum.dk

Presents historical artifacts from the history of:

RC4000/8000/9000

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about RC4000/8000/9000

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download

⟦f73b32574⟧ TextFile

    Length: 2304 (0x900)
    Types: TextFile
    Names: »tnextjob«

Derivation

└─⟦00964e8f7⟧ Bits:30007478 RC8000 Dump tape fra HCØ.
    └─⟦b2ec5d50f⟧ 
        └─⟦0b817e319⟧ »ctramos« 
            └─⟦this⟧ 

TextFile


<*find next job to get a process description
1981-11-27
*>

integer procedure find_next_job(z);
zone z;
begin
integer i,j,job,cand,jobrun,jobinqueue,lowest,projrun;
boolean found;
integer array bprojno(1:bmaxchildren,1:2),
         prio,jobtorun(1:bmaxjobs);
integer array field bref;
find_next_job:=-1;
job_in_queue:=projrun:=0;
for i:=1,2 do for j:=1 step 1 until bmaxchildren do bprojno(j,i):=-1;
for job:=1 step 1 until bmaxjobs do
begin
  if jobtable(job,2)=2 then
  begin
    <*running job*>
    found:=false;
    projrun:=projrun+1;
    for i:=1 step 1 until projrun do
    begin
      if bprojno(i,1)=jobtable(job,10) then
      begin
        found:=true;
        bprojno(i,2):=bprojno(i,2)+1;
        projrun:=projrun-1;
      end else
      if -,found and b_projno(i,1)<0 then
      begin
        bprojno(i,1):=jobtable(job,10);
        bprojno(i,2):=1;
      end new project;
    end for i;
  end job running else
  if jobtable(job,2)=1 and jobtable(job,12)=0 and jobtable(j,13)<2 then
  begin
    <*enrolled and not in a sequence and not a hold job*>
    job_in_queue:=job_in_queue+1;
    jobtorun(jobinqueue):=job;
  end enrolled;
end for job;

if testop(7) then disable
begin
  write(z,"nl",1,<:find next job: job in queue, projects :>,
      jobinqueue,projrun);
  setposition(z,0,0);
end;

<*find best job*>
if jobinqueue=0 then
begin
   waitch(bmessline,bref,free,0);
   signalch(bmessline,bref,jobtimermess);
end else
begin
  for cand:=1 step 1 until jobinqueue do
  begin
    job:=jobtorun(cand);
    prio(cand):=jobtable(job,5);
    j:=0;
    found:=false;
    repeat j:=j+1;
      found:=bprojno(j,1)=jobtable(job,10);
    until j=projrun or found;
    if found then 
      prio(cand):=prio(cand)*(bprojno(j,2)*b_job_fac+1);
  end candidate priority;

  cand:=1; lowest:=prio(1);

  for j:=1 step 1 until jobinqueue do
  begin
     if prio(j)<lowest then
     begin
       cand:=j; lowest:=prio(j);
     end better;
  end search;
  if testop(7) then disable
  begin
    write(z,"nl",1,<:best candidate :>,cand,jobtorun(cand),prio(cand));
    setposition(z,0,0);
  end;
  find_next_job:=jobtorun(cand);
end job found;
end findnextjob;
▶EOF◀