11/13 11/06 OS | |
---|---|
作品名稱 | 11/06 OS |
日期 | 11/13 |
課程名稱 | 作業系統 |
指導教師 | 劉艾華 |
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?
1-1) Message passing is useful for exchanging smaller amounts of data,because conflicts need be avoided. It is also easier to implement than is shared memory for inter computer communication. Message passing is useful when smaller numbers of data need to be exchanged, because no conflicts need to be avoided.
1-2)Shared Memory Model
pros:
• An advantage of this model from the programmer’s point of view is that the notion of data “ownership” is lacking, so there is no need to specify explicitly the communication of data between tasks. Program development can often be simplified.
cons:
An important disadvantage in terms of performance is that it becomes more difficult to understand and manage data locality.Keeping data local to the processor that works on it conserves memory accesses, cache refreshes and bus traffic that occurs when multiple processors use the same data.Unfortunately, controlling data locality is hard to understand and beyond the control of the average user.
Message Passing
pros:
1.The state of Mutable/Shared objects are harder to reason about in a context where multiple threads run concurrently.
2.Synchronizing on a Shared Objects would lead to algorithms that are inherently non-wait free or non-lock free.
3.In a multiprocessor system, A shared object can be duplicated across processor caches. Even with the use of Compare and swap based algorithms that doesn't require synchronization, it is possible that a lot of processor cycles will be spent sending cache coherence messages to each of the processors.
4.A system built of Message passing semantics is inherently more scalable. Since message passing implies that messages are sent asynchronously, the sender is not required to block until the receiver acts on the message.
cons:
1.Some algorithms tend to be much simpler.
2.A message passing system that requires resources to be locked will eventually degenerate into a shared object systems. This is sometimes apparent in Erlang when programmers start using ets tables etc. to store shared state.
3.If algorithms are wait-free, you will see improved performance and reduced memory footprint as there is much less object allocation in the form of new messages.
2. What is “system calls?” Please specify the functions and the purposes of a system call in a computer system.
2-1) The invocation of an operating system routine. Operating systems contain sets of routines for performing various low-level operations. For example, all operating systems have a routine for creating adirectory. If you want to execute an operating system routine from aprogram, you must make a system call.
2-2) System calls provide an interface to communicate with the operating system kernel. Kernel is the core of the operating system and it facilitates the user programs by managing the hardware resources. Kernel provides a simple interface to the application programs to interact with the hardware and that interface is provided in the form of system calls. Basic system services such as accessing files and the communications amongst the processes are provided to the application programs via system calls.System calls allow user-level processes to request services of the operating 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?
3-1)
a:Used to modify a copy of the source code of the OS and have it re-complied.
b:Used to create tables and modes from a precompiled library.The needed modules are linked together to form the generated OS.
c:Construct a system that is completely table driven.All the code is always part of the system,and selection occurs at execution time,rather than at compile or link time.
3-2)The size and generality of the generated system and the ease of modification as the hardware configuration changes.
更新日期:2015/11/13 下午 11:22:33