Page 62 - DCAP103_Principle of operating system
P. 62
Unit 2: Process Management-I
The variable part of a message is a list of typed data items. Each entry in the list has a Notes
type, size, and value. The type of the objects specified in the message is important, since
operating-system-defined objects-such as the ownership or receive access rights, task states,
and memory segments-may be sent in messages.
The send and receive operations themselves are flexible. For instance, when a message is sent to a
mailbox, the mailbox may be full. If the mailbox is not full, the message is copied to the mailbox
and the sending thread continues. If the mailbox is full, the sending thread has four options:
1. Wait indefinitely until there is room in the mailbox.
2. Wait at most n milliseconds.
3. Do not wait at all, but rather return immediately.
4. Temporarily cache a message. One message can be given to the operating system to keep,
even though the mailbox to which it is being sent is full. When the message can be put
in the mailbox, a notification message is sent back to the sender; only one such message
to a full mailbox can be pending at any time for a given sending thread.
The final option is meant for server tasks, such as a line-printer driver. After finishing a request,
these tasks may need to send a one-time reply to the task that had requested service, but must
also continue with other service requests, even if the reply mailbox for a client is full. The receive
operation must specify from which mailbox or mailbox set to receive a message. A mailbox
set is a collection of mailboxes, as declared by the task, which can be grouped together and
treated as one mailbox for the purposes of the task. Threads in a task can receive from only a
mailbox or mailbox set for which that task has receive access. A port-status system call returns
the number of messages in a given mailbox. The receive operation attempts to receive from
either of the following:
1. Any mailbox in a mailbox set
2. A specific (named) mailbox
If no message is waiting to be received, the receiving thread may wait, wait
at most n milliseconds, or not wait.
The Mach message system attempts to avoid double-copy operations by using virtual-memory-
management techniques. Essentially, Mach maps the address space containing the sender’s
message into the receiver’s address space. The message itself is never actually copied. This
message-management technique provides a large performance boost, but works only for
intrasystem messages.
2.5.8 An Example: Windows 2000
The Windows 2000 operating system is an example of modern design that employs modularity to
increase functionality and decrease the time needed to implement new features. Windows 2000
provides support for multiple operating environments or subsystems, with which application
programs communicate via a message-passing mechanism. The application programs can be
considered to be clients of the Windows 2000 subsystem server.
The message-passing facility in Windows 2000 is called the local procedure call (LPC) facility.
The LPC in Windows 2000 communicates between two processes that are on the same machine.
It is similar to the standard RPC mechanism that is widely used, but it is optimized for and
specific to Windows 2000. Like Mach, Windows 2000 uses a port object to establish and maintain
a connection between two processes. Every client that calls a subsystem needs a communication
channel, which is provided by a port object and is never inherited. Windows 2000 uses two types
of ports—connection ports and communication ports. They are really the same but are given
different names according to how they are used. Connection ports are named objects, which are
LOVELY PROFESSIONAL UNIVERSITY 55