Assignment 3 Questions

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

According to Lecture 19, select all of the following that are requirements for mutual exclusion? 1) Only one process at a time is allowed into its critical section, among all processes that have critical sections for the same resource or shared object. 2) A process that halts must do so without interfering with other processes. 3) A process remains outside its critical section for a finite time only 4) It must not be possible for a process requiring access to a critical section to be delayed indefinitely: no deadlock or starvation. --- A: 1, 2, 4 B: 1, 2, 3, 4 C: 1, 2 D: 3, 4

A is correct because it excludes 3. 3 is not a part of the final answer because a process must remain INSIDE its critical section for a finite time only B is incorrect because it includes 3, which is an incorrect variation of a requirement for mutual exclusion. C is incorrect because it excludes 4, which is a requirement for mutual exclusion D is incorrect because in excludes A and B which are requirements for mutual exclusion and includes 3, which is an incorrect variation of a requirement for mutual exclusion.

According to lecture 21, which is the correct definition of the Deadlock Condition Circular Wait? --- A: A closed chain of processes exists, such that each process holds at least one resource needed by the next process in the chain. B: No resource can be forcibly removed from a process holding it. C: A process may hold allocated resources while awaiting assignment of other resources. D: No process may access a resource until that has been allocated to another process.

A is correct because it matches the deadlock condition Circular Wait. B is incorrect because it is for the deadlock condition Pre-Emption. C is incorrect because it is for the deadlock condition Hold-and-Wait. D is incorrect because it is for the deadlock condition Mutual Exclusion.

According to synchronization-tools.pdf which of the following describes multiprogramming? --- A: The management of multiple processes within a uniprocessor system B: The management of multiple processes within a multiprocessor C: The management of multiple processes executing on multiple, distributed computer systems D: A situation in which a runnable process is overlooked indefinitely by the scheduler; although it is able to proceed, it is never chosen. E: Coding multiple programs at once

A is correct because that is the definition for multiprogramming B is incorrect because it describes multiprocessing C is incorrect because is describes distributed processing D is incorrect because it describes starvation E is incorrect because coding multiple programs at once is not multiprogramming.

According to the lecture on 10/14, what is the best description of a zombie process? --- A: process terminates and the information is never reaped B: parent process terminates before the child C: parent process infinitely forking D: child process terminates before parent

A is correct because the process still terminates but still exists in some capacity B. definition of child process C. this infinite loop goes on forever but the process still exists and has not terminated D. This is how a parent/child process should normally function

According to lecture 19, given the following information P1: arrival = 2, burst = 24 P2: arrival = 4, burst = 6 P3: arrival = 3, burst = 18 P4: arrival = 1, burst = 7 Using first-come, first-served scheduling, what is the proper calculation for Average Waiting time? --- A: (0 + 7 + 31 + 49)/4 B: (0 + 24 + 30 + 48)/4 C: (0 + 24 + 42 + 49)/4 D: (7 + 24 + 18 + 6)/4 E: (0 + 7 + 31 + 49)/3

A is correct because to calculate the waiting time using FCFS scheduling, you must take into account the order of arrival of each process, in this case, P4 is the first. Then you must know how much time it takes before the beginning of each process and then simply add all of these time units together and divide by the number of processes. B is incorrect because the waiting time of each process is calculated in the order of P1 -> P2 -> P3 -> P4, which is not FCFS scheduling. C is incorrect because the waiting time of each process is calculated in the order of P1 -> P3 -> P4 -> P2, which is not FCFS scheduling. D is incorrect because these are not calculated wait times, these are the burst times added together. E is incorrect because there are 4 processes, not 3.

According to lecture 19, how does a computer estimate the next CPU burst time? --- A: An exponential average of previous CPU bursts. B: The dispatcher guesses the largest possible burst next. C: Mean burst time of all previous CPU bursts. D: CPU burst time is precomputed.

A is correct, an exponentially weighted average predicts the next burst length. B is incorrect, guessing the maximum length would be unhelpful for CPU scheduling. C is incorrect, a linear average is not as predictive as an exponential average. D is incorrect, a program's runtime length is not precomputable.

According to Chapter 5 (CPU Scheduling.pdf) from week 9, a multilevel-feedback-queue scheduler is defined by which parameter(s)? --- A: All of the above B: Number of queues C: Scheduling algorithms for each queue D: Method used to determine when to upgrade a process E: Method used to determine when to demote a process

