oldy old
Which of the following is NOT true about the dining-philosophers problem? A) A deadlock-free solution is guaranteed to be starvation-free B) Allowing at most four philosophers to sit simultaneously prevents deadlock C) Dining philosophers problem is important because it represents a class of problems where multiple processes need to share multiple resources. D) Allowing at most four philosophers to sit simultaneously can limit the use of the resources
A) A deadlock-free solution is guaranteed to be starvation-free **
If the time quantum gets too large, RR scheduling degenerates to _? A) FCFS B) Multilevel queue C) SJF D) Shortest-remaining-time-first
A) FCFS
Which of the following is NOT true regarding semaphore's queue-based implementation? A) It suffers from the busy waiting problem B) When a process executes the wait() operation and finds that the semaphore value is not positive, it will suspend itself C) A process that is suspended, waiting on the semaphore, should be restarted when some other process executes a signal() operation. D) Semaphore has a waiting queue associated with the semaphore
A) It suffers from the busy waiting problem ***
Which of the following is true: A) Turnaround time measures the amount of time it takes to execute a process B) All of the rest C) Turnaround time is the sum of the periods that a process is spent waiting to get into memory, waiting in the ready queue, executing on the CPU, and doing I/O D) Response time is a measure of the time that elapses between a request and the first response produced
B) All of the rest.
Which of the following is correct about the reader/writer problem? A) At any given time, at most one reader can do reading. B) At any given time, at most one writer can do writing. C) If a writer is writing, one reader can still do reading but no more readers than that. D) None of the rest.
B) At any given time, at most one writer can do writing.
Which of the following selects from among the processe that are in the ready queue to execute and allocate the CPU to one of them? A) semaphore B) CPU scheduler C) swapping D) context switch
B) CPU scheduler
Which of the following scheduling algorithm may suffer from convoy effect? A) RR B) FCFS C) SJF D) Multilevel queue
B) FCFS
____________ occurs when a higher-priority process needs to access a data structure that is currently being accessed by a lower-priority process. A) Deadlock B) Priority inversion C) A critical section D) A race condition
B) Priority inversion
Which of the following is NOT true? A) all of the rest B) Since semaphore is a tool for synchronization, process that have used semaphores should not cause deadlocks C) a set of processes is in a deadlocked state when every process in the set is waiting for an event that can be caused only by another process in the set D) Semaphores may be shared resources that different processes contend for, and hence deadlocks may occur
B) Since semaphore is a tool for synchronization, process that have used semaphores should not cause deadlocks ***
Which of the following is NOT a possible situation when a child process is created? A) The child process and the parent process are both waiting in a device queue. B) The child process has the same process id as the parent process. C) The child process is running concurrently with the parent process. D) The child process and the parent process are both ready.
B) The child process has the same process id as the parent process.
Which of the following is incorrect? A) FCFS has a convoy effect. B) The quantum of the round robin algorithm is the smaller the better. C) FCFS is non-preemptive. D) Shortest-job-first scheduling can be preemptive.
B) The quantum of the round robin algorithm is the smaller the better.
In _, the process requests permission to access and modify variables shared by others. A) exit section B) entry section C) remainder section D) critical section
B) entry section ***
Which of the following is true about the fork() system call: A) fork() returns 1 if it successfully creates a child process. B) fork() return 0 in the child process. C) fork() creates a child process that replaces the parent process's address space. D) None of the rest
B) fork() return 0 in the child process.
The part of the operating system that is running at all times is called the A) control program. B) kernel. C) security manager. D) resource manager.
B) kernel.
Which of these is NOT included in the PCB? A) accounting information. B) local variable. C) a copy of the program counter. D) a copy of the registers
B) local variable.
What category of system call includes the ones for process creation and termination? A) protection B) process control C) device management D) file management
B) process control
The counting semaphore is initialized to _. A) 1 B) the number of resources available C) none of the rest D) 0
B) the number of resources available
What is the correct order of operations for protecting a critical section using a binary semaphore? A) acquire() followed by release() B) wait() followed by signal() C) release() followed by acquire() D) signal() followed by wait()
B) wait() followed by signal()
Which of the following is true about I/O-bound vs. CPU-bound processes: A) CPU-Bound Processes never do I/O B) I/O-bound processes never need CPU time. C) A multi-programming system prefers a mix of I/O-bound and CPU-bound processes. D) None of the rest.
C) A multi-programming system prefers a mix of I/O-bound and CPU-bound processes.
Which of the following can be a solution to the problem of indefinite blockage of low-priority processes? A) Starvation B) All of the above C) Aging D) Multilevel queue
C) Aging
Which of the following is true regarding differences between threads, processes and programs: A) A program can become one or more processes B) A process can contain one or more threads. C) All of the rest D) Threads are more vulnerable to problems caused by other threads in the same process
C) All of the rest
Which of the following is true for the solutions to critical-section problems? A) Bounded waiting implies no deadlock, and no deadlock implies progress B) No deadlock implies progress, and progress implies bounded waiting C) Bounded waiting implies progress, and progress implies no deadlock D) Progress implies no deadlock, and no deadlock implies bounded waiting
C) Bounded waiting implies progress, and progress implies no deadlock ******
I/O-bound program typically has many short _ and a CPU-bound program might have a few long _. A) CPU burst, I/O burst B) I/O burst, I/O burst C) I/O burst, CPU burst D) CPU burst, CPU burst
C) CPU burst, CPU burst ***
Which of the following refers to the capability to allow multiple tasks to make progress on a single processor system? A) parallelism B) task parallelism C) concurrency D) data parallelism
C) Concurrency
Which of the following is NOT true about multi-programming: A) It allows running multiple programs concurrently in a system B) It allows multiple processes in the memory at the same time. C) It is only possible when there are multiple processors in a system. D) It increases CPU utilization
C) It is only possible when there are multiple processors in a system.
The queue associated with a semaphore implementation is for A) the dispatcher to decide when an I/O burst is done B) processes/threads that are doing busy waiting C) None of the rest D) processes/threads waiting for the CPU
C) None of the rest
Which of the following is NOT true for Peterson's solution? A) The bounded-waiting requirement is met B) The progress requirement is satisfied C) Peterson's solution works for synchronization among more than two processes D) Mutual exclusion is preserved
C) Peterson's solution works for synchronization among more than two processes
Which of the following scheduling algorithms gives the minimum average waiting time for a given set of processes? A) FCFS B) RR C) SJF D) Multilevel queue
C) SJF
Which of the following benefits go to multithreaded programming? A) scalability B) resource sharing C) all of the rest D) responsiveness E) economy
C) all of the rest
Which of the following models are possible for the relationship between the user threads and kernel threads? A) two-level model B) one-to-one model C) all of the rest D) many-to-many model E) many-to-many model
C) all of the rest
A running process that completes its time slice will move to the state of A) waiting B) terminated C) ready D) new
C) ready
A significant problem with priority scheduling algorithms is _. A) determining the length of the time quantum B) complexity C) starvation D) determining the length of the next CPU burst
C) starvation
Which of the following circumstances can preemptive scheduling take place? A) when a process terminates B) when a process switches from the running state to the waiting state C) when a process switches from the waiting state to the ready state D) none of the rest
C) when a process switches from the waiting state to the ready state ***
Convoy effect happens A) when there is no IO-bound processes B) when long processes are behind short processes C) when short processes are behind long processes D) when there is no CPU-bound processes
C) when short processes are behind long processes
(typo was on the quiz lol semaphore's) What should be the sempaphore's initial value if it is intended for mutual exclusion A) It depends on the number of processes that are competing for the resource B) -1 C) 0 D) 1
D) 1
For the following code : (header files and error checking omitted) int main() { pid_t pid; int value = 10; pid = fork(); /* child process */ if (pid == 0) value = value + 2; /* parent process */ else if (pid > 0) { wait(NULL); printf("PARENT: value = %d", value); /* LINE A */ } } What is the output of VALUE at LINE A? A) a random number B) 12 C) 20 D) 10
D) 10
For the FCFS CPU scheduling algorithm, if we have 3 process and their CPU burst time in milliseconds are P1: 15 P2: 15 P3: 1 The come in order of P1, P2, P3, all at time 0, What is the average waiting time in milliseconds? A) None of the rest B) 11.5 C) 10 D) 15
D) 15
Including the initial parent process, how many processes are created by the program shown below? #include <unistd.h> int main ( ) { fork(); fork(); fork(); return 0; } A) random B) 4 C) 3 D) 8
D) 8
The _ occurs in first-come-first-served scheduling when a process with a long CPU burst occupies the CPU A) system-contention scope B) waiting time C) dispatch latency D) convoy effect
D) Convoy effect
Which of the following will trigger an interrupt? A) kernel function B) software execution C) CPU execution D) I/O completion
D) I/O completion
Which of the following is correct about CPU schedule criteria: A) If the total amount of time to execute a process increases, the waiting time increases. B) None of the rest. C) If the amount of time a process has been waiting in the ready queue decreases, the response time decreases. D) If the number of processes that complete their execution per time unit increases, the system throughput increases.
D) If the number of processes that complete their execution per time unit increases, the system throughput increases.
If process P0 is switched to process P1, state for P0 will be saved into _, and state from _ will be reloaded? A) PCB1, PCB1 B) PCB1, PCB0 C) PCB0, PCB0 D) PCB0, PCB1
D) PCB0, PCB1
Which of the following criteria is more important for an interactive system? A) Throughput B) Turnaround time C) CPU utilization D) Response time
D) Response time
System calls and general C library functions have the following differences: A) All general functions in C library work with the operating system kernel. B) System calls are in C, but general functions are not. C) System calls for process management are defined in C, but those for file management are defined in Python. D) System calls are entry points into the kernel, but general functions are not.
D) System calls are entry points into the kernel, but general functions are not.
Which of the following critical-section problem's requirements limits the amount of time a program will wait before it can enter its critical section? A) mutual exclusion B) progress C) none of the rest D) bounded waiting
D) bounded waiting
Which of the following items are shared across multiple threads belonging to the same process? A) registers B) stack C) all of the rest D) code, data, files
D) code, data, files
A context switch A) None of the rest B) lets the PCB of the new process overwrite the PCB of old process without saving it first in order to reduce overhead. C) allows multiple processes to share a CPU, thus it should happen as often as possible. D) has overhead that wastes system resource.
D) has overhead that wastes system resource.
Which of the following is a good criterion for CPU scheduling? A) minimize CPU-bound jobs in the queue. B) minimize CPU utilization. C) maximize process waiting time D) minimize process turnaround time.
D) minimize process turnaround time.
Which of the following critical-section problem's requirements ensures only one process is active in its critical section at a time? A) progress B) none of the rest C) bounded waiting D) mutual exclusion
D) mutual exclusion
Which of the following critical-section problem's requirements ensures programs will cooperatively determine what process will next enter its critical section? A) none of the rest B) bounded waiting C) mutual exclusion D) progress
D) progress ***
An operating system A) provides resource allocation so that each process gets the exact same total CPU time B) All of the rest C) is a hardware that comes with the computer you buy D) provides services such as user-OS interface
D) provides services such as user-OS interface
A privileged instruction A) runs in low priority user mode B) runs in user mode C) runs in idle mode D) runs in system mode
D) runs in system mode
Assume process P0 and P1 are the process before and after a context switch, and PCB0 and PCB1 are respectively their process control block. Which of the following time units are included inside the dispatch latency? A) all of the rest B) P1 executing C) P0 executing D) save state into PCB0, and restore state from PCB1
D) save state into PCB0, and restore state from PCB1
Moore's Law predicts that A) memory's performance decreases exponentially. B) memory's performance increases exponentially. C) the number of transistors on a chip decreases exponentially. D) the number of transistors on a chip increases exponentially
D) the number of transistors on a chip increases exponentially
Consider a situation in which 3 processes are accessing a shared queue. The operation Enq(x) adds the data x to the tail of the queue. Assume that Enq() is written with mutual exclusion guaranteed, thus the queue data structure cannot be corrupted by concurrent Enq() operations. The relevant code segment for the processes is given below: Process A: Enq(X); Signal(s); Process B: Wait(s); Enq(Y); Process C: Enq(Z); Signal(s); Assume that the initial value of the semaphore S is 0. List all possible final states of the queue.
There are 4 possible final states of the queue • xyz • xzy • zxy • zyx
What would be the output of the following code, assuming both fork system calls are successful? pid_t pid1, pid2; int a = 10; printf("init: a = %d.\n ", a); if((pid1 = fork()) <0) { printf("fork error"); exit(-1); } else if (pid1 == 0) { a = a + 10; printf("first: a = %d.\n ", a); } if((pid2 = fork()) < 0) { printf("fork error"); exit(-1); } else if (pid2 = = 0 ) { a = a + 20; printf("second: a = %d.\n ", a); }
This got me a 6/7, just say 10 20 30 40 lol It will start by printing "init: a = 10." Then, the child for pid1 will print out "first: a=20". After that, both the parent and child for pid1 will fork in pid2. pid1's parent process that made pid2's child will say "second: a = 30" and pid1's child process that creates the pid2 child will say "second: a=40". This could result in either of the following results, depending on what processes runs first. init: a = 10. first: a = 20. second: a = 40. second: a = 30. or init: a = 10. first: a = 20. second: a = 30. second: a = 40.
T/F The system() library function creates a child process that executes the shell command specified in the argument.
True
T/F A deferred thread cancellation means that the target thread has an opportunity to decide when is a good time to exit.
True
T/F Busy waiting refers to the phenomenon that while a process is in its critical section, any other process that tries to enter its critical section must loop continuously in the call to acquire the mutex lock
True
T/F If a web server runs as a single-threaded process, only one client can be serviced at a time. This could result in potentially enormous wait times for a busy server. True or False?
True
T/F Microkernel has the advantage of flexibility and better protection, but may have performance issue (i.e. slower than other operating system design) due to message passing.
True
T/F On a single core machine, at most one process can be active (running) at any given time.
True
T/F The difference between parallelism and concurrency is that a parallel system can perform more than one task simultaneously while a concurrent system supports more than one task by allowing multiple tasks to make progress.
True
T/F The functions of an operating-system exist not only for helping the user but also for ensuring the efficient operation of the system itself.
True
T/F Virtual machine allows us to abstract the hardware of a single computer (the CPU, memory, disk drives, network interface cards, and so forth) into several different execution environments.
True
T/F A time-sharing system, such as Unix or Linux, allows the users to share the computer simultaneously.
True
T/F If a web server runs as a single-threaded process, which means only one client can be serviced at a time. This could result in potentially enormous wait times for a busy server.
True
a) List all different states for a process, and the events that would trigger the transitions among them. You do not need to draw the transition diagram. Just list in text. b) Then list at least two cases where transitions are NOT allowed.
a) • New - the process is being created. • Ready - the process is waiting to be assigned to a processor. After the scheduler says its this processes turn, it transitions to running. • Running - the instructions are being executed. If the process finishes, it will become terminated. If it's interrupted, it will go back to the ready state. If it requires I/O or an event wait, it'll move to waiting. • Waiting - the process is waiting for some event to occur. After I/O is entered or the event is completed, it transitions back to ready. • Terminated - the process finished its execution. b) • a process can not transition from the ready state, back to the new state • a process can not transition from the ready state directly to the waiting state
Which of the following is the only gateway between user space and kernel space? A) user interface B) hardware drivers C) system call D) operating system
c) system call
ASSIGNMENT 3 SECTION
gud luck :3
Given the following concurrent code and share the variable y: thread 1 thread 2 x = 0 y = 10 y = x + 7 y = y + 2 How many different values can y possibly have at the end of all the statements due to race condition? A) 3 B) None of the rest C) 6 D) 4
A) 3
QUIZ 1 QUESTIONS
:3
QUIZ 2 QUESTIONS
:3
QUIZ 4 XD XD XD
:3
QUIZ 5 :P
>w<
A context switch A) helps create the illusion that a user has full access of the machine. B) All of the rest. C) can happen on either single-core or multi-core machines. D) makes multi-programming possible.
B) All of the rest.
A context switch involves the switch of A) None of the rest. B) device controllers. C) modes. D) I/O buffers.
A) None of the rest.
Which of the following is true regarding the advantages of preemptive kernel? A) Preemptive kernel is usually more responsive than non-preemptive kernel. B) preemptive kernel is free from deadlock C) none of the rest D) preemptive kernel is free from race condition
A) Preemptive kernel is usually more responsive than non-preemptive kernel.
Shortest-remaining-time-first scheduling is the preemptive version of _? A) SJF B) FCFS C) Multilevel queue D) RR
A) SJF
Which of the following variables are shared between the processes in Peterson's solution? A) both turn and flag B) boolean flag[2] C) No variables are shared. D) int turn
A) both turn and flag
Which of the following contains dynamically allocated data during program run time? A) heap section B) text section C) stack section D) data section
A) heap section
Which of these is NOT included in the PCB? A) local variable. B) a copy of the registers. C) accounting information. D) a copy of the program counter.
A) local variable.
Which of the following items does not belong to the function of a dispatcher? A) selecting a process among the available ones in an I/O waiting queue B) switching to user mode C) switching context from one process to another D) jumping to the proper location in the user program to resume that program
A) selecting a process among the available ones in an I/O waiting queue
A process's stack section A) stores function parameters B) stores code C) stores dynamically allocated data D) None of the rest
A) stores function parameters
Linux Kernel A) was modified in Android to provide power management B) was modified in Android to provide COCOA touch. C) was modified in Mach to provide COCOA touch D) was modified in iOS to provide power management
A) was modified in Android to provide power management
Which of the following is true for race condition? A) when race condition occurs, the outcome of the execution depends on the particular order in which the access takes place B) race condition happens when multiple threads are reading the shared data C) race condition happens in the remainder section of the code D) None of the rest
A) when race condition occurs, the outcome of the execution depends on the particular order in which the access takes place ***
Consider the following set of processes on a single CPU machine, under an FCFS scheduling policy. Note that in the beginning only A exists; B is forked by A. Assume that the semaphores S1 and S2 have an initial value of 0. Trace the execution of this set of processes. You need to clearly indicate when a process blocks and wakes up. In FCFS, a process will always keep execution until it is blocked. Process A: A1; fork(B); wait(S1); A2; signal(S2); Process B: B1; signal(S1); wait(S2); B2; Note that A1, A2, B1, B2 are code segments in the process A or B. The trace can be in the form of "Process:Segment; Process:Segment.... ". Example of trace format: A: A1; B: B1; B:signal(S1). (This is not the answer of course.)
A: A1; A: fork(B); A:wait(S1); B: B1; B: signal(S1); B:wait(S2); A: A2; A:signal(S2); B:B2;
Which section is part of the layout of a process in memory? A) stack. B) All of the rest. C) heap. D) data.
B) All of the rest
T/F Although some CPU scheduling criteria are not compatible, minimizing turnaround time guarantees minimizing response time.
False
T/F As computers and operating systems evolve over the years, people-per-computer (number of people divided by number of computers) has been increasing.
False
T/F For the round-robin scheduling algorithm, it is guaranteed that the larger the quantum, the smaller the average waiting time
False
T/F In RR scheduling, the time quantum should be small with respect to the context-switch time.
False
T/F The bootstrap program resides entirely in main memory (RAM).
False
T/F The criteria for CPU scheduling are always compatible. For example, when you minimize response time, you always maximize throughput.
False
T/F The value of a counting semaphore can range only between 0 and 1.
False
T/F Parallelism can be achieved on single-processor systems.
False
QUIZ 3 MEOW
MEOW MEOW MEOW :3
For each case, list the waiting time of each process in the ready queue, then calculate the total waiting time of all processes: 1. Preemptive SJF: Three processes P1 - P3 arrive at time 0, 1, and 6 (ms), with the lengths of the CPU bursts being 3ms, 6ms and 1ms respectively. 2. Round-Robin: Five processes P1 - P5 arrive at time 0, 0, 2, 2, 2, with the lengths of the CPU bursts being 2, 5, 6, 5, 4 ms respectively. The quantum is 2ms. (Assume that when a process's quantum expires, it will be moved to the tail of the ready queue.)
Preemptive SJF waiting time • P1: 0 ms • P2: 3 ms • P3: 0 ms Preemptive SJF Total waiting time: 3 ms Round Robin waiting time • P1: 0 ms • P2: 14 ms • P3: 13 ms • P4: 15 ms • P5: 12 ms Round Robin Total waiting time: 54 ms
Calculate the waiting time of each process in the ready queue, then calculate the total waiting time of all processes: The CPU scheduling algorithm is FCFS: Three processes P1 - P3 arrive at time 0, 1, and 6 (ms), with the lengths of the CPU bursts being 3ms, 6ms and 1ms respectively.
Waiting Time • P1: 0 ms • P2: 2 ms • P3: 3 ms Total Waiting Time: 5 ms
QUIZ SIX BAY BEEEEEE
YEAHHHH LAST ONE
