Operating Systems

Ace your homework & exams now with Quizwiz!

A binary semaphore provides the same functionality as a mutex. Select one: True False

False

A mutex is the same as a binary semaphore. Select one: True False

False

A system in an unsafe state is one in deadlock Select one: True False

False

In general, with N processes sharing N semaphores, the potential for deadlock decreases. Select one: True False

False

Multi-level queues use a single scheduling policy? Select one: True False

False

Signaling with a condition variable is the same as signaling with a semaphore Select one: True False

False

The OS is aware of user-space threads Select one: True False

False

The exec() command will spawn a new process and begin executing at the same point as the parent. Select one: True False

False

The key difference between a binary semaphore and a mutex is that mutex can be owned by two tasks, whereas a binary semaphore can be owned only by one task Select one: True False

False

Threads have less memory consumption, have faster context switches, are more reliable/safe, faster to create and delete, and have faster communication. Select one: True False

False

Match the following terms Deadlock prevention Deadlock Avoidance Deadlock Detection

The correct answer is: Deadlock prevention → Preventing one of the four necessary and sufficient conditions from occurring, Deadlock Avoidance → For every resource request, the system determines if it would be in an unsafe state by granting that request. And thereby, will not grant it., Deadlock Detection → Deadlocks are allowed to occur and system will examine itself periodically to detect detection and correct it.

Match the word with the definition! Race Condition Mutual Exclusion Critical Section The idea of which we want to prevent one process from accessing a resource while the current process is modifying said shared resource. Area in code where processes access shared resources. When two or more threads try to change the shared data at the same time.

The correct answer is: Race Condition → When two or more threads try to change the shared data at the same time., Mutual Exclusion → The idea of which we want to prevent one process from accessing a resource while the current process is modifying said shared resource., Critical Section → Area in code where processes access shared resources.

A Monitor is an object designed to be accessed from multiple threads. The member functions or methods of a monitor object will enforce mutual exclusion. Select one: True False

True

EDF is a type of scheduling policy which selects a process which has the nearest deadline first. Select one: True False

True

Mutual Exclusion is necessary to prevent race conditions. Select one: True False

True

(SELECT ALL THAT APPLY question, no partial credit, all or nothing) Two device files may have... Select one or more: a. Different major numbers and the same minor number. b. The same major number with different minor numbers. c. The same major and the same minor number. d. Different major and different minor numbers.

a, b, and d

Deadlock may occur when (select all that apply) Select one or more: a. A wait() is followed by a wait() instead of a signal() b. The kernel and the user space violate race conditions c. A programmer reverses the order of wait() and signal() d. A mutex is used to synchronize processes

a. A wait() is followed by a wait() instead of a signal() c. A programmer reverses the order of wait() and signal()

Which of the following statements are TRUE about user-level threads and kernel level threads? Select one or more: a. Blocking one user level thread blocks the entire process b. Operating system doesn't recognize user level threads c. Blocking one kernel level thread blocks all related threads d. Context switch time for kernel threads > user level threads

a. Blocking one user level thread blocks the entire process b. Operating system doesn't recognize user level threads d. Context switch time for kernel threads > user level threads

Dining philosophers problem is a classic synchronization problem. What problem are we specifically concerned about? Select one: a. Deadlock b. Shared Memory c. All of the other answers d. Race Condition

a. Deadlock

Which of the following is TRUE regarding the relationship between processes and threads Select one: a. It takes far less time to create a new thread in an existing process than to create a new process b. It takes less time to terminate a process than a thread c. It takes less time to switch between two different processes than to switch between two threads within the same process d. All of the above options are correct

a. It takes far less time to create a new thread in an existing process than to create a new process

The Kernel identifies a driver with a _________. Select one: a. Major number b. Module c. Device file d. Minor number

a. Major number

