Operating Systems Clicker Questions

35
Operating Systems Clicker Questions Kevin Webb & Cynthia Taylor

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

Transcript of Operating Systems Clicker Questions

Page 1: Operating Systems Clicker Questions

Operating SystemsClicker Questions

Kevin Webb & Cynthia Taylor

Page 2: Operating Systems Clicker Questions

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

Page 3: Operating Systems Clicker Questions

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

Page 4: Operating Systems Clicker Questions

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)

Page 5: Operating Systems Clicker Questions

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

Page 6: Operating Systems Clicker Questions

Multi-level feedback queues will naturally prioritize…

A. Compute-bound processes

B. I/O-bound processes

C. Long-running processes

D. Short processes

Page 7: Operating Systems Clicker Questions

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)

Page 8: Operating Systems Clicker Questions

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

Page 9: Operating Systems Clicker Questions

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

Page 10: Operating Systems Clicker Questions

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 */

Page 11: Operating Systems Clicker Questions

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 */

Page 12: Operating Systems Clicker Questions

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!

Page 13: Operating Systems Clicker Questions

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

Page 14: Operating Systems Clicker Questions

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

Page 15: Operating Systems Clicker Questions

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

A. Internal fragmentation

B. External fragmentation

C. Neither

Page 16: Operating Systems Clicker Questions

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

A. first-fit

B. worst-fit

C. best-fit

Page 17: Operating Systems Clicker Questions

Where would worst-fit place this memory chunk?

5 MB

7 MB

5 MB

9 MB

A.

B.

C.

Page 18: Operating Systems Clicker Questions

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.

Page 19: Operating Systems Clicker Questions

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

Page 20: Operating Systems Clicker Questions

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

Page 21: Operating Systems Clicker Questions

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

Page 22: Operating Systems Clicker Questions

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.

Page 23: Operating Systems Clicker Questions

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

Page 24: Operating Systems Clicker Questions

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!

Page 25: Operating Systems Clicker Questions

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.

Page 26: Operating Systems Clicker Questions

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.

Page 27: Operating Systems Clicker Questions

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.

Page 28: Operating Systems Clicker Questions

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.

Page 29: Operating Systems Clicker Questions

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

Page 30: Operating Systems Clicker Questions

30

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

A. True

B. False

C. Sometimes

Page 31: Operating Systems Clicker Questions

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

Page 32: Operating Systems Clicker Questions

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.

Page 33: Operating Systems Clicker Questions

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

Page 34: Operating Systems Clicker Questions

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

…?

Page 35: Operating Systems Clicker Questions

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.