Presentation is loading. Please wait.

Presentation is loading. Please wait.

Operating Systems Clicker Questions Kevin Webb & Cynthia Taylor.

Similar presentations


Presentation on theme: "Operating Systems Clicker Questions Kevin Webb & Cynthia Taylor."— Presentation transcript:

1 Operating Systems Clicker Questions Kevin Webb & Cynthia Taylor

2 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 3

4 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)

5 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

6 Multi-level feedback queues will naturally prioritize… A.Compute-bound processes B.I/O-bound processes C.Long-running processes D.Short processes

7 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)

8 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

9 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

10 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. Producer int item; while (TRUE) { item = Produce (); send (Consumer, &item); } Consumer int item; while (TRUE) { receive (Producer, &item); Consume (item); } /* NO SHARED MEMORY */

11 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! Producer int item; while (TRUE) { item = Produce (); send (Consumer, &item); } Consumer int item; while (TRUE) { receive (Producer, &item); Consume (item); } /* NO SHARED MEMORY */

12 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!

13 Given the following table, for which values of X, Y, and Z, is this a safe state in the Banker's Algorithm? ClaimAllocation Avail- ability Total P1P2P3P1P2P3 R1361Y41Z7 R222X21115 A.X = 3, Y = 1, Z = 1 B.X = 2, Y = 0, Z = 2 C.Both of these are safe states D.Neither of these are safe states

14 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

15 Which form of fragmentation is easiest for the OS to reduce/eliminate? A.Internal fragmentation B.External fragmentation C.Neither

16 Which memory allocation algorithm leaves the smallest fragments (external)? A.first-fit B.worst-fit C.best-fit

17 Where would worst-fit place this memory chunk? 5 MB 7 MB 5 MB 9 MB A. B. C.

18 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 2 MB 1 MB 8 MB 3 MB5 MB 2.5M 1.5M1 MB 2.5M 8 MB 4 MB 2 MB A. B. C.

19 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 B C. Error 20 Segment Table IndexValidBaseBoundPerm r rw wx

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 21

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. 22

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 23

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! 24

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. 25

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. 26

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. 27

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. 28

29 Which of the following is commonly represented by a file? A.A mouse B.A link to another file C.A directory D.More than one of the above E.All of the above 29

30 A file’s “path” determines where it is stored on a disk device. A.True B.False C.Sometimes 30

31 Why do we have an open() call, as opposed to just read() ing or write() ing a file path? A.To check file permissions B.To improve performance C.To lookup the file’s location on disk D.Two of the above E.All of the above 31

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. 32

33 Which allocation strategy has the smallest space overhead? Easiest to resize a file? Answer ChoiceSmallest OverheadEasiest to Resize a File AExtents BNon-contiguousContiguous CNon-contiguousExtents DContiguousNon-contiguous 33

34 Suppose a block is 1 KB (2 10 bytes). How many pointers do we need in our block map to support a maximum file size of 16 GB (2 34 bytes)? A: 2 10 B: 2 16 C: 2 24 D: 2 34 E: Some other number of pointers 34 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. 35


Download ppt "Operating Systems Clicker Questions Kevin Webb & Cynthia Taylor."

Similar presentations


Ads by Google