A. This is correct because answers B-E are all correct. B. This answer is incorrect because the number of queues is one of the parameters that defines a multilevel-feedback-queue scheduler, but not the only one listed. C. This answer is incorrect because the scheduling algorithms for each queue is one of the parameters that defines a multilevel-feedback-queue scheduler, but not the only one listed. D. This answer is incorrect because the method used to determine when to upgrade a process is one of the parameters that defines a multilevel-feedback-queue scheduler, but not the only one listed. E. This answer is incorrect because the method used to determine when to demote a process is one of the parameters that defines a multilevel-feedback-queue scheduler, but not the only one listed.

Given a file name, how do you open a file in the C language? --- A: fopen() B: openfile() C: openf() D: file()

A. fopen() is used to open a file in the C language. You can specify a filename, and permissions to open the file with(for ex, fopen("test.txt", "r") opens test.txt with read permissions. B. Not a valid C method. C. Not a valid C method. D. Not a valid C method.

According to the lecture on 11-4-21, Which is NOT a way to prevent deadlock? --- A: Deadlock Stopping B: Deadlock Prevention C: Deadlock Avoidance D: Deadlock Detection

A. Is correct, since deadlock stopping is not a method to prevent deadlock. B. Is incorrect since this is a method to stop certain conditions from occurring to prevent deadlock. C. Is incorrect since this method will not allow a process to grant a resource request that might lead to a deadlock. D. Is incorrect since this method will wait and detect if a deadlock is occurring, and if it does occur, then it will take action and recover from that state.

According to Processes-iii, what causes an orphan process? :'( --- A: A parent process terminates before its child process is terminated. B: When a process is terminated. C: When an execution task is switched but later has a burst. D: When fork() is called, it creates an orphan process from the parent process. E: A father process leaves to "buy milk" and doesn't come back.

A. is correct. B. is incorrect, because it details a zombie process. C. is incorrect, because it details a non-voluntary context switch. D. is incorrect, because when fork() is called, a child process is created. E. is incorrect, because the mother process still has potential to raise the child process. :)

Based on the lectures and Project1, calculate the Average Turnaround Time for the following processes: Assume all processes submitted at 0. PID Burst 1 5 3 2 2 1 4 7 1 3 2 4 --- A: (18 + 7 + 22 + 15)/4 B: (5 + 7 + 8 + 15 + 18 + 22)/6 C: (18 + 7 + 22 + 15)/6 D: (15 + 18 + 5 + 8)/4

A.) A is correct because you only count the completion time of the last occurrence for each pID. Process 1 waits 15 and executes 3, while Process 3 waits 5 and executes for 2, while Process 2 waits 18 and executes for 4 and Process 4 waits 8 and executes for 7. B.) B is incorrect because you are calculating the turnaround time of each instruction, not each specific pID. C.) C is incorrect; while the turnaround time for the processes are correct , you are dividing by number of instructions rather than unique pIDS. D.) D is incorrect because it counts the wait time of each process ID's last occurrence. For turnaround time we want this plus the burst of the last occurrence to get the time that each process is completed.

Consider the following code, based on the synchronization tools slides, which attempts to increment a shared (non-atomic) integer `s` in two different processes, using a shared array of boolean flags called `flag`:Process 1's code: 1 - while (flag[1]); //do nothing 2 - flag[0] = true; 3 - s++; 4 - flag[0] = false; Process 2's code: 1 - while (flag[0]); //do nothing 2 - flag[1] = true; 3 - s++; 4 - flag[1] = false; Both pieces of code are executed in different threads and each is run 100 times. Identify a way in which the program may not behave as expected (the final value of `s` should theoretically be 200). --- A: If the two processes happen to be executing their while loops at the same time, it will cause a race condition. B: The processes may enter a state of deadlock. C: The value of `s` may be greater than 200. D: The processes may enter a state of livelock.E: The processes will be mutually excluded.

A.) When the two segments of code are in sync, then they will each check their while loops and see that both flags are false, and both will continue on to their critical sections uninterrupted because the flags are set after they are waited on. B.) The processes cannot enter deadlock because when a flag is set in the code, it is always followed by the flag being unset, and so neither thread could be waiting forever on either flag. C.) The race condition occurs because the ++ operation consists of a read and a write that may occur out of order; `s` is never incremented by more than 1, and the thread that 'loses' the race will be setting `s` to a lower value, since it was reading from an earlier state of `s`. D.) The processes cannot enter a state of livelock because the code ensures that the flags are always unset after they are set. E.) Mutual exclusion would be a desirable state in which only one thread would be accessing `s` at a time. However, as evidenced, that is not the case.

According to the synchronization-tools.pdf slides, in a compare and swap instruction, what two values are compared? --- A: A memory and test value B: A memory and integer value C: A boolean and integer value D: An integer and test value

A is correct because in a compare and swap instruction, a memory and test value are compared and if they are the same, they are then swapped. B is incorrect because the test value does not have to be an integer value C is incorrect because the values should be comparable D is incorrect because the memory value does not have to be an integer value

According to Project 1 and Lectures 18 and 19, what is the difference between a process and a thread? --- A: A thread is a segment of a process, while a process is a program in execution. B: A process is a segment of a thread, while a thread is a program in execution. C: A thread is a CPU component, while a process is a program in execution. D: A process is a sum of all memory addresses, while a thread is a line of code.

A is correct because a thread is a segment, while a process is a full program being executed. B is incorrect because the terms are swapped. C is incorrect because the definition of thread is incorrect in this context. D is incorrect because the definitions are incorrect.

According to lecture 19, which of the following statements is false about First Come First Serve (FCFS) Scheduling? --- A: For all instances of FCFS Scheduling, arrival time does not matter B: Wait time is the difference between turnaround time and burst time C: Also known as FIFO Scheduling D: In FCFS Scheduling, the process that comes first will be executed and completed first before executing next process E: All of the above are false statements about First Come First Serve (FCFS) Scheduling

(a) CORRECT: The process that arrives first is the first to be executed and completed. So, the arrival time does matter. (b) Incorrect: This is a true statement. Wait time = turnaround time - burst time (c) Incorrect: This is a true statement. FCFS Scheduling is also known as First In First Out (FIFO) Scheduling (d) Incorrect: This is a true statement. This is the definition of FCFS Scheduling (e) Incorrect: Only statement A is false about FCFS Scheduling

According to Chapter 5. In which algorithm process which has the shortest time for execution is served first? --- A: SJF B: FCFS C: RR D: Priority base Scheduling

*A. Correct. Shortest Job First (SJF): short processes are executed first and then followed by longer processes *B. Incorrect. First Come First Serve (FCFS): doesn't include any complex logic, it just puts the process requests in a queue and executes them one by one. *C. Incorrect. Round Robin (RR): each process is served by the CPU for a fixed time quantum, so all processes are given the same priority. *D. Incorrect. Priority base Scheduling: selected based on memory requirement, time requirement, or user preference.

According to CPU scheduling pdf, What is Little's formula? average queue length = n, average waiting time in queue = W, average arrival rate into queue = r --- A: n = W * r B: n = W / r C: n = r / W D: W = n * r

1) Correct - average waiting time is multiplied by average arrival rate into queue to get the average queue length. 2) Incorrect - average waiting time in queue is not divided by average arrival rate into queue. 3) Incorrect - average arrival rate into queue is not divided by average waiting time in queue. 4) Incorrect - average waiting time is not solved by the product of average arrival rate and average queue length.

According to Chapter 5 (ch05.pdf), Using Shortest-Job-First Scheduling which would be the correct execution order of the following processes? Process Burst Time Priority P1 5 3 P2 11 1 P3 6 4 P4 2 2 --- A: P4, P1, P3, P2 B: P1, P3, P2, P4 C: P2, P4, P1, P3 D: P3, P1, P4, P2

A - Correct, This order give the minimal average wait time across the processes. B - Incorrect, This order does not give the minimal average wait time. C - Incorrect, This order is an example of priority scheduling. D - Incorrect, This order does not give the minimal average wait time.

According to the Chapter 5 pdf on CPU Scheduling, in priority scheduling, what is associated with each process? --- A: A priority number B: A string value C: A boolean value D: A dispatcher module E: A donut

