comp.lang.ada
 help / color / mirror / Atom feed
From: prindle@NADC.ARPA
Subject: re: Sharing processor between tasks
Date: Wed, 24-Sep-86 16:19:03 EDT	[thread overview]
Date: Wed Sep 24 16:19:03 1986
Message-ID: <8609261139.AA14947@ucbvax.Berkeley.EDU> (raw)

Following up on this subject, it should be obvious that, even *if* the run-time
support for a particular compiler *does* time-slice tasks, the program as
given might not work correctly.  If "put(<string>);" were implemented as a
library routine which did a series of "put(<character>);" calls, then it would
be reasonable to expect the output to appear as:

horveirzonttical
alhorizonve........<etc>

The technically correct way to do this kind of thing is to consider the device
being written to as a resource and manage this resource with a third *server*
task.  Only this third task would be allowed to do "put"s to this device, and
would contain an accept for an entry call which passes a string to be written.
Only in this way could it be guaranteed that each string is written without
probability of another string interrupting it.  This is especially important
when using "escape" sequences which cannot be arbitrarily split up.  This
*server* task approach has the desirable (I think, for the original poster)
side effect of perfectly interspersing the strings, since, while one string
is being printed, the task outputting that string is ineligible for execution
and the other task will deposit it's request to output the other string on
the server's entry call queue.  Try it - it really works!

Frank Prindle
Prindle@NADC.arpa

             reply	other threads:[~1986-09-24 20:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1986-09-24 20:19 prindle [this message]
  -- strict thread matches above, loose matches on Subject: below --
1986-09-24 15:55 Sharing processor between tasks "BUD::PEARSON"
1986-09-24 15:55 "BUD::PEARSON"
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox