作業系統平時考,範圍:第一章~第四章

yakconspiracyΛογισμικό & κατασκευή λογ/κού

14 Δεκ 2013 (πριν από 3 χρόνια και 7 μήνες)

263 εμφανίσεις


1

作業系統平時考,範圍:第一章~第四章

1.

What are the two main purposes of an operating system?

ANS: (1) convenience for the user (2) efficient operation of the computer system

2.

What is the main advantage of multiprogramming?

ANS: Multiprogramming increases CPU utilization by or
ganizing jobs so that the CPU always has
one to execute.

3.

Describe the differences between symmetric and asymmetric multiprocessing. What are three
advantages and one disadvantage of multiprocessor systems?

ANS:

Symmetric Multiprocessing

Asymmetric Multipro
cessing

Each processor runs an identical copy of
the operating system
.

Each processor is assigned a specific
task;

All processors are peers.

M
aster

processor schedules and
allocated work to slave

processors.

Most modern operating systems support
SMP

Mo
re common in extremely large
systems

Advantages:

a)

I
ncreased throughput

b)

E
conomy of scale

c)

I
ncreased reliability (graceful degradation, fault
tolerant
)

Disadvantage:

a)

I
ncreased hardware
and software
complexity

4.

Give two reasons why caches are useful.
W
hat probl
ems do they solve?
W
hat problems do they
cause?
I
f a cache can be made as large as the device for which it is caching (for instance, a
cache as large as a disk), why not make it that large and eliminate the device?

ANS:

Reasons: Locality of reference

Tempo
ral

locality: data

items

used
by
now will be needed again
with
in a sort
span of
time.

Spatial

locality:
data

items
adjacent to the currently used one will be needed within a short span
of time

Problems solved:

I
ncreased performance: ease the speed gaps bet
ween different levels of storage hierarchies

P
roblems caused:

P
ossibility of inconsistency

Caches are volatile while disks are not.

5.

How does the CPU determine which type of interrupt has occurred?

ANS: (pp.29)

a)

P
olling

b)

V
ectored interrupt system

6.

What are the

two modes for dual
-
mode operation?

W
hat makes the system change its operation

2

mode from one to another?

ANS:



U
ser mode:
execution done on behalf of a user.



Monitor mode (also kernel mode or system mode)
:

execution done on behalf of operating
system.

Privi
leged instructions can be issued only in monitor mode.

When an interrupt or fault occurs hardware switches to

monitor mode.

7.

What are the five major activities of an operating system in regard to process management?

ANS: 1) process creation and deletion, 2)

process suspension and resumption, 3) mechanisms for
process synchronization, 4) mechanisms for process communication, 5) mechanisms for deadlock
handling

8.

What are the three major activities of an operating system in regard to memory management?

ANS: 1) k
eeping track of which parts of memory are currently used and by whom, 2) deciding
which processes are to be loaded into memory when memory space become available, 3) allocating
and de
-
allocating memory space as needed

9.

What are the three major activities of

an operating system in regard to secondary
-
storage
management?

ANS: 1) free
-
space management, 2) storage allocation, 3) disk scheduling

10.

What are the five major activities of an operating system in regard to file management?

ANS: 1) creating and deleting f
iles, 2) creating and deleting directories, 3) supporting primitives for
manipulating files and directories, 4)
mapping files onto secondary storage, 5) backing up files on
stable (nonvolatile) storage media

11.

What is the purpose of system calls?

ANS: provid
e the interface between a process and the operating system

12.

What is the purpose of system programs?

ANS: System programs provide a convenient environment for program development and execution.
Some of them are simply user interface to system calls; others a
re considerably more complex.

13.

What is the main advantage of the layered approach to system design?

ANS:
Modularity: simplifies debugging and system verification

14.

What is the main advantage of the microkernel approach to system design?

ANS: 1)
easier to exte
nd a microkernel, 2) easier to port the operating system to new architectures
,
3)

more reliable (less code is running in kernel mode)
, 4)

more secure

15.

What are the five states that a process may be in during its execution?

ANS:



new: The process is being cr
eated.



running: Instructions are being executed.



waiting: The process is waiting for some event to occur.



ready: The process is waiting to be assigned to a process.



terminated: The process has finished execution.

16.

What is a long
-
term scheduler? What is a sh
ort
-
term scheduler?

ANS:


3



Long
-
term scheduler (or job scheduler)


selects which

processes should be brought into
the ready queue.



Short
-
term scheduler (or CPU scheduler)


selects which

process should be executed next
and allocates CPU.

17.

What is an I/O
-
bou
nd process? What is a CPU
-
bound process?

ANS:



I/O
-
bound process


spends more time doing I/O than

computations, many short CPU
bursts.



CPU
-
bound process


spends more time doing

computations; few very long CPU bursts.

18.

What are the four reasons for an envi
ronment that allows process cooperation?

ANS:



Information sharing



Computation speed
-
up



Modularity



Convenience

19.

What are the three types of process scheduling queues?

ANS:



Job queue


set of all processes in the system.



Ready queue


set of all processes res
iding in main

memory, ready and waiting to
execute.



Device queues


set of processes waiting for an I/O

device.

20.

Describe the actions taken by a kernel to switch context between processes.

ANS:

The context of a process is represented in the PCB of a process
; it includes the value of the CPU
registers, the process state, and memory management information.

When
a context
switch

occurs,

the
kernel saves the context of the old
the old process
in its PCB and
load
s

the saved
context of the new process scheduled to

run.