4100 Quizzes II (4-6)

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

cache

a copy of a computation or data that can be accessed more quickly than the original

directory

a file that contains mappings of file names to file numbers

File size = Number of Direct Block * Block Size

a) To find how large in KB can a file is without needing to use the indirect block:-

# ind block entries * # ind block entries * block size

e) To find how many GB of data a double indirect block point to:-

B (Thread A: lock1.acquire() Thread B: lock2.acquire() Thread B: lock1.acquire() Thread A: lock2.acquire() )

Q4 In a situation with two threads (A and B) and two locks (1 and 2), which of the following orderings leads to a deadlock? A) Thread A: lock1.acquire() Thread A: lock2.acquire() Thread B: lock1.acquire() Thread B: lock2.acquire() B) Thread A: lock1.acquire() Thread B: lock2.acquire() Thread B: lock1.acquire() Thread A: lock2.acquire() C) Thread A: lock1.acquire() Thread B: lock1.acquire() Thread A: lock2.acquire() Thread B: lock2.acquire() D) Thread B: lock2.acquire() Thread B: lock1.acquire() Thread A: lock1.acquire() Thread A: lock2.acquire()

C (There is at least one set of resource requests that leads to deadlock regardless of the ordering.)

Q4 In the Banker's Algorithm, what indicates an unsafe state? A) For any possible set of resource requests, there is at least one ordering that does not lead to deadlock. B) For any possible set of resource requests, there is at least one ordering that leads to deadlock. C) There is at least one set of resource requests that leads to deadlock regardless of the ordering. D) There is at least one set of resource requests that does not lead to deadlock regardless of the ordering.

D (Every philosopher picks up their lower-numbered fork first.)

Q4 In the Dining Philosophers problem, which of the following strategies eliminates cycles? A) Every philosopher picks up their left fork first. B) Every philosopher picks up their right fork first. C) Every philosopher puts down their left fork if their right is unavailable. D) Every philosopher picks up their lower-numbered fork first.

B (Frequent thread switching increases scheduling overhead.)

Q4 In the Round Robin policy, what happens if the time quantum is too short? A) Longer-running tasks may starve. B) Frequent thread switching increases scheduling overhead. C) The scheduler behaves as if it is using a FIFO policy. D) I/O-bound jobs suffer from poor response time.

A (When a high priority task must wait for a lower priority task to complete its work.)

Q4 What is priority inversion? A) When a high priority task must wait for a lower priority task to complete its work. B) When a low priority task must wait for a high priority task to complete its work. C) When a task is assigned a lower priority. D) When a task is assigned a higher priority.

C (It never leaves the processor idle when tasks are available.)

Q4 What makes a scheduler work-conserving? A) It favors compute-bound tasks over I/O-bound tasks. B) It favors I/O-bound tasks over compute-bound tasks. C) It never leaves the processor idle when tasks are available. D) It has the ability to preempt the processor and give it to another task.

C (A group of threads is waiting for an action that only one of the threads in the group can perform.)

Q4 Which of the following best describes a deadlock? A) Multiple threads modify data, leaving it in an inconsistent state. B) A thread is made to wait until another thread performs an action. C) A group of threads is waiting for an action that only one of the threads in the group can perform. D) Threads take turns running on a processor until all threads have completed.

A (Requests are granted if they keep the system in a safe state and delayed if they would put the system in an unsafe state.)

Q4 Which of the following best describes how the Banker's Algorithm avoids deadlock? A) Requests are granted if they keep the system in a safe state and delayed if they would put the system in an unsafe state. B) Requests are granted if they keep the system in a safe state and delayed if they would put the system in an deadlocked state. C) Requests are always granted. D) Requests are never granted.

A (Each thread is running on a different processor.)

Q4 Which of the following is not a necessary condition for deadlock? A) Each thread is running on a different processor. B) A thread can hold one resource while waiting for another resource. C) Once a thread holds a resource, it's ownership can not be revoked. D) A finite number of threads can simultaneously access a resource.

A (Count the number of waiting threads.)

Q4 Which of the following is not an effective way to detect a deadlock? A) Count the number of waiting threads. B) Determine if an operation is taking an unusually long amount of time. C) Construct a graph of threads and resources and determine if a cycle exists. D) Use a version of the Banker's Algorithm to determine if pending requests can not be satisfied.

D (Fairness)

Q4 Which of the following refers to equal resource allocation for each task? A) Response time. B) Predictability C) Throughput D) Fairness

A (Response time)

Q4 Which of the following refers to the user-perceived time to perform a task? A) Response time. B) Predictability C) Throughput D) Fairness

C (Earliest Deadline First (EDF). )

Q4 Which of the following scheduling policies is ideal for systems with real-time constraints? A) First In First Out (FIFO). B) Shortest Job First (SJF). C) Earliest Deadline First (EDF). D) Round Robin.

C (Scheduler activations.)

Q4 Which of the following uses upcalls to notify an application that a processor has become available? A) Oblivious scheduling. B) Gang scheduling. C) Scheduler activations. D) Energy-aware scheduling.

A (The task moves down to a lower-priority level.)

Q5 What happens if a task uses up its entire time quantum on a system using a multi-level feedback queue (MFQ)? A) The task moves down to a lower-priority level. B) The task moves up to a higher priority level. C) The task stays at the same priority level. D) The task is allowed to continue running until it has completed.

C (A page fault.)

Q5 What happens when an invalid virtual address is accessed? A) A cache hit. B) A TLB shootdown. C) A page fault. D) The process making the access is terminated.

A (Small, fast, and expensive memory vs. large, slow, and cheap memory.)

Q5 What is the primary tradeoff that determines the memory hierarchy on a computer system? A) Small, fast, and expensive memory vs. large, slow, and cheap memory. B) Small, fast, and cheap memory vs. Large, slow, expensive memory. C) Small, slow, and expensive memory vs. large, fast, and cheap memory. D) Small, slow, and cheap memory vs. Large, fast, and expensive memory.

D (A backup on disk of every memory segment of every running process.)

Q5 What is virtual memory? A) A file that is accessible directly in a program's virtual address space. B) A low-latency device that stores recently accessed data from a higher-latency device. C) A cache in memory for blocks of data stored on disk. D) A backup on disk of every memory segment of every running process.

C (A set associative cache.)

Q5 Which of the following approaches breaks a cache into buckets, each of which contains a fixed number of entries? A) A fully associative cache. B) A direct mapped cache. C) A set associative cache. D) None of the above.

B (The virtual address space of a process is broken up into fixed-sized chunks that may be stored anywhere in physical memory.)

Q5 Which of the following best describes paging? A) The virtual address space of a process is stored in a contiguous range of physical addresses. B) The virtual address space of a process is broken up into fixed-sized chunks that may be stored anywhere in physical memory. C) The virtual address space of a process is broken up into variable-sized chunks that may be stored anywhere in physical memory. D) The virtual address space of a process is broken up into individual bytes that may be stored anywhere in memory.

C (The virtual address space of a process is broken up into variable-sized chunks that may be stored anywhere in physical memory.)

Q5 Which of the following best describes segmentation? A) The virtual address space of a process is stored in a contiguous range of physical addresses. B) The virtual address space of a process is broken up into fixed-sized chunks that may be stored anywhere in physical memory. C) The virtual address space of a process is broken up into variable-sized chunks that may be stored anywhere in physical memory. D) The virtual address space of a process is broken up into individual bytes that may be stored anywhere in memory.

A (A virtual address used by a program is translated to a physical address in memory.)

Q5 Which of the following best describes the process of address translation? A virtual address used by a program is translated to a physical address in memory. A physical address used by a program is translated to a virtual address in memory. A virtual address in memory is translated to a physical address used by a program. A physical address in memory is translated to a virtual address used by a program.

B (Protection of a process's memory from other processes.)

Q5 Which of the following features is provided by a base and bound approach to address translation? A) Fine-grained protection of memory within a process. B) Protection of a process's memory from other processes. C) Memory shared between multiple processes. D) Dynamically expandable memory regions.

C (Copies of all of the original data in the cache.)

Q5 Which of the following is not a requirement of a cache? A) Efficient access to the cached copy of data. B) A replacement policy to determine which old entry to evict when a new entry is brought in. C) Copies of all of the original data in the cache. D) Coherence of the cache when cached copies are no longer valid.

D (Write-back.)

Q5 Which of the following refers to a cache where updates are sent to memory when the cache evicts a block that has been written to? A) Prefetching. B) On-demand. C) Write-through. D) Write-back.

B (Spatial locality.)

Q5 Which of the following refers to programs that tend to reference data near other recently accessed data? A) Temporal locality. B) Spatial locality. C) Virtual locality. D) Physical locality.

A (The index of the file's first file allocation table entry.)

Q6 In the FAT-32 file system, what does a file number correspond to? A) The index of the file's first file allocation table entry. B) The index into the file system's inode table. C) The index into the file system's master file table. D) The index into system-wide file descriptor table.

D (Best fit.)

Q6 In the NTFS file system, which of the following allocation algorithms is used to find free space on disk to allocate to a new extent? A) First fit. B) Next fit. C) Worst fit. D) Best fit.

B (A bitmap.)

Q6 In the UNIX Fast File System (FFS), which of the following is used to keep track of the free blocks on the system? A) Sparse files. B) A bitmap. C) Block groups. D) Reserved space.

C (Transfer.)

Q6 On average, which of the following disk operations has the lowest latency? A) Seek. B) Rotate. C) Transfer. D) They all take roughly the same amount of time.

B (A hard link is a directory entry pointing to a file while a soft link contains the path name of the file that it points to.)

Q6 What is the difference between a hard link and a soft link? A) A hard link can only point to a directory while a soft link can only point to a regular file. B) A hard link is a directory entry pointing to a file while a soft link contains the path name of the file that it points to. C) If a hard link is removed, the link count doesn't change. If a soft link is removed the link count decreases by one. D) If the location of a file changes, a hard link becomes invalid while a soft link still points to the file.

A (An absolute path starts at the root directory while a relative path starts at the current directory.)

Q6 What is the difference between an absolute path and a relative path? A) An absolute path starts at the root directory while a relative path starts at the current directory. B) An absolute path starts at the current directory while a relative path starts at the root directory. C) An absolute path is used for a directory name while a relative path is used for a file name. D) An absolute path is used for a file name while a relative path is used for a directory name.

B (Memory mapped I/O.)

Q6 Which of the following allows an OS to interact with I/O devices using memory accesses? A) A device driver. B) Memory mapped I/O. C) Direct memory access. D) A block cache.

D (Each file corresponds to one or more master file table entries that keep track of variable-sized contiguous extents on disk.)

Q6 Which of the following best describes how NTFS keeps track of files? A) Each file corresponds to contiguous sequence of disk blocks. B) Each file corresponds to a linked list of file allocation table entries. C) Each file corresponds to an inode that is used to keep track of fixed-sized blocks of the file's data. D) Each file corresponds to one or more master file table entries that keep track of variable-sized contiguous extents on disk.

B (SSTF.)

Q6 Which of the following disk scheduling algorithms always services the closest request first? A) FIFO. B) SSTF. C) SCAN. D) CSCAN.

A (Erasing the erasure block.)

Q6 Which of the following flash storage operations has the highest latency? A) Erasing the erasure block. B) Reading a page. C) Writing a page. D) The latency is the same for all operations.

C (All data should be stored on low-latency volatile storage like DRAM.)

Q6 Which of the following is not a requirement of an effective data storage system? A) Access to files should be shared, but restricted to the users authorized to access them. B) Data should be given user-readable names to make organization easier. C) All data should be stored on low-latency volatile storage like DRAM. D) Data must survive power losses and system crashes.

B (An index structure.)

Q6 Which of the following is used to locate the blocks of a file on disk? A) A directory. B) An index structure. C) A free space map. D) Locality heuristics.

A (A directory.)

Q6 Which of the following maps file names to file numbers? A) A directory. B) An inode. C) A file allocation table. D) An inode table.

B (..)

Q6 Which of the following refers to the parent of the current directory? A) . B) .. C) / D) ~

D (fsync)

Q6 Which of the following system calls flushes all buffered dirty pages of a file to disk? A) seek B) mmap C) munmap D) fsync

B ()

Q6 Which of the following system calls is used to remove a directory entry? A) link B) unlink C) mkdir D) rmdir

Block Numbers = Block Size / Block Number Size

B) No.of blocks can be stored in a single indirect block:-

A (open)

Q6 Which of the following system calls returns a file descriptor that can be used to access a file? A) open B) close C) read D) write

C (Prefetching)

Q6 Which of the following techniques involves reading blocks of data from disk into memory before they are requested? A) Buffering. B) Caching. C) Prefetching. D) Direct memory access.

D (The contents of a file.)

Q6 Which of the following would not be considered metadata? A) The size of a file. B) The owner of a file. C) The permissions of a file. D) The contents of a file.

C (The head.)

Q6 Which part of a magnetic disk reads and writes data? A) The arm. B) The leg. C) The head. D) The body.

B (It prevents deadlock, but starvation is still possible.)

Q4 Consider the following solution to the Dining Philosophers problem: 1) If the left fork is available, pick it up. Otherwise wait until it is available. 2) If the right fork is available, pick it up. Otherwise put down the left fork and go back to Step 1. 3) Eat 4) Put down the forks. What is the problem with this solution? A) It does not prevent deadlock. B) It prevents deadlock, but starvation is still possible. C) It prevents deadlock, but only one philosopher may be able to eat at a time. D) Two neighboring philosophers may be allowed to eat at the same time.

D (One or more of a thread's transactions is rolled back, so the other threads can make progress.)

Q4 How can transactions be used to recover from deadlock. A) One of the deadlocked threads is terminated, allowing the remaining threads to continue. B) Threads continue to run without the resource that caused the deadlock. C) One or more of a thread's transactions is committed so that the thread performing the transaction can continue. D) One or more of a thread's transactions is rolled back, so the other threads can make progress.

D (SJF minimizes average response time.)

What is the main advantage of a Shortest Job First (SJF) scheduling policy over a First In First Out (FIFO) scheduling policy? A) SJF is simpler to implement than FIFO. B) SJF prevents starvation. C) SJF is more fair than FIFO. D) SJF minimizes average response time.

pid= fork(); if(fpid != 0) wait(NULL); else { execvp(pid, argv); exit(1); }

code for midterm fork child exec command thing

Block Numbers = Block Size / Block Number Size

b) No.of blocks can be stored in a single indirect block:-

ind block number * blocksize

c) To fine how many MB of data an indirect block point to:-

address translation

conversion of virtual address used by a program to a physical address in memory

Number of Direct Block * Block Size + Number of Block entries in Indirect Block *Block size

d) To find how large in KB can a file is without needing to use the double indirect block:-

memory mapped file

demand paging to provide direct access to a file in memory.

virtual address - offset

how many bits are left in virtual for the page number?

log2(pagesize)

how many bits in virtual for offset so every byte has unique address?

2 to the page number bits

how many different page number does an address space in this system support?

free space map

keeps track of which disk blocks are available to be allocated to files.

file system

must implement its API using the interface provided by device drivers.

magnetic disk

non-volatile storage device that stores data on the magnetized surface of rotating disks

deadlock

occurs when every thread in a set of threads is waiting for an action that can only be performed by another thread in the group.

concurrency

refers to multiple activities that can happen at the same time


Ensembles d'études connexes

Cardiac Arrest in Pregnancy In-Hospital ACLS Algorithm

View Set

Excel, Linking and Embedding (Lesson 6-WWS)

View Set

ATI Med Surg Nursing: Parkinson's Disease

View Set

MGT491 - Chapter 10 Practice Quiz

View Set

Simple, Compound, Complex, Fragment, and Run-Ons - Definitions and Examples

View Set

Ch 51 Assessment and Management of Patients with Diabetes Practice Qs

View Set

Texas Real Estate Finance - Chp 4 - The Secondary Mortgage Market

View Set

CLIPP Case 28 (18-month-old with developmental delay) and Case 29 (Infant with hypotonia)

View Set