Modern Operating Systems by Herbert Bos ...
Modern_Operating_Systems_by_Herbert_Bos_and_Andrew_S._Tanenbaum_4th_Ed.pdf-M ODERN O PERATING S YSTEMS
Showing 616 out of 1137
Modern Operating Systems by Herbert Bos and Andrew...
Modern_Operating_Systems_by_Herbert_Bos_and_Andrew_S._Tanenbaum_4th_Ed.pdf-M ODERN O PERATING S YSTEMS
Modern Operating Systems by Herbert...
Modern_Operating_Systems_by_Herbert_Bos_and_Andrew_S._Tanenbaum_4th_Ed.pdf-M ODERN O PERATING S YSTEMS
Page 616
SEC. 8.3
DISTRIBUTED SYSTEMS
585
Tuples are retrieved from the tuple space by the
in
primitive. They are ad-
dressed by content rather than by name or address.
The fields of
in
can be expres-
sions or formal parameters. Consider, for example,
in("abc", 2, ?i);
This operation ‘‘searches’’ the tuple space for a tuple consisting of the string
‘‘abc’’, the integer 2, and a third field containing any integer (assuming that
i
is an
integer). If found, the tuple is removed from the tuple space and the variable
i
is
assigned the value of the third field. The matching and removal are atomic, so if
two processes execute the same
in
operation simultaneously, only one of them will
succeed, unless two or more matching tuples are present. The tuple space may even
contain multiple copies of the same tuple.
The matching algorithm used by
in
is straightforward. The fields of the
in
primitive, called the
template
, are (conceptually) compared to the corresponding
fields of every tuple in the tuple space.
A match occurs if the following three con-
ditions are all met:
1.
The template and the tuple have the same number of fields.
2.
The types of the corresponding fields are equal.
3.
Each constant or variable in the template matches its tuple field.
Formal parameters, indicated by a question mark followed by a variable name or
type, do not participate in the matching (except for type checking), although those
containing a variable name are assigned after a successful match.
If no matching tuple is present, the calling process is suspended until another
process inserts the needed tuple, at which time the called is automatically revived
and given the new tuple. The fact that processes block and unblock automatically
means that if one process is about to output a tuple and another is about to input it,
it does not matter which goes first. The only difference is that if the
in
is done be-
fore the
out
, there will be a slight delay until the tuple is available for removal.
The fact that processes block when a needed tuple is not present can be put to
many uses. For example, it can be used to implement semaphores.
To create or do
an
up
on semaphore
S
, a process can execute
out("semaphore S");
To do a
down
, it does
in("semaphore S");
The state of semaphore
S
is determined by the number of (‘‘semaphore S’’) tuples
in the tuple space.
If none exist, any attempt to get one will block until some other
process supplies one.
In addition to
out
and
in
, Linda also has a primitive operation
read
, which is
the same as
in
except that it does not remove the tuple from the tuple space. There


Ace your assessments! Get Better Grades
Browse thousands of Study Materials & Solutions from your Favorite Schools
Concordia University
Concordia_University
School:
Operating_Systems
Course:
Great resource for chem class. Had all the past labs and assignments
Leland P.
Santa Clara University
Introducing Study Plan
Using AI Tools to Help you understand and remember your course concepts better and faster than any other resource.
Find the best videos to learn every concept in that course from Youtube and Tiktok without searching.
Save All Relavent Videos & Materials and access anytime and anywhere
Prepare Smart and Guarantee better grades

Students also viewed documents