A - correct, the CPU is allocated to the process with the highest priority (smallest integer) B - incorrect, a string value is a sequence of characters terminated with a newline C - incorrect, a boolean value is a true or false value D - incorrect, a dispatcher module gives control of the CPU to the process selected E - incorrect, a donut is obviously not associated with each process

According to Lecture 18 and Project 1, what is the difference between the Turnaround Time and the Waiting Time of a task? --- A: Both include the time it takes while waiting on the ready queue, but turnaround time also includes the time it takes to execute the task B: Both include the time it takes while waiting on the ready queue, but waiting time also includes the time it takes to execute the task C: Turnaround time is the time it takes from submission to task completion, while waiting time is the amount of time until the first mention of the task D: Turnaround time is the total executing time of the task without including the time it is on the ready queue, while waiting time is the amount of time the task has been waiting in the ready queue

A is correct as it is the correct definition for how both turnaround time and waiting time are calculated. B is incorrect as the two definitions are swapped C is incorrect as the waiting time definition is the definition for response time D is incorrect as the turnaround time definition is incorrect, as it should also include its waiting time as well.

According to project 1, based on this input 14 51 1 12 5 54 4 63 2 64 5 4 What is the waiting time output? --- A: 4.75 B: 4.25 C: 0.24 D: 1

A is correct as the average wait time is calculated like (0 + 1 + 10 + 8)/4 is 4.75 B is incorrect as the choice is the average RESPONSE time, which is calculated like ( 0 + 1 + 10 + 6) / 4 C is incorrect as this is the output for throughput, which is calculated by dividing the max processor, which is 4, by sum of burst time. D is incorrect as this is the nonvoluntary context switch, which occurs for processor 4.

According to the lecture on 11/04/21, which of the following is not one of the conditions for deadlock? --- A: Pre-emption B: No pre-emption C: Hold-and-Wait D: Circular Wait E: Mutual Exclusion

A is correct because Pre-emption is not one of the conditions for deadlock. B is incorrect because No pre-emption is one of the conditions for a deadlock. Likewise, C, D, and E are all conditions for deadlock so they would also be incorrect.

According to lectures 18 - 19, what would be considered as optimal for the CPU scheduling algorithms? --- A: Max CPU Utilization, Max throughout, Min Turnaround Time, Min Waiting Time, and Min Response Time B: Min CPU Utilization, Min throughout, Max Turnaround Time, Max Waiting Time, and Max Response Time C: Max CPU Utilization, Max throughout, Max Turnaround Time, Min Waiting Time, and Min Response Time D: Min CPU Utilization, Max throughout, Max Turnaround Time, Min Waiting Time, and Max Response Time E: Max CPU Utilization, Min throughout, Min Turnaround Time, Min Waiting Time, and Min Response Time

A is correct, max CPU utilization means the CPU is used as much as possible, max throughout means that more processes are complete given a time unit, min turnaround time means processes are not waiting too long into it is executed, min waiting time means processes will be in the waiting queen for a long time, and min response time means it will take the shortest amount of time for the CPU to react to each request. Thus, the CPU scheduling algorithm is using CPU power optimally. B is incorrect, Min CPU Utilization, Min throughout, Max Turnaround Time, Max Waiting Time, and Max Response Time should be the worse of the CPU scheduling algorithm. C is incorrect, Max Turnaround time means it will take forever for a CPU to execute a process. Therefore, it should not be optimal. D is incorrect, Min CPU utilization means the CPU is used as much and max turnaround time and response time meaning the CPU is not responding to requests and not executing processes. E is incorrect, Min throughout means the CPU is not completing processes.

According to lecture 13, which of the following process state transitions is not valid: --- A: Created -> Ready to Run In Memory -> Asleep In Memory -> Ready to Run in Memory -> Kernel Running -> Zombie B: Created -> Ready to Run in Memory -> Kernel Running -> User Running -> Kernel Running -> Zombie C: Created -> Ready to Run Swapped -> Ready to Run in Memory -> Kernel Running -> User Running -> Kernel Running -> Zombie D: Created -> Ready to Run in Memory -> Kernel Running -> Asleep In Memory -> Ready to Run in Memory -> Kernel Running -> Zombie