Select all the necessary and sufficient conditions to cause deadlock Select one or more: a. No Preemption, A resource can be released only voluntarily by the process holding it b. Mutual Exclusion, (a resource is held in a non-shareable mode) c. Circular wait, A process must be waiting for a resource which is being held by another process, which in turn is waiting for the first process to release a resource d. Reentrant - (All tasks must be reentrant to avoid deadlock) e. Hold-and-wait, (a process currently holding at least 1 resource is requesting additional resources held by other processes) f. Critical sections, (Critical sections don't disable interrupts)

a. No Preemption, A resource can be released only voluntarily by the process holding it b. Mutual Exclusion, (a resource is held in a non-shareable mode) c. Circular wait, A process must be waiting for a resource which is being held by another process, which in turn is waiting for the first process to release a resource e. Hold-and-wait, (a process currently holding at least 1 resource is requesting additional resources held by other processes)

In a process control block which of the following is used to retrieve the information on the next instruction to be executed? Select one: a. Program counter b. Process number c. Process state d. CPU registers

a. Program counter

Mark all valid deadlock prevention schemes: Select one or more: a. Request and allocate all the resources required to a process before the process execution b. Never request a resource after releasing any resource c. Release all resources before requesting a new resource d. Number the resources and never request a lower number resource than the allocated ones

a. Request and allocate all the resources required to a process before the process execution c. Release all resources before requesting a new resource d. Number the resources and never request a lower number resource than the allocated ones

A keyboard is a ___ while a printer is a ____. Select one: a. character device, block device b. block device, block device c. block device, character device d. character device, character device

a. character device, block device

What is the difference (advantage) of Multi-level Feedback Queue Scheduling over Multi-level Queue Scheduling? Select one: a. processes are moved to different priority queues depending on CPU usage b. once a process enters a queue it is there for its lifetime c. only processes that finish early are allowed to lower their priority d. processes give the kernel feedback on its performance

a. processes are moved to different priority queues depending on CPU usage

Critical Sections should satisfy the following (or have the following properties)... Select one or more: a. provide Progress - a process who has access to the resource must be actively making progress in its critical section b. have Bounded Waiting (starvation free) - no process can wait forever to access its critical section c. can only be scheduled if it has the resource d. are Mutually Exclusive e. prevents Deadlock f. is only protected by mutexes g. is only protected by semaphores

a. provide Progress - a process who has access to the resource must be actively making progress in its critical section b. have Bounded Waiting (starvation free) - no process can wait forever to access its critical section d. are Mutually Exclusive e. prevents Deadlock

Which of the following is not shared by threads of a process Select one: a. stack b. heap c. code d. data

a. stack

The name associated with the concept where each CPU core is self-scheduling? Select one: a. symmetric multi-processing b. multi-core migration c. asymmetric multi-processing d. CPU affinity e. load balancing

a. symmetric multi-processing

Which of the following would accurately describe the term "turnaround time"? Select one: a. the time from 1st entry of process i into the ready queue to its final exit from the system (exits last run state) b. Sum up the gaps between time slices given to process i c. the time from 1st entry of process i into the ready queue to its 1st scheduling on the CPU (1st run state) d. The time on the CPU required to fully execute process i

a. the time from 1st entry of process i into the ready queue to its final exit from the system (exits last run state)

A counting semaphore is initialized to 15. 8 wait operations and 7 signal operations were completed on this semaphore. What is the resulting value of semaphore? Select one: a. 0 b. 14 c. 15 d. 16

b. 14

Which of the following statements is correct. Select one: a. A harddrive is more likely to be a polling I/O device while a mouse is more likely to be an interrupt-driven I/O device. b. A mouse is more likely to be a polling I/O device while a harddrive is more likely to be an interrupt-driven I/O device. c. Both devices are more suited to be interrupt-driven I/O devices. d. Both devices are more suited to be polling I/O devices.

b. A mouse is more likely to be a polling I/O device while a harddrive is more likely to be an interrupt-driven I/O device.

Scheduling goals include: I. Maximize CPU utilization II. Maximize average or peak response time III. Minimize average or peak waiting time Select one: a. I and II b. I and III c. II and III d. None of the above

b. I and III

Which of the following is a disadvantage of IPC message passing? Select one: a. It doesnt require synchronization b. It is slow c. It is handled in the kernel d. None of these reasons

b. It is slow

The O(1) scheduler is better than the O(n) scheduler because Select one: a. It iterates over processes b. It iterates over priorities c. it maintains a hash table with pid keys to see if a process has already ran, instead of an array d. It utilizes multiple queues in order to handle various process deadlines

b. It iterates over priorities

Which of the following is considered as a mechanism of Inter-Process communication? Select one or more: a. None of these methods b. Pipes c. Deadlock detection d. Shared memory e. Sockets

b. Pipes d. Shared memory

The following can result in a race condition (select all that apply): Select one or more: a. Two processes reading from a shared buffer b. Two processes writing to a shared buffer c. Two processes requesting to grab the same lock d. Two threads modifying a global variable in their heap. e. A child process that was spawned from a parent process modifying a global variable. f. A signal handler that modifies a global variable, i.e. reentrancy.

b. Two processes writing to a shared buffer d. Two threads modifying a global variable in their heap. f. A signal handler that modifies a global variable, i.e. reentrancy.

The following can result in a race condition (select all that apply): Select one or more: a. Two processes reading from a shared buffer b. Two processes writing to a shared buffer c. Two processes requesting to grab the same lock d. Two threads modifying a global variable in their heap. e. A child process that was spawned from a parent process modifying a global variable. f. A signal handler that modifies a global variable, i.e. reentrancy.

b. Two processes writing to a shared buffer d. Two threads modifying a global variable in their heap. f. A signal handler that modifies a global variable, i.e. reentrancy.

Why does the CFS (completely fair scheduler) use vruntime (virtual run time) instead of actual run time? Select one: a. to lower priority of high priority processes b. to favor processes with higher priority or use less CPU time c. to allow new processes to be scheduled first for long timeslices d. to support context switching of processes quickly

b. to favor processes with higher priority or use less CPU time

Which of the following conditions can you guarantee from the three processes below? (Assume s1 and s2 are semaphores initialized to 0) P0: wait(&s1); x1; x2; wait(&s2); x3; P1: wait(&s1); y1; signal(&s2); y2; P2: s1; signal(&s1); z1; signal(&s1); Select one or more: a. z1 executes before x1 b. y1 executes before x3 c. x1 executes before z1 d. x1 executes before y1

b. y1 executes before x3

Time slices are typically chosen to be large enough so that only __% of CPU time is spent context switching. Select one: a. 25% b. 1% c. 10% d. 3%

c. 10%

Which of the following is an advantage of LKMs. Select one: a. LKMs do not require kernel mode access. b. If the LKM has an error, it requires a total recompile of the kernel. c. Functionality may be added or removed from the kernel without a reboot. d. Unused LKMs are a waste of memory since they are loaded at launch.

c. Functionality may be added or removed from the kernel without a reboot.

Which of the following reduces the average wait time for all the processes? Select one: a. FCFS - First Come First Serve b. SJF - shortest job first c. RR - round robin d. None of these

c. RR - round robin

Which of the following would accurately describe the term "response time"? Select one: a. The time on the CPU required to fully execute a process b. Sum up the gaps between time slices given to a process c. The time from first entry of a process into ready queue until its first CPU usage d. The time from first entry of a process into ready queue until the end of its last CPU usage

c. The time from first entry of a process into ready queue until its first CPU usage

Which of the following is NOT an advantage of using LKMs? Select one: a. When added to the OS, the kernel does not need to be rebuilt b. at build time the OS does not need to know about every possible device driver c. the device driver runs in user space d. editing and building are performed in user space

c. the device driver runs in user space

Using the Bankers algorithm determine the state of the system If P1 is allocated one more resource of type A. Resource Allocations Alloc A B C Max A B C Need A B C P1 0 2 3 7 6 4 7 4 1 P2 2 1 2 7 1 2 5 0 0 P3 0 1 0 3 3 2 3 2 2 Avail A B C 5 2 1 Select one: a. depends on which process is running b. Initially the system is in a safe state, but will deadlock c. the system is in an unsafe state d. the system is in a safe state e. the system is in a deadlock state

c. the system is in an unsafe state

Is the function f() thread-safe? Is f() reentrant()? Lock mutex; int g= 0; int f(int i){ int x = g; x = x - 2; x = i; x = x*x; return x; } Select one: a. not thread-safe, re-entrant b. not thread-safe, not re-entrant c. thread-safe, thread-reentrant d. thread-safe, not re-entrant

c. thread-safe, thread-reentrant

Part of the program where a shared resource is accessed is

critical section

A system has 3 programs and each program requires 3 units of a resource R1 for its operation. Select the minimum number of R1 units required such that the deadlock will never arise? Select one: a. 6 b. 8 c. 9 d. 7

d. 7

A process manager provides for: Select one: a. creation\deletion of processes b. synchronization of processes c. monitoring and scheduling of processes d. All of the above

d. All of the above

To start an I/O operation, device driver loads the appropriate registers within the _________. Select one: a. Secondary storage b. Main Memory c. CPU d. Device controller

d. Device controller

Who initiates a DMA transfer? Select one: a. CPU b. Operating System c. Process being executed d. I/O devices

d. I/O devices

Which of the following is False? Select one: a. DMA sends an interrupt to the CPU when it is finished b. DMA is made possible through specialized hardware c. The purpose of DMA is to free up the CPU during expensive I/O transfers d. If DMA hardware is present for I/O transfers, it will always invoke itself to do any I/O transfer

d. If DMA hardware is present for I/O transfers, it will always invoke itself to do any I/O transfer

Use the following information to determine which of the answers is True. At time 0 the current state of the system looks as follows: There are 3 resource types - A, B, C and 4 processes P0 through P3 Max A B C P0 7 5 4 P1 7 1 2 P2 3 3 2 P3 1 0 1 Allocated A B C P0 0 2 3 P1 2 1 2 P2 0 1 0 P3 0 0 1 Available A B C 5 2 1 At time 1, P0 requests 1 resource of A. Using bankers algorithm, a method for deadlock avoidance, determine what would happen if the system decided to grant this request. Pick the statement that is True below. Select one: a. Initially the system is in an unsafe state, and granting this request would deadlock the system. b. Initially the system is in a safe state, and granting this request would maintain the safe state. c. Initially the system is in an unsafe state, and granting this request would return the system to a safe state. d. Initially the system is in a safe state, and granting this request would move the system into an unsafe state. e. Initially the system is in an unsafe state, and granting this request would maintain the unsafe state. f. Initially the system is in a safe state, and granting this request would move the system into a deadlocked state.

d. Initially the system is in a safe state, and granting this request would move the system into an unsafe state.

Which of the following would accurately describe the term "wait time"? Select one: a. The time from first entry of a process into ready queue until to its first CPU usage b. The time on the CPU required to fully execute a process c. The time from first entry of a process into ready queue until the end of its last CPU usage d. Sum up the gaps between time slices given to a process

d. Sum up the gaps between time slices given to a process

Concurrency is: Select one: a. solved through synchronization b. solved by using IPC c. inter-process method of communication d. interleaving of processes to simulate parallelism

d. interleaving of processes to simulate parallelism

Using the Bankers algorithm determine the current state of the system. Resource Allocations Alloc A B C Max A B C Need A B C P1 0 2 3 7 6 4 7 4 1 P2 2 1 2 7 1 2 5 0 0 P3 0 1 0 3 3 2 3 2 2 Avail A B C 5 2 1 Select one: a. depends on which process is running b. the system is in a deadlock state c. Initially the system is in a safe state, but will deadlock d. the system is in a safe state e. the system is in an unsafe state

d. the system is in a safe state

With the following code, will C1 (critical section of task 1) always execute followed by C2 executing? /* variables shared between 2 threads*/ Lock mutex; Condition CV; int state = 0; Thread T1: C1; //code C1 lock(mutex); state = 1; unlock(mutex); signal(CV); Thread T2: lock(mutex); while(!state) { unlock(mutex); wait(CV); lock(mutex); } unlock(mutex); C2;

no


Related study sets

Reino Unido: El movimiento prerrafaelita: Dante Gabriel Rossetti

View Set

Life insurance exam study part 1

View Set

Chapter 16: Strategically Managing the HRM Function

View Set

Chapter 1 Introductory Marketing

View Set

Managerial Economics Exam #1 Study

View Set

CNA chapter 11-15 study guide #2

View Set

1.1-Overview of Microcomputer Operating Systems

View Set

Intro to Physical Geography Lab 3: Topographic Maps & Relief

View Set

MEDICAL TERMINOLOGY IDENTIFICATION

View Set