CS433 zhang hw21~hw34

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Consider the following sequence of page references: 0, 1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1 Assuming four initially empty frames in the physical memory, how many page faults would occur using the Optimal page replacement algorithm?

10

Consider the following sequence of page references: 0, 1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1 Assuming four initially empty frames in the physical memory, how many page faults would occur using the LRU page replacement algorithm?

11

Assuming a 1-KB (1024 bytes) page size, what is the page number for byte address 121357? Give your answer as a decimal number.

118

Assuming a 2-KB (2048 bytes) page size, what is the page number for byte address 27253187? Give your answer as a decimal number.

13307

Consider the following sequence of page references: 0, 1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1 Assuming four initially empty frames in the physical memory, how many page faults would occur using the FIFO page replacement algorithm?

14

Given the logical address 0xAEF9 (in hexadecimal) with a page size of 256 bytes, what is the page number?

A. 0xAE

A page-table base register stores

A. a pointer to the page table in memory.

A translation look-aside buffer is used to

A. cache page table entries.

ACL (access-control list) is associated with each file and directory. It

A. specifies user names and types of access allowed for each of them

A thread using POSIX condition variables, a thread

A. must lock the associated mutex lock before calling pthread_cond_wait and unlock it after calling pthread_cond_signal.

Given the logical address 0xAEF9 (in hexadecimal) with a page size of 256 bytes, what is the page offset?

B. 0xF9

Assume the value of the base and limit registers of a process are 1200 and 350 respectively. Which of the following physical addresses is allocated to this process?

B. 1205

A claim edge in a resource-allocation graph indicates that

B. a process may request a resource.

Deadlocks can be prevented only if

B. at least one of the four necessary conditions cannot hold.

A free-frame list

B. is a set of all frames that are currently unallocated to any process.

A sign of thrashing is

B. the CPU utilization decreases as the degree of multiprogramming is increased.

Reentrant code is easier to share when paging is used, because

B. the code doesn't change during execution.

Suppose a program is operating with execution-time binding and the physical address generated is 300. The relocation register is set to 100. What is the corresponding logical address?

C. 200

The following information is presented for the prog.c -rwxr-xr-- 1 Jim staff 130 May 25 22:13 prog.c Users Jim, Sara and Mike are the members of the group staff

C. Alan can read prog.c

Which of the following does not increase the TLB reach?

C. Decrease the size working set.

_____ is the method of binding instructions and data to memory performed by most general-purpose operating systems.

C. Execution time binding

In a system that uses deadlock detection algorithm,

C. a deadlock is detected sometime after it has occurred but not necessarily immediately.

In a system resource-allocation graph, ____.

C. a directed edge from a process to a resource is called a request edge

Address translation from a logical address to a physical address in IA-32 architecture is comprised of

C. a segmentation unit followed by a paging unit that translate the logical address to its physical address.

In the monitor solution for dining-philosophers problem (Figure 7.7), a philosopher may start eating

C. after exiting the pickup function and before entering the putdown function.

One necessary condition for deadlock is ______, which states that there is a chain of waiting processes whereby P0 is waiting for a resource held by P1, P1 is waiting for a resource held by P2, and Pn is waiting for a resource held by P0.

C. circular wait

File's _______ is a unique tag identifies the file within the file system.

C. identifier

Suppose the size of a process is 10,000 bytes and the relocation register is loaded with value 5000, which of the following memory address this process can access?

C. physical address 10,350

Suppose a program is operating with execution-time binding and the physical address generated is 300. The relocation register is set to 100. What is the corresponding logical address?

C.200

In demand paging,

C.a page is loaded in memory only when it is needed during execution.

Assume a system uses 2-level paging and has a TLB hit ratio of 90%. It requires 15 nanoseconds to access the TLB, and 85 nanoseconds to access main memory. What is the effective memory access time in nanoseconds for this system?

D. 117

An advantage of virtual memory is that

D. All of the above.

The dirty (modify) bit identifies

D. a page that has been modified since it was loaded.

UNIX systems employ ________________________

D. acyclic-graph directory

In a resource allocation graph, when a process releases a resource,

D. an assignment edge is removed.

In the solution provided for readers-writers problem in Section 7.1.2, if a writer is in the critical section, and multiple readers and writers are waiting,

D. either all waiting readers or exactly one writer will be allowed to enter the critical section when the writer in the critical section exits.

The garbage collection is necessary _____

D. in general graph directory structure only

One necessary condition for deadlock is ______, which states that a resource can be released only voluntarily by the process holding the resource.

D. no preemption

A reader-writer lock is useful when

D. there are a significantly large number of reader processes attempting to read in the critical section.

External fragmentation is

D. when there is enough total memory space to satisfy a request but the available spaces are not contiguous.

Which of the following data structures in the banker's algorithm is a vector of length m, where m is the number of resource types?

D.Available

Suppose that there are ten resources available to three processes. At time 0, the following data is collected. The table indicates the process, the maximum number of resources needed by the process, and the number of resources currently owned by each process. Process Maximum Needs Currently Owned P0 10 4 P1 3 1 P2 5 4 At time 1, P1 requests a resource. Which of the following is correct?

D.The request will not be granted, since the state after granting the request will be unsafe.

A call to pthread_cond_signal() (used by POSIX threads, called Pthread) releases the associated mutex lock.

False

Fragmentation does not occur in a paging system.

False

