Operating Systems Clicker Questions

Preview:

DESCRIPTION

Operating Systems Clicker Questions. Kevin Webb & Cynthia Taylor. The operating system kernel…. Executes as a process Is always executing, in support of other processes Should execute as little as possible More than one of the above. Why shouldn’t processes control context switching?. - PowerPoint PPT Presentation

Citation preview

Operating SystemsClicker Questions

Kevin Webb & Cynthia Taylor

The operating system kernel…

A. Executes as a process

B. Is always executing, in support of other processes

C. Should execute as little as possible

D. More than one of the above

3

Why shouldn’t processes control context switching?

A. It would cause too much overhead

B. They could refuse to give up the CPU

C. They don’t have enough information about other processes

Which CPU scheduling policy is the best?

A. Processes keep CPU until done (maximize throughput)

B. Processes use a fraction of CPU and pass it on (ensure fairness)

C. Processes receive CPU in proportion to their priority or what they pay (prioritize importance)

D. Other (explain)

Which is true of round-robin schedules relative to first-come first-served.

A. Round-robin requires knowledge of process run times.

B. Round-robin schedules have lower average turnaround times.

C. Round-robin schedules have higher average turnaround times.

D. Round-robin has higher overhead.

E. More than one of these

Multi-level feedback queues will naturally prioritize…

A. Compute-bound processes

B. I/O-bound processes

C. Long-running processes

D. Short processes

Which component of a process might we replicate to take advantage of multiple CPUs?

A. The address space (memory)

B. OS resources (open files, etc.)

C. Execution state (PC, SP, registers, etc.)

D. More than one of these

E. Some other component(s)

If you call thread_create() on a modern OS (Linux/Mac/Windows), which type of thread would you expect to receive? (Why? Which would you pick?)

A. Kernel thread

B. User thread

C. Some other sort of thread

For processes (or threads) to communicate, we must have:

A. a data transfer mechanism

B. a synchronization mechanism

C. either synchronization or data transfer

D. both synchronization and data transfer

Suppose we’re using message passing, will this code operate correctly?

A. No, there is a race condition.B. No, we need to protect item.C. Yes, this code is correct.

Producerint item;

while (TRUE) {item = Produce ();send (Consumer,

&item);}

Consumerint item;

while (TRUE) {receive (Producer,

&item);Consume (item);

}

/* NO SHARED MEMORY */

This code is correct and relatively simple. Why don’t we always just use message passing (vs semaphores)?

A. Message passing copies more data.B. Message passing only works across a network.C. Message passing is a security risk.D. We usually do use message passing!

Producerint item;

while (TRUE) {item = Produce ();send (Consumer,

&item);}

Consumerint item;

while (TRUE) {receive (Producer,

&item);Consume (item);

}

/* NO SHARED MEMORY */

Which of these conditions is easiest to give up to prevent deadlocks?

A. Mutual exclusion (make everything sharable)

B. Hold and wait (must get all resources at once)

C. No preemption (resources can be taken away)

D. Circular wait (total order on resource requests)

E. I’m not willing to give up any of these!

Given the following table, for which values of X, Y, and Z, is this a safe state in the Banker's Algorithm?

Claim AllocationAvail-ability Total

P1 P2 P3 P1 P2 P3

R1 3 6 1 Y 4 1 Z 7

R2 2 2 X 2 1 1 1 5

A. X = 3, Y = 1, Z = 1B. X = 2, Y = 0, Z = 2C. Both of these are safe statesD. Neither of these are safe states

Which type of deadlock-handling scheme would you expect to see in a modern OS (Linux/Windows/OS X) ?

A. Deadlock prevention

B. Deadlock avoidance

C. Deadlock detection/recovery

D. Something else

Which form of fragmentation is easiest for the OS to reduce/eliminate?

A. Internal fragmentation

B. External fragmentation

C. Neither

Which memory allocation algorithm leaves the smallest fragments (external)?

A. first-fit

B. worst-fit

C. best-fit

Where would worst-fit place this memory chunk?

5 MB

7 MB

5 MB

9 MB

A.

B.

C.

