Sie sind auf Seite 1von 2

CHAPTER 5

1) The total number of schedules possible (number of ways to order n distinct objects in a sequence) is n!
n! (n factorial = n × (n - 1) × ( n - 2) × ... × 2 × 1).
2) The basic difference between preemptive and non-preemptive scheduling is that in preemptive
scheduling the CPU is allocated to the processes for the limited time. While in Non-preemptive scheduling,
the CPU is allocated to the process till it terminates or switches to waiting state.
3) A. Execute in order arrived to the CPU
P1 → P2 → P3 = ( 8 + (12 - 0.4) + (13 - 1)) / 3 = 10.53
B. P1 executes and then we find P3 is a shorter process than P2.
P1 → P3 → P2 = ( 8 + (9 - 1) + (13 - 0.4)) / 3 = 9.53
C. Idle for 1, then use SJF. P3 shortest, P2 next shortest, P1 longest.
Idle → P3 → P2 → P1 = ((2 - 1) + ( 6 - 0.4 ) + ( 14 - 0)) / 3 = 6.87
4) By using different time-quantum sizes, you can allow processes with shorter quantum and frequent processes
with short execution time to be serviced quickly while processes with large quantum can be in another
queue.
a. In both algorithms, the shortest job has the highest priority.
b. In the lowest level of the multilevel feedback queue, the FCFS is used.
c. In both algorithms, higher priority is assigned to the earlier job.
d. No direct relationship
5) I/O-bound programs would not require much CPU usage, having short CPU bursts. CPU-bound programs
require large CPU bursts. CPU-bound processes do not have to worry about starvation because I/O bound
programs finish running quickly allowing CPU-bound programs to use the CPU often.
6) Process contention scope (PCS) scheduling is performed local to each process. System contention scope
(SCS) scheduling is performed on the operating system with kernel threads. On systems that use many-to-
one or many-to-many, PCS and SCS scheduling is different. On systems using one-to-one, PCS and SCS
scheduling is the same.
7) Yes. Timing is crucial to real-time applications. If a thread is marked as real-time but is not bound to an
LWP, the thread may have to wait to be attached to an LWP before running.

CHAPTER 8
1) A logical address does not refer to an actual existing address; rather, it refers to an abstract address in an
abstract address space. Contrast this with a physical address that refers to an actual physical address in
memory. A logical address is generated by the CPU and is translated in to a physical address by the memory
management unit (MMU) (when address binding occurs at execution time). Therefore, physical addresses
are generated by the MMU.
2) The major advantage of this scheme is that it is an effective mechanism for code and data sharing. For
example, only one copy of an editor or a compiler code needs to be kept in memory, and this code can be
shared by all processes needing access to the editor or compiler code. Another advantage is protection of
code against erroneous modification. The only disadvantage is that the code and data must be separated,
which is usually adhered to in a compiler-generated code.

3) Paging is implemented by breaking up an address into a page and offset number. The most efficient method
is to break the address into X page bits and Y offset bits. This is done rather than performing calculations on
the address to calculate the page number and offset. Splitting an address between bits results in a page size
that is a power of 2 because each bit position represents a power of 2.
4) A. Addressing within a 1024-word page requires 10 bits because 1024 = 2 10. Since the logical address space
consists of 8 = 23 pages, the logical addresses must be 10+3 = 13 bits
B. Similarly, since there are 32 = 25 physical pages, phyiscal addresses are 5 + 10 = 15 bits long.
5) The effect is that two pages in a single process refer to the same physical page. Hence, if you change a byte
at one address, a byte at the same offset in the other page will change. This can be used to perform copies
quickly by mapping a page read-only at two addresses. If it is modified, then the copy can be done later (if
at all).
6) Since segment tables are a collection of base-limit registers, segments can be shared when entries in the
segment table of two different jobs point to the same physical location. The two segment tables must have
identical base pointers and the shared segment number must be the same in the two processes.
7) Both of these problems reduce to a program being able to reference both its own code and its data without
knowing the segment or page number associated with the address. MULTICS solved this problem by
associating four registers with each process. One register had the address of the current program segment,
another had a base address for the stack, another had a base address for the global data, and so on. The idea
is Practice Exercises 27 that all references have to be indirect through a register that maps to the current
segment or page number. By changing these registers, the same code can execute for different processes
without the same page or segment numbers.
8) a. Protection not necessary, set system key to 0.
b. Set system key to 0 when in supervisor mode.
c. Region sizes must be fixed in increments of 2k bytes, allocate key with memory blocks.
d. Same as above.
e. Frame sizes must be in increments of 2k bytes, allocate key with pages.
f. Segment sizes must be in increments of 2k bytes, allocate key with segments.

CHAPTER 9
1) A page fault occurs when an access to a page that has not been brought into main memory takes place. The
operating system verifies the memory access, aborting the program if it is invalid. If it is valid, a free frame
is located and I/O is requested to read the needed page into the free frame. Upon completion of I/O, the
process table and page table are updated and the instruction is restarted.
2) a. n b. p
3) a. Stack—good
b. Hashed symbol table—not good
c. Sequential search—good.
d. Binary search—not good
4) 1 Optimal no
2 LRU no
3 Second-chance yes
4. FIFO yes
5) The costs are additional hardware and slower access time. The benefits are good utilization of memory and
larger logical address space than physical address space.
6) .
7) a. 50 b. 5,000
8) .
9) You can use the valid/invalid bit supported in hardware to simulate the reference bit. Initially set the bit to
invalid. On first reference a trap to the operating system is generated. The operating system will set a
software bit to 1 and reset the valid/invalid bit to valid.
10) No. An optimal algorithm will not suffer from Belady’s anomaly because—by definition—an optimal
algorithm replaces the page that will not be used for the longest time. Belady’s anomaly occurs when a page-
replacement algorithm evicts a page that will be needed in the immediate future. An optimal algorithm
would not have selected such a page.
11) a. FIFO. Find the first segment large enough to accommodate the incoming segment. If relocation is not
possible and no one segment is large enough, select a combination of segments whose memories are
contiguous, which are “closest to the first of the list” and which can accommodate the new segment. If
relocation is possible, rearrange the memory so that the first N segments large enough for the incoming
segment are contiguous in memory. Add any leftover space to the free-space list in both cases.
b. LRU. Select the segment that has not been used for the longest period of time and that is large enough,
adding any leftover space to the free space list. If no one segment is large enough, select a combination of
the “oldest” segments that are contiguous in memory (if relocation is not available) and that are large
enough. If relocation is available, rearrange the oldest N segments to be contiguous in memory and replace
those with the new segment.
12) a. Thrashing is occurring.
b. CPU utilization is sufficiently high to leave things alone, and increase degree of multiprogramming.
c. Increase the degree of multiprogramming.
13) The page table can be set up to simulate base and limit registers provided that the memory is allocated in
fixed-size segments. In this way, the base of a segment can be entered into the page table and the
valid/invalid bit used to indicate that portion of the segment as resident in the memory. There will be some
problem with internal fragmentation.

Das könnte Ihnen auch gefallen