If the page-fault rate is too high, the process may have too many frames.

False

If the sum of all needs for a resource type exceeds the available number of instances of that resource type, the system state is unsafe.

False

In general, virtual memory decreases the degree of multiprogramming in a system.

False

In windows, the working set maximum is the number of pages the process is guaranteed to have in memory.

False

Inverted page tables require each process to have its own page table.

False

Mobile operating systems typically support swapping.

False

Monitors are a theoretical concept and are not practiced in modern programming languages

False

The set of the file's attributes is the same for each operating system.

False

There is a 1:1 correspondence between the number of entries in the TLB and the number of entries in the page table.

False

There is a deadlock in the following resource allocation graph.

False

A page fault must be preceded by a TLB miss.

True

An extension is a part of a file name.

True

Dining philosophers problem is important because it represents a class of problems where multiple processes need to share multiple resources.

True

Hashed page tables are particularly useful for processes with sparse address spaces.

True

If no process is suspended, then the signal() operation of a condition variable has no effect.

True

In swapping with paging technique, individual pages of a process are swapped in or out.

True

The ARMv8 architecture uses up to four-level paging.

True

The banker's algorithm is useful in a system with multiple instances of each resource type.

True

The current best practice to avoid thrashing is to include enough physical memory.

True

The instruction that causes a page fault needs to be re-executed after the fault has been handled.

True

The wait-for graph scheme is not applicable to a resource allocation system with multiple instances of each resource type.

True

Without a mechanism such as an address-space identifier, the TLB must be flushed during a context switch.

True

Dispatcher objects in Windows are used for synchronization outside the kernel.

Ture

There is a deadlock in the following resource allocation graph.

Ture

If memory access time is 100 nanoseconds and average page fault service time 5 milliseconds, the probability of page faults must be less ______ to keep the performance degradation less than 20%.

a. 0.000004

Assume a system has a TLB hit ratio of 90%. It requires 1 nanosecond to access the TLB, and 20 nanoseconds to access the main memory. What is the effective memory access time (EAT) in nanoseconds for this system?

a. 23

Given the logical address 0xF4BCAEF9 (in hexadecimal) with a page size of 4KB (2^12), what are the page number and offset respectively?

a. Page number = 0xF4BCA, page offset = 0xEF9

________ allows the parent and child processes to initially share the same pages, but when either process modifies a page, a copy of the shared page is created.

a. copy-on-write

A(n) ____ page table has one page entry for each real page (or frame) of memory.

a. inverted

The mapping of a logical address to a physical address is done in hardware by the ________.

a. memory-management-unit (MMU)

Which of the following is true about the two versions of readers-writers problem?

a. In the first readers-writers problem, a writer may starve if a continuous series of readers arrive before the earlier readers exit their critical section.

In the solution to the bounded-buffer problem in 7.1.1, what may happen if the order of wait(empty) and wait(mutex) statements are swapped in the producer process?

a. It may result in a deadlock.

In the structure of the producer process shown in Figure 7.1, what would be a possible outcome if wait(empty) is replaced with signal(empty) and signal(full) is replaced with wait(full) in the producer process?

a. Producer will remain blocked after adding an item in the buffer.

Suppose that the operating system uses two internal tables to keep track of open files. Process A has three files open and process B has three files open. Two files are shared between the two processes. How many entries are in the per-process table of process A, the per-process table of process B, and the system-wide tables, respectively?

b. 3, 3, 4

The _____ is an approximation of a program's locality.

b. working set

How many philosophers at most may eat simultaneously in the Dining Philosophers problem with 5 philosophers?

b. 2

In a single processor system running Windows, when the kernel accesses a global resource, it

b. masks all interrupts.

Consider a logical address space of 2,048 pages with a 4-KB page size, how many bits are required in the logical address?

c. 23

Considering a 32-bit logical memory space and page size of 8KB (2^13), what is the total number of pages in logical memory?

c. 2^19 because page number is 19-bit.

Given the following segment table: Segment Limit Base 0 1000 1400 1 400 6300 2 400 4300 3 1100 3200 4 1000 4700 What are the physical addresses for segmentation logical address (1, 43) and (2, 567) respectively?

c. 6343 and Error

_____ is the dynamic contiguous memory allocation algorithm which results in the largest leftover hole in memory.

c. Worst fit

A call to pthread_cond_signal()

c. signals one thread waiting on the condition variable, but does not release the mutex lock.

A system can recover from a deadlock by

d. All of the above.

If we give up hold-and-wait condition to prevent deadlock,

d. All of the above.

To recover from a deadlock using resource preemption,

d. All of the above.

Which of the following statements is true?

d. An unsafe state may lead to a deadlocked state.

Which of the following is NOT true regarding a condition variable, e.g. x?

d. If no process is suspended, then the x.signal() operation still affects the state of x by incrementing its internal value.

What is the purpose of the mutex semaphore in the implementation of the bounded-buffer problem using semaphores?

d.It ensures mutual exclusion.

A ___ type presents a set of programmer-defined operations that are provided mutual exclusion within it.

d.monitor


Kaugnay na mga set ng pag-aaral

Philosophy: AJ Ayer's Expressivism

View Set

ENL 201 Ch. 19 Instructions and procedures.

View Set

Nurs 107 PrepU Chap 48 Management of Patients with Kidney Disorders

View Set

CNA: Test 2: Chapter 6: Infection prevention

View Set