心得分享

Card image cap

高同學 報告/作業 分享經驗 2015/11/12 OS

2015/11/12 OS
名稱 2015/11/12 OS
日期 2015/10/14
課程名稱 作業系統
指導教師 劉艾華

Homework for Chapter 2:
1.
Which situation is suitable to use message passing instead of shared-memory model for communication
between processes? What are the pros and cons of using these two models?

2.
What is “system calls?” Please specify the functions and the purposes of a system call in a computer
system.

3.
Please specify different ways for using the hardware configuration during the system generation (SYSGEN).
What are the major differences between these different ways?

1-1
When there is a few data need to be exchange is useful to message passing,because there is no conflicts need to be avoided.
1-2 Advantages
a.Communication explicit, simpler to understand
b.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.
c.Easier to use sender-initiated communication, which may have some advantage in performance.
1-3 Disadvantages
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.
1-4
Advantages of share-memory communication model:
a.Compatibility with SMP hardware.
b.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.
c.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
a.Used to modify a copy of the source code of the OS and have it re-compiled.
b.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.

更新日期:2015/11/12 下午 10:39:24