10/12 11/06 OS作業

名稱
11/06 OS作業
描述
11/06 OS作業
日期
11/12
課程名稱
作業系統
指導教師
劉艾華
心得
1.
(1) Which situation is suitable to use message passing instead of shared-memory model for communication between processes?
(2) What are the pros and cons of using these two models?

(1)
Message passing is more suitable when we are exchanging smaller amount of data,because there are no conflicts to be avoided.

(2)
Pros of message passing:
-1. With hostId and processId,it's more quickly and explicit to access information.
-2. The special-purpose daemons can control the schedule of serving and the requirement of connecting.
-3. Before getting the connection,we must get permission.
And the connection is only used by each other,so it can be safe.
-4. The OS can provide some support such like link management.
-5. It make it easier to implement for intercomputer communication.

Cons of message passing:
-1. When our connection are made over and over again, daemons need to take more times to be awakened.
-2. It can be used only when we are accessing smaller amount of data.
-3. It make it hard for OS to work because it OS .

Pros of shared-memory:
-1. It is faster, efficient, reliable and cheaper.
-2. It can gain the information in the shared areas.
-3. It's not under the OS's control.
-4. There won't be more than one process in the same location simultaneously.
-5. It allows maximum speed and convenience of communication.

Cons of shared-memory:
-1. Programmers must spend much more time on the changing information between CPU1 and CPU2.
-2. It's hard to expand.
-3. Processes have to race and only one can get the CPU to excecute the instruction.
-4. With the increasing of CPU, the efficiency of memory will be worse and worse.

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

(1)
System call can provide the interface between a running program and the OS.
Typically written in a high-level language such as C or C++. May need to be written in low-level assembly language.

(2)
Five types of system calls:

-1. Process control: Manage all the condition of process. For example, whether the process is executing normally, if it's not,there comes a debugger.It can also identify the attributes of process even set.

-2. File management: Manage all the condition of files, such as creating, deleting, opening, closing, reading and writing.

-3. Device management: Manage all the condition of device, For instance, whether the device is correctly attach or not, get or set the attributes.

-4. Information maintenance: It exist for transferring information between the user program and the OS.

-5. Communications: There are two common models of interprocess communication, the message-passing model and the shared memory model. It can make a communication between two different processes.

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

(1)
-1. Modify a copy of source code of the OS; and then the OS will be complied.
-2. It's possible to construct a system that is completely table driven.

(2)
The major differences among these approaches are the size and generality of the generated system and the ease of modification as the hardware configuration changes.