How would the buddy system allocate the following set of requests? Assume 8 MB free initially.

Alloc 3 MB, Alloc 1.5 MB, Alloc 1 MB

8 MB

4 MB 4 MB

2 MB 2 MB

1 MB 1 MB

8 MB

3 MB 5 MB

2.5M

1.5M 1 MB

2.5M

8 MB

4 MB 4 MB

2 MB 2 MB

A.

B.

C.

Given what we currently know about memory, what must we do during a context switch?

A. Allocate memory to the switching process

B. Load the base and bound registers

C. Convert logical to physical memory addresses

20

Segment Address Translation

• Physical address of ?

A. 8000 B. 9200 C. Error

Segment Table

Index Valid Base Bound Perm

1 0 120 600 r

2 1 8000 1000 rw

3 1 9000 512 wx

2 1200

21

5 bit segment address, 32 bit logical address, 1 GB Physical memory.How many entries will we have in our segment table?

A. 32: The logical address size is 32 bits

B. 32: The segment address is five bits

C. 30: We need to address 1 GB of physical memory

22

Which of these would be true about a multi-level page table, compared to a single-level page table?

A. Multi-level usually uses less memory.

B. Multi-level usually has faster lookup times.

C. Both cause the same amount of fragmentation.

D. More than one of the above is true.

23

A page fault occurs. What must we do in response?

A. Find the faulting page on disk.

B. Evict a page from memory and write it to disk.

C. Bring in the faulting page and retry the operation.

D. Two of the above

E. All of the above

24

Handing faults from disk seems very expensive. How can we get away with this in practice?

A. We have lots of memory, and it isn’t usually full.

B. We use special hardware to speed things up.

C. We tend to use the same pages over and over.

D. This is too expensive to do in practice!

25

Your closet is full, but you just got a new shirt. How do you make room for it in your closet?

A. Throw out another shirt at random.

B. Throw out your newest shirt.

C. Throw out your oldest shirt.

D. Throw out a shirt you haven’t worn for a while.

E. I govern my closet with some other shirt replacement policy.

26

Which is true of the Clock algorithm?

A. Clock will always have fewer faults than FIFO.

B. Clock will always have the same fault count as LRU.

C. Clock will always have more faults than Optimal.

D. More than one of the above.

E. None of the above.

27

Why are disks slow?

A. We have to move a disk head.

B. We have to spin the disk platters.

C. Disk data is farther away from the CPU/Mem.

D. More than one of these.

E. All of these.

28

Regarding file types…

A. The OS distinguishes between file types.

B. The user distinguishes between file types.

C. Both the OS and users distinguish between file types.

D. Nobody distinguishes between file types, files are all just files.

29

Which of the following is commonly represented by a file?

A. A mouseB. A link to another fileC. A directoryD. More than one of the aboveE. All of the above

30

A file’s “path” determines where it is stored on a disk device.

A. True

B. False

C. Sometimes

31

Why do we have an open() call, as opposed to just read()ing orwrite()ing a file path?

A. To check file permissionsB. To improve performanceC. To lookup the file’s location on diskD. Two of the aboveE. All of the above

32

For a memory mapped file…

A. The entire file must be in memory.

B. Pages are brought in as accessed.

C. All pages will eventually be written back to disk.

D. More than one of the above.

33

Which allocation strategy has the smallest space overhead? Easiest to resize a file?

Answer Choice Smallest Overhead Easiest to Resize a File

A Extents Extents

B Non-contiguous Contiguous

C Non-contiguous Extents

D Contiguous Non-contiguous

34

Suppose a block is 1 KB (210 bytes). How many pointers do we need in our block map to support a maximum file size of 16 GB (234 bytes)?

A: 210 B: 216 C: 224 D: 234

E: Some other number of pointers

Block size: 1 KB

…?

35

What about writes? What if we lose power, and our modified data is only in memory? When should we write it to the disk to maintain reliability?

A. Write blocks to disk immediately, to ensure safety.B. Write blocks when we evict them from the cache,

to maximize performance.C. Write blocks when the user explicitly tells us to,

since the user/application knows best.D. Write blocks to disk at some other time.