A is correct. It is not possible to transition from Ready to Run in Memory to Asleep in Memory because the process is not running in the first place B is incorrect. This state transitions represents a simple program that does not call any syscalls except exit C is incorrect. This one is like B, but it starts in swapped and needs to be swapped into memory before the program can be run D is incorrect. In contrast to A, B sets the process into Kernel Running mode first from where it is set asleep

According to the Processes presentation, which definition best fits a normal exit (voluntary) process termination? --- A: Exit status is passed to parent and the process is freed. B: Parent calls for its child to be freed. C: A signal from a separate node is called to kill and free the process. D: The process errors and terminates. E: The process refuses to terminate.

A is correct. This is the most accurate definition for the normal exit termination, in which the process asks the OS itself to be deleted. B is incorrect. In this case, the termination would involuntary, as a different process is calling for termination. C is incorrect. This is similar to answer B, but not necessarily referring to the parent node. D is incorrect. Errors could be voluntary or involuntary, but regardless is not the normal exit for a process. E is incorrect. This answer is obviously unreasonable and wrong.

According to lecture 10/26, a context switch is a --- A: switch of the processes in the CPU scheduler B: switch of the processes in the CPU scheduler where it doesn't switch back C: switch of the processes in the CPU scheduler that is not continued D: when the same process is burst in a row E: type of dinosaur

A) Correct B) nonvoluntary context switch C) voluntary context switch D) context switch is a change in the id E) no

According to Chapter 5 (CPU Scheduling), which of the following is a not class of Solaris? --- A: Fair Priority (FP) B: Time sharing (TS) C: Interactive (IA) D: Real time (RT) E: System (SYS)

A) Correct, Fair Priority is not a class of Solaris. B) Incorrect, Time sharing is the default class of Solaris. C) Incorrect, Interactive is a class of Solaris. D) Incorrect, Real time is a class of Solaris. E) Incorrect, System is a class of Solaris.

According to lecture 17 on gdp, which compile flag should be added to run gdb on your program? --- A: -g B: -Wall C: -O2 D: -Werror=format-security E: -debug

A) Correct- this will run the file in gdp mode by default B) Incorrect- This turns on all warnings C) Incorrect- Runs the compiler's recommended optimizations D) Incorrect- this rejects potentially unsafe format string arguments E) Incorrect- this is an invalid compiler flag

According to Lecture 20 (on Synchronization), which of the following is NOT a property of a race condition: --- A: It will always cause an unexpected output. B: It depends on the timing of other threads or processes. C: It can be avoided by using mutexes. D: It can be avoided by using atomic operations. E: It is said to have "undefined behavior".

A) In some cases, such as in the example in class (iterating a small counter), a race condition may still always produce desired output. B) Generally, race conditions in software are caused by synchronous operations in different threads or processes. C) Mutexes are OS-level locks on a certain variable or operation. D) Atomic operations are CPU-level "locks" on a certain variable or operation. E) Due to a race condition's indeterminism, the output is often unpredictable, which we call having "undefined behavior".

According to the Dino book, section 6.4.3, which of the following is a variable that provides operations which execute in a single, indivisible step --- A: Atomic Variables B: Mutex Variables C: Locked Variables D: Single-Access Variables

A) Is correct, atomic variables have operations which can't be divided B) Is incorrect, mutexes provide locks on variables to allow you to mediate multiple sources changing memory, which are used in similar situations where you might use atomic variables C) Locked variables don't exist, but you might think they exist if you had heard of mutex locks D) Single access variables also don't exist, but sound like they could

According to lecture on 11/4, which is not a restriction of deadlock avoidance strategies? --- A: It is not necessary to preempt and rollback processes. B: Maximum resource requirement for each process must be stated in advance. C: Processes under consideration must be independent and with no synchronization requirements. D: There must be a fixed number of resources to allocate. E: No process may exit while holding resources.

A) This is an advantage of deadlock avoidance, not a restriction. B) Deadlock avoidance cannot be fully implemented if a process doesn't know how many resources it will end up needing. C) Processes cannot be synchronized with and depend on other processes under avoidance strategies. D) The number of resources must not change during execution to ensure optimal deadlock avoidance. E) Processes must free all resources before exiting; poorly coded/errored processes may not do this.

