13.07.2015 Views

iAPX 286 Operating System Writers Guide 1983

iAPX 286 Operating System Writers Guide 1983

iAPX 286 Operating System Writers Guide 1983

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

DATA SHARING, ALIASING, AND SYNCHRONIZATIONOTHER FORMS OF SYNCHRONIZATIONYou may wish to implement other forms of synchronization; for example:• Conditional variation of WAIT_SEMAPHORE that does not force a task to wait when the semaphorehas not been signalled.• Timed waiting, so that a task can be awakened if the semaphore is not signalled within a reasonabletime. (This helps guard against deadlocks.)• An extension of the semaphore concept known as a region. A region is similar to a semaphore exceptthat only the task that acquires a: region can release (signal) it, and a task that holds a region cannotbe suspended.MESSAGE PASSINGMessage passing is a general purpose means for transferring data from the address space of one taskto the address space of another, cooperating task. There are two aspects to the technique:• Transferring data from a segment in one task's address space into a segment in the receiving task'sspace• Transferring a segment from one task's space into another'sThe first case is suitable for passing relatively small amounts of data, such as parameters, informationdescribing events, etc. The second case has two primary applications:• For transferring large "consumable resources" such as I/0 buffers• For transferring aliases that implement the previously described method of "sharing via aliases"When an alias is passed as part of a message, the operating system installs the alias in a descriptortableslot determined by the receiving task.Message-Passing ExampleFigure 5-6 shows an example data structure for implementing a simple form of message passing. Thisstructure defines a mailbox, a queue of tasks waiting for messages from the mailbox, and a queue ofundelivered messages. The system may contain one mailbox for every communication channel betweentasks. For simplicity, this example assumes that the format of messages for all mailboxes is the same,consisting of a fixed-length data item and two descriptors.If each mailbox resides in a unique segment, then these advantages result:• Mailboxes are protected from operations on other mailboxes.• A selector can serve as the identifier of a mailbox.Only the sending and receiving tasks need access to a mailbox; therefore, the appropriate tables fordescriptors for mailbox segments are the LDTs of each of the tasks that share a mailbox. All tasks canshare a global mailbox, however, if its descriptor is in the GDT. The DPL for all mailbox segmentsshould be zero to prevent procedures outside the operating system from interfering with message passing.Mailboxes require at least two procedures: SEND_MESSAGE and RECEIVE_MESSAGE. Figure5-7 shows examples of these .procedures. Both procedures must run at PL 0 to access level-O mailbox5:-10 121960·001

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

Saved successfully!

Ooh no, something went wrong!