(1-1) Message passing is useful when smaller numbers of data need to be exchanged, because no conflicts need to be avoided.
(1-2)Advantages of message-passing communication model : (1) The hardware cam be simpler(2)Communication explicit, simpler to understand. (3)Explicit communication focuses attention on costly aspect of parallel computer , sometimes leading to improved structure in multiprocessor program.(4)Synchronization is naturally associated with sending messages , reducing the possibility for errors introduced by incorrect synchronization. (5)Easier to use sender-initiated communication, which may have some advantage in performance.
Disadvantages of message-passing communication model: In addition to requiring the explicit management of data and communication, the message passing paradigm has one intrinsic disadvantage that can be mitigated but not eliminated by good interface design: the presence of higher endpoint costs in message passing models as compared to shared memory. The cost of assembling and disassembling messages, often called marshaling cost, is intrinsic to message passing because messages are, by nature, transient and unassociated with computational data structures. At the source of a message, data is gathered together from memory based data structures and copied into the network. At the destination, the reverse must occur, namely data must be copied from the network into memory based data structures. This is an intrinsic cost of message passing and may be contrasted with shared memory, for which data remains associated with memory-based data structures at all times, even during communication. It is important to note, however, that the marshaling cost of message passing can be less of an issue in comparison with shared memory when implementation and communication patterns are taken into consideration. For instance, communication patterns that exhibit poor cache locality and multiple round-trip network latencies can strongly degrade the performance of hardware-based shared-memory mechanisms. Further, certain classes of communication require copying anyway; page migration is a good example of this. In such cases, the marshaling cost in message passing is directly matched by copying costs in shared memory.
Advantages of share-memory communication model: (1)Compatibility with SMP hardware. (2)Ease of programming when communication patterns are complex or very dynamically during execution.(3)Ability to develop applications using familiar SMP model, attention only on performance critical accesses.(4)Lower communication overhead, better use of BW for small items, due to implicit communication and memory mapping to implement protection in hardware, rather than through the I/O system. (5)HW-controlled caching to reduce remote comm. By caching of all data, both shared and private.
Disadvantages of shared-memory communication model: One of the deficiencies of the shared-memory communication model is the fact that it is, by nature, a polling interface. While this can make for extremely efficient communication under some circumstances, it can have a negative impact on synchronization operations. This has been enough of a concern that many multiprocessor architects have augmented the basic shared-memory communication model with additional synchronization mechanisms. Another disadvantage of shared memory is that every “real” communication operation requires a complete network round-trip; no one-way communication of data is possible.
(2-1) System calls provide the interface between a running program and the operating system. Typically written in a high-level language (C or C++). May need to be written in low-level assembly language.
(2-2) There are 5 different categories of system calls: process control, file
manipulation, device manipulation, information maintenance and communication.
process control: A running program needs to be able to stop execution either
normally or abnormally. When execution is stopped abnormally, often a dump of memory is taken and can be examined with a debugger.
file manipulation : Some common system calls
are create, delete, read, write, reposition, or close. Also, there is a need to determine the file attributes – get and set file attribute. Many times the OS provides an API to make these system calls.
device manipulation : Process usually require several resources to execute, if
these resources are available, they will be granted and control returned to the user process. These resources are also thought of as devices. Some are physical, such as a video card, and others are abstract, such as a file.
User programs request the device, and when finished they release the device. Similar to files, we can read, write, and reposition the device.
information maintenance : Some system calls exist purely for transferring
information between the user program and the operating system. An example of this is time, or date.
The OS also keeps information about all its processes and provides system calls to report this information.
Communication : There are two models of interprocess communication, the
message-passing model and the shared memory model.
(1)Message-passing uses a common mailbox to pass messages between processes.
(2)Shared memory use certain system calls to create and gain access to create and gain access to regions of memory owned by other processes. The two processes exchange information by reading and writing in the shared data.
(3-1)(1.)Used to modify a copy of the source code of the OS and have it re-compiled.
(2.)Used to create tables and modules from a precompiled library. The needed modules are linked together to form the generated OS.
(3-2) The size and generality of the generated system and the ease of modification as the hardware configuration changes.