According to Lecture 18 (10/21), which of the following best defines a quantum pertaining to Round Robin CPU scheduling? --- A: A small, fixed unit of CPU time of a queue that is allotted to each process in a queue, such that each process can compute part of their tasks before the CPU switches to a different process. B: A small unit of real world time of a queue that is allotted to each process, such that each process can compute part of their tasks before CPU switches to a different process. C: A random unit of CPU time that is allotted to each process, such that each process can compute part of their tasks before CPU switches to a different process. D: About 10 ms that is allotted to each process, such that each process can compute part of their tasks before CPU switches to a different process. E: Very small particles and energy of the physical universe.

A) This is the best and most correct definition because quantum are units of CPU time used for CPU scheduling. B) This is incorrect because quantum is based on CPU time, not real world time. C) Quantum needs to be fixed unit of CPU time in each queue, otherwise CPU scheduling will be inconsistent and unreliable. D) This is incorrect because a quantum can be configured to be different from 10ms like 100ms or some other amount of ms. E) This does not pertain to CPU scheduling.

According to chapter four in the textbook, what is the many-to-one model of multithreading? --- A: Many user threads compete for one kernel thread. B: Many kernel threads compete for one user thread. C: Concurrent processing. D: Many user spaces are mapped to a single kernel thread.

A) is correct because in many-to-one model, the entire user space of user threads are mapped to a single kernel thread, allowing for efficient thread use in a singular processor system. It is not commonly used in modern multiprocessor systems because of it's inability to run multiple processes in parallel. B) is incorrect. Although it is worded similarly, it is never mentioned in the textbook and is essentially nonsense. C) is incorrect. Concurrent processing is something the many-to-one model cannot do because of it's inability to run multiple kernel processes at once. D) is incorrect. The user space is the entirety of all of the user threads, but not the threads individually. Multiple user spaces would be on separate computers.

According to the lecture on 10/26/21 on CPU scheduling under what circumstances does nonpreemptive scheduling take occur? --- A: B and C. B: When the process switches from the running state to waiting state as a result of I/O request or wait() system call. C: When a process terminates. D: When a process switches from the running state to the ready state as a result of an interrupt. E: When a process switches from the waiting state to the ready state, at the completion of I/O.

A, is the correct answer because nonpreemptive scheduling scheme can take place either when a process switches from running state to waiting or when a process terminates voluntarily. B, is incorrect because nonpreemptive scheduling can also occur when a process terminates. C, is incorrect because nonpreemptive scheduling can also occur when a process switches from running state to waiting state. D, is incorrect because when a process switches from the running state to to the ready state it is preemptive scheduling. E, is incorrect because when a process switches from the waiting state to the ready state it is preemptive scheduling.

According to Lecture 19, what is wait time ? --- A: How much time processes spend in the ready queue waiting their turn to get on the CPU. B: Number of processes completed per unit time. C: Time required for a particular process to complete, from submission time to completion D: The time taken in an interactive program from the issuance of a command to the commence of a response to that command. E: Time required to use the autograder.

A. Correct - Wait time is how much time processes spend in the ready queue waiting their turn to get on the CPU. B. Incorrect - This is known as Throughput. C. Incorrect - This is known as Turnaround Time. D. Incorrect - This is known as Response Time. E. Not the right answer.

According to sycnchronization-tools.pdf on week 10, What are strong semaphores? --- A: The process that has been blocked the longest is released from the queue first (FIFO) B: The order in which processes are removed from the queue is not specified C: Locks the semaphore referenced by sem by performing a semaphore lock operation on that semaphore D: Will perform a traditional SIGNAL operation on the specified semaphore. E: Its the semaphore thats gone to the gym the most.

A. Correct, because a strong semaphore releases the process that has been blocked the longest B. Incorrect because this describes what a weak semaphore is. C. Incorrect because this describes the function of semWait(). D.Incorrect because that is the function of semSignal(). E. Incorrect because semaphores don't use the gym

According to the lecture on 10/19, what does fprintf do? --- A: prints to a file B: prints to stdout C: prints to stderr D: causes an error E: prints "fun" followed by your output

A. Correct, fprintf prints to a file B. Incorrect, does not print to stdout C. Incorrect, does not print to stderr (unless that is the specified destination) D. Incorrect, does not cause an error E. Incorrect, does not print "fun" followed by your output

According to Week 11's deadlock slides, which is NOT a Reusable Resource --- A: Interrupts B: Processors C: Main memory D: Data Structures E: Files

A. Correct, interrupts are consumable resources that are created and the consumed B. Incorrect, processors are reusable as they are never consumed C. Incorrect, main memory is never consumed, but used. D. Incorrect, data structures are reusable E. Incorrect, files are not consumed, but reused by reading, writing etc.

According to lecture 17 (GDB + Threads), how does one get the return value of a pthread? --- A: Pass in a **void to the second argument of pthread_join B: read the return value of pthread_create. C: read the return value of pthread_join. D: You cannot have a return value for a pthread.

A. Correct, pthread_join takes a thread identifier and a void **retval (pointer to a pointer to void) B. Incorrect, pthread_create returns 0 on success or a positive number on error. C. Incorrect, pthread_join returns 0 on success or a positive number on error. D. Incorrect, it is indeed possible to have a return value for a pthread.

According to Lecture 20 and 21, which of the following is a software solution for protecting critical sections in code? --- A: Peterson's solution B: Memory barrier C: Test-and-Set D: Compare-and-Swap

A. Correct, this solution is implemented entirely on a software level B, C, D. Incorrect, these methods are typically implemented into the OS and some involve special hardware components

Read the following statements and then answer the following questions based on the (chapter 5) slides on CPU scheduling : I: Shortest Job First (SJF) CPU scheduling is generally speaking the most optimal/efficient in terms of minimizing waiting time (assuming it can be properly implemented). II: First Come First Served (FCFS) CPU scheduling is prone to the convoy effect. III: Round Robin (RR) CPU scheduling typically has a worse response time but a better turnaround time than most other scheduling methods. Which of the above is most accurate regarding the above statements? --- A: Both I and II are true. B:Only I is true. C:Only II is true. D: I, II, and III are all true. E: None of the above are true.

A: A is correct because I is true, in that Shortest Job First scheduling is theoretically the most efficient in terms of waiting time, despite being almost, if not completely, impossible to actually implement. A is also correct because II is true, in that First Come First Served scheduling is prone to having short processes wind up scheduled after long processes (due to not regulating the queue whatsoever), increasing waiting time, the definition of the convoy effect. B: While I is true, it is not the best answer because II is also true, so C is not the best answer. C: While II is true, it is not the best answer due to I also being true, so C is not the best answer. D: D is not the best answer because III is not true as Round Robin scheduling typically has a better response time, but a worse turnaround time than other scheduling methods. E: E is not the best answer due to both I and II being true.

According to synchronization-tools.pdf which of the following is a disadvantage of Special machine instruction? --- A: Starvation is possible B: It cant be used to support multiple critical sections C: It can be overly complex D: Isn't applicable to different number of processes. E: Not special enough

A: Correct as When a process leaves a critical section and more than one process is waiting, the selection of a waiting process is arbitrary; some process could indefinitely be denied access B: Incorrect as it is possible for it to support multiple critical sections C: Incorrect as it is actually simple and easy to verify. D: Incorrect as it is applicable to any number of processes on either a single processor or multiple processors sharing main memory. E: Incorrect as it is special as it is called special machine instruction.

According to lecture 19, which of the following is the correct explanation for the Turnaround time? --- A: Amount of time to execute a particular process B: Amount of time a process has been waiting in the ready queue C: Amount of time it takes from when a request was submitted until the first response is produced, not output D: Number of processes that complete their execution per time unit E: Keeping the CPU as busy as possible

A: Correct as the turnaround time is amount of time to execute a particular process. B: Incorrect as it is an explanation for the waiting time. C: Incorrect as it is an explanation for the response time. D: Incorrect as it is an explanation for the Throughput. E: Incorrect as it is an explanation for the CPU utilization.

According to the lecture 17 (GDB + Threads) in week 9. Which of the following is NOT an explanation of vfork(). --- A: The Primary key method of process creation on Unix-like operating system. B: Unlike fork(), no duplication of virtual memory (page tables). C: Parents memory is shared until exec or exit are called. D: Any changes to the stack or heap of the parent are seen in the parent. E: Child of vfork() is guaranteed to be called.

A: correct because it is explanation of fork() not vfork(). B: incorrect because it is explanation of vfork(). C: incorrect because it is explanation of vfork(). D: incorrect because it is explanation of vfork(). E: incorrect because it is explanation of vfork().

According to Lecture 18 (Threads & Scheduling), Which scheduling Algorithm provides the minimum average waiting time for a given set of processes? --- A: Shortest-Job-First Scheduling B: First-Come-First-Served Scheduling C: Round Robin Scheduling D: Priority Scheduling E: Multi-Level-Queue Scheduling

A: is correct because we will schedule the shortest jobs first, and therefore obtain the lowest average waiting time. B: is incorrect since with FCFS scheduling, we could have a long process that comes first and delays the processes that come after it - therefore having a high average wait time. C: is incorrect since with RR Scheduling, we will not obtain the minimum average waiting time due to the order of processes & the fact that many context switches may take place. D: is incorrect since Multi-Level-Queue Scheduling still has a slower wait time compared to SJF Scheduling. The queues in MLQ Scheduling are commonly implemented using RR and FCFS Scheduling, which as explained above aren't optimal for obtaining a minimum average waiting time.

According to ch05.pdf what is the proper term to describe the solution to starvation in priority scheduling. --- A: Aging B: Feeding C: Timing D: Sorting

A: is the proper term as it describes increasing the priority of a process as it grows older B: is incorrect as it does not describe anything in relation to priority scheduling C: is incorrect as it does not describe anything in relation to priority scheduling D: is incorrect as it does not describe anything in relation to priority scheduling

According to Lecture 19 about CPU scheduling, what is the definition for Throughput? --- A: Number of processes that complete their execution per time unit. B: Amount of time a process has been waiting in the ready queue. C: Amount of time to execute a particular process. D: Time it takes for the dispatcher to stop one process and start another running. E: Short process behind long process.

Explanation A. Correct, because throughput is number of processes that complete their execution per time unit. B. Incorrect, because this is the definition for Waiting time for a process. C. Incorrect, because this is the definition for calculating Turnaround time. D. Incorrect, because this is the definition for Dispatch latency, used for the dispatcher. E. Incorrect, because this is the definition for a Convoy Effect.

According to Deadlock.pdf, which deadlock condition is present with the inability to release resources forcibly? --- A: No Pre-Emption B: Circular Wait C: Mutual Exclusion D: Hold & Wait E: None of the deadlock conditions permit forcible resource release

a. Corrrect b,c,d. All Incorrect, None of these options relate to forcible resource release, only required resources being held by another process e. Incorrect, no pre-emption relates to forcible resource release

According to 5.1.4 of the textbook, what is the difference between when a voluntary context switch happens and when a nonvoluntary context switch happens? --- A: A voluntary context switch happens when a resource is unavailable to the process and it has to give up the CPU while a nonvoluntary context switch happens when the time a process has expires or a higher priority process takes over the CPU. B: A voluntary context switch happens when the CPU is taken away because time has expired or a higher priority process takes over while a nonvoluntary context switch happens when the process has to give up control of the CPU because a resource it needs is unavailable. C: A voluntary context switch and a nonvoluntary context switch are the same and can happen when a resource is unavailable for the process, time expired, or a higher priority process takes over. D: A voluntary context switch is the only kind of switch that happens and nonvoluntary context switches do not exist.

a. Is correct because a voluntary context switch occurs when resources are unavailable to the process that currently has the CPU and nonvoluntary context switches happen when the process runs out of time or the CPU is taken by a higher priority process. b. Is incorrect because it describes a voluntary and nonvoluntary context switch incorrectly. c. Is incorrect because it describes a voluntary and nonvoluntary context switch as the same type of swtich. d. Is incorrect because it says nonvoluntary context switches do not exist.

Based on the previous lecture. What is contention? --- A: When a thread a lower priority thread does not have opportunity to run due to a higher priority thread always running. B: When two threads are accessing a resource in such a way it causes a conflict between them C: When two threads are racing to access the same resources D: When two threads execute their tasks without encountering issues.

no explanation


Kaugnay na mga set ng pag-aaral

Managerial Economics - Chapter 11 - Foreign Exchange, Trade, and Bubbles

View Set

Working with Maps and Data in Geography Practice- Human Geography

View Set

Personal Finance Basics Assessments I,II, III, IV, V, VI

View Set

Insurance Everfi Module 7 Revised

View Set

Unit 3 Transponder and Transponder Codes

View Set