OS EXAM 2
Short Answer: Describe how deadlock is possible with the dining-philosophers problem.
If all philosophers simultaneously pick up their left forks, when they turn to pick up their right forks they will realize they are unavailable, and will block while waiting for it to become available. This blocking while waiting for a resource to become available is a deadlocked situation
Denial of Service
Involves preventing legitimate use of the system
Breach of integrity
Involves unauthorized modification of data
Breach of Confidentiality
Involves unauthorized reading of the data
Theft of Service
Involves unauthorized use of resources
Suppose that a scheduling algorithm favors those processes that have used the least processor time in the recent past. Why will this algorithm favor I/O-bound programs and yet not permanently starve CPU-bound programs?
It will favor the I/O-bound programs because of the relatively short CPU burst request by them; however, the CPU-bound programs will not starve because the I/O-bound programs will relinquish the CPU relatively often to do their I/O.
_____ - _____ _____ divides a disk into sections that the disk controller can read and write.
Low, leve, formatting
_____ _____ is a technique for managing bad blocks that maps a bad sector to a spare sector.
Sector sparing
Short Answer: Windows provides a lightweight synchronization tool called slim reader -writer locks. Whereas most implementations of reader-writer locks favor either readers or writers, or perhaps order waiting threads using a FIFO policy, slim reader-writer locks favor neither readers nor writers, nor are waiting threads ordered in a FIFO queue. Explain the benets of providing such a synchronization tool
Simplicity. If reader-writer locks provide fairness or favor readers or writers, they involve more overhead. Providing such a simple synchronization mechanism makes access to the lock fast. Use of this lock may be most appropriate for situations where reader-writer locks are needed, but quickly acquiring and releasing them is similarly important
Short Answer: Explain the difference between software and hardware transactional memory.
Software transactional memory (STM) implements transactional memory entirely in software, no special hardware is required. STM works by inserting instrumentation code inside of transaction blocks and typically requires the support of a compiler. Hardware transactional memory (HTM) implements transactional memory entirely in hardware using cache hierarchies and cache coherency protocols to resolve conflicts when shared data resides in separate caches.
Short Answer: Describe two kernel data structures where race conditions are possible. Be sure to include a dscription describing how a race can occur.
Some kernel data structures include a process id (pid) management system, kernel process table, and scheduling queues.With a pid management system, it is possible two processes may be created at the same time and there is a race condition assigning each process a unique pid. The same type of race condition can occur in the kernel process table: two processes are created at the same time and there is a race assigning them a location in the kernel process table. With scheduling queues, it is possible one process has been waiting for IO which is now available. Another process is being context-switched out. These two processes are being moved to the Runnable queue at the same time. Hence there is a race condition in the Runnable queue. Describe how the Swap() instruction can be used to provide mutual exclusion that satisfies the bounded-waiting requirement.
A sequence of events happen when a page-fault occurs. Match each event to the number that represents its order in the sequence.
1. A sequence of events happen when a page-fault occurs. Match each event to the number that represents its order in the sequence. 2. A sequence of events happen when a page-fault occurs. Match each event to the number that represents its order in the sequence. 3. A sequence of events happen when a page-fault occurs. Match each event to the number that represents its order in the sequence. 4. A sequence of events happen when a page-fault occurs. Match each event to the number that represents its order in the sequence. 5. A sequence of events happen when a page-fault occurs. Match each event to the number that represents its order in the sequence. 6. A sequence of events happen when a page-fault occurs. Match each event to the number that represents its order in the sequence.
Which of the following is a benefit of allowing a program that is only partially in memory to execute?
1. Programs can be written to use more memory than is available in physical memory. 2. Less I/O is needed to load or swap each user program into memory. 3. CPU utilization and throughput is increased.
What three issues need to be addressed if preemption is required to recover from a deadlock?
1. Selecting a Victim, Rollback, Starvation
Short Answer: Discuss the tradeoff between fairness and throughput of operations in the readers-writers problem. Propose a method for solving the readers-writers problem without causing starvation.
1. Throughput is increased by favoring multiple simultaneous readers as opposed to a single, exclusive writer. While this might increase throughput, it would make things less fair to the writers and could potentially cause starvation. 2. To avoid starvation: When a writer finishes its task, it would wake up which ever process has been waiting longest. When a reader arrives it would enter the critical section only as long as there are no writers waiting.
What are the four levels of security measures that are necessary for system protection?
1. physical 2. application 3. operating system 4. network
The effective access time can then be computed using the formula: (MLO 9.2) effective access time = (1 -_____ ) * memory access time + _____ * page fault time
1. probability of page fault 2. memory access time 3. probability of page fault 4. page fault time
What are the two main methods used for intrusion detection?
1. signature-based detection 2. anomaly detection
What four conditions must hold for a deadlock situation to occur in a system?
1.Hold and Wait 2. Mutual Exclusion 3. Circular Wait 4. No Preemption
Consider a disk queue holding requests to the following cylinders in the listed order: 116, 22, 3, 11, 75, 185, 100, 87. Using the SCAN scheduling algorithm, what is the order that the requests are serviced, assuming the disk head is at cylinder 88 and moving upward through the cylinders?
100 - 116 - 185 - 87 - 75 - 22 - 11 - 3
Suppose a program is operating with execution-time binding and the physical address generated is 300. The relocation register is set to 100. What is the corresponding logical address?
200
Given the reference string of page accesses: 1 2 3 4 2 3 4 1 2 1 1 3 1 4 and a system with three page frames, what is the final configuration of the three frames after the LRU algorithm is applied?
3, 1, 4
RAID level _______ is the most common parity RAID system.
5
Suppose we have the following page accesses: 1 2 3 4 2 3 4 1 2 1 1 3 1 4 and that there are three frames within our system. Using the FIFO replacement algorithm, what is the number of page faults for the given reference string?
8
Consider a disk queue holding requests to the following cylinders in the listed order: 116, 22, 3, 11, 75, 185, 100, 87. Using the SSTF scheduling algorithm, what is the order that the requests are serviced, assuming the disk head is at cylinder 88 and moving upward through the cylinders?
87 - 75 - 100 - 116 - 185 - 22 - 11 - 3
Consider a 32-bit address for a two-level paging system with an 8 KB page size. The outer page table has 1024 entries. How many bits are used to represent the second-level page table?
9
Consider a computer system that runs 5,000 jobs per month with no deadlock-prevention or deadlock-avoidance scheme. Deadlocks occur about twice per month, and the operator must terminate and rerun about 10 jobs per deadlock. Each job is worth about $2 (in CPU time), and the jobs terminated tend to be about half-done when they are aborted. A systems programmer has estimated that a deadlock-avoidance algorithm (like the banker's algorithm) could be installed in the system with an increase in the average execution time per job of about 10 percent. Since the machine currently has 30-percent idle time, all 5,000 jobs per month could still be run, although turnaround time would increase by about 20 percent on average. a. What are the arguments for installing the deadlock-avoidance algorithm? b. What are the arguments against installing the deadlock-avoidance algorithm?
An argument for installing deadlock avoidance in the system is that we could ensure deadlock would never occur. In addition, despite the increase in turnaround time, all 5,000 jobs could still run. An argument against installing deadlock avoidance software is that deadlocks occur infrequently and they cost little when they do occur.
Short Answer: Explain the difference between signaled and non-signaled states with Windows dispatcher objects.
An object that is in the signaled state is available, and a thread will not block when it tries to acquire it. When the lock is acquired, it is in the non-signaled state. When the lock is released, it transitions back to the signaled state.
What is the difference between symmetric and asymmetric encryption?
Asymmetric cryptography utilizes a pair of related keys to decrypt a message and protect it from unauthorized access or use. Symmetric encryption is almost similar, except that it utilizes only one secret key for decryption.
Which of the following data structures in the banker's algorithm is a vector of length m, where m is the number of resource types?
Available
_____ _____ is the dynamic storage-allocation algorithm which results in the smallest leftover hole in memory.
Best fit
Can a system detect that some of its processes are starving? If you answer "yes," explain how it can. If you answer "no," explain how the system can deal with the starvation problem.
Consider the following resource-allocation policy. Requests for and releases of resources are allowed at any time. If a request for resources cannot be satisfied because the resources are not available, then we check any processes that are blocked waiting for resources. If a blocked process has the desired resources, then these resources are taken away from it and are given to the requesting process. The vector of resources for which the blocked process is waiting is increased to include the resources that were taken away. For example, consider a system with three resource types and the vector Available initialized to (4,2,2). If process P0 asks for (2,2,1), it gets them. If P1 asks for (1,0,1), it gets them. Then, if P0 asks for (0,0,1), it is blocked (resource not available). If P2 now asks for (2,0,0), it gets the available one (1,0,0) and one that was allocated to P0 (since P0 is blocked). P0's Allocation vector goes down to (1,2,1), and its Need vector goes up to (1,0,1).
_____ _____ is the dynamic storage-allocation algorithm which results in the largest leftover hole in memory.
Worst fit
Short Answer: Assume that a multithreaded application uses only reader-writer locks for synchronization. Applying the four necessary conditions for deadlock, is deadlock still possible if multiple reader-writer locks are used?
YES. (1) Mutual exclusion is maintained, as they cannot be shared if there is a writer. (2) Hold-and-wait is possible, as a thread can hold one reader—writer lock while waiting to acquire another. (3) You cannot take alock away, so no preemption is upheld. (4) A circular wait among all threads is possible.
Short Answer: Consider a system consisting of four resources of the same type that are shared by three threads, each of which needs at most two resources. Show that the system is deadlock free.
Yes, this system is deadlock-free.Proof by contradiction. Suppose the system is deadlocked. This implies that each process is holding one resource and is waiting for one more. Since there are three processes and four resources, one process must be able to obtain two resources. This process requires no more resources and, therefore it will return its resources when done.
Short Answer: The Linux kernel has a policy that a process cannot hold a spinlock while attempting to acquire a semaphore. Explain why this policy is in place.
You cannot hold a spin lock while you acquire a semaphore, because you might have to sleep while waiting for the semaphore, and you cannot sleep while holding a spin lock.
head crash
a mechanical problem involving the read-write head touching the platter
Ordering resources and requiring the resources to be acquired in order prevents the _____ _____ from occurring and therefore prevents deadlock from occurring.
circular wait
A _____ edge indicates that a process may request a _____ at some time in the future. This edge resembles a _____ edge in direction, but is represented in the graph by a _____ line.
claim, resource, request, dashed
A _____________ is the set of tracks under the read-write heads on all platters in the device.
cylinder
On media that uses constant linear velocity, the _______________.
density of bits per track is uniform
A _____ _____ is a public key digitally signed by a trusted party.
digital, certificate
A deadlocked state occurs whenever ___________.
every process in a set is waiting for an event that can only be caused by another process in the set
Short Answer: Consider the traffic deadlock depicted in Figure 7.1.a. Show that the four necessary conditions for deadlock indeed hold in this example.b. State a simple rule for avoiding deadlocks in this system.
a. The four necessary conditions for a deadlock are (1) mutual exclusion; (2) hold-and-wait; (3) no preemption; and (4) circular wait.-mutual exclusion condition holds as only one car can occupy a space in the roadway. -Hold-and-wait occurs where a car holds onto their place in the roadway while they wait to advance in the roadway. -A car cannot be removed (i.e. preempted) from its position in the roadway.- circular wait as each car is waiting for a subsequent car to advance. The circular wait condition is also easily observed from the graphic. b. A simple rule that would avoid this traffic deadlock is that a carmay not advance into an intersection if it is clear they will not be able to immediately clear the intersection. Consider the deadlock situation that could occur in the dining-philosophers problem when the philosophers obtain the chopsticks one at a time. Discuss how the four necessary conditions for deadlock indeed hold in this setting. Discuss how deadlocks could be avoided by eliminating any oneof the four conditions
Many CPU-scheduling algorithms are parameterized. For example, the RR algorithm requires a parameter to indicate the time slice. Multilevel feedback queues require parameters to define the number of queues, the scheduling algorithms for each queue, the criteria used to move processes between queues, and so on. These algorithms are thus really sets of algorithms (for example, the set of RR algorithms for all time slices, and so on). One set of algorithms may include another (for example, the FCFS algorithm is the RR algorithm with an infinite time quantum). What (if any) relation holds between the following pairs of algorithm sets? a. Priority and SJF b. Multilevel feedback queues and FCFS c. Priority and FCFS d. RR and SJ
a. The shortest job has the highest priority. b. The lowest level of MLFQ is FCFS. c. FCFS gives the highest priority to the job having been in existence the longest. d. None.
Short Answer: Compare the circular-wait scheme with the various deadlock-avoidance schemes (like the banker's algorithm) with respect to the following issues: (a) Runtime overhead (b) System throughput
a. overhead is any combination of excess or indirect computation time, memory, bandwidth, or other resources that are required to perform a specific task. It is a special case of engineering overhead. Overhead can be a deciding factor in software design, with regard to structure, error correction, and feature inclusion. Examples of computing overhead may be found in Object Oriented Programming (OOP), functional programming,[citation needed] data transfer, and data structures. b. Throughput is a measure of how many units of information a system can process in a given amount of time. It is applied broadly to systems ranging from various aspects of computer and network systems to organizations.
Deadlock ______________ requires that the operating system be given, in advance, additional information concerning which resources a process will request and use during its lifetime.
avoidance
An _____________ page table has one page entry for each real page (or frame) of memory.
inverted
Breach of Availability
involves unauthorized destruction of data
Short Answer: The traditional UNIX scheduler enforces an inverse relationship between priority numbers and priorities: the higher the number, the lower the priority. The scheduler recalculates process priorities once per second using the following function: Priority=(recentCPUusage/2)+base where base = 60 and recent CPU usage refers to a value indicating how often a process has used the CPU since priorities were last recalculated. Assume that recent CPU usage for process P1 is 40, for process P2 is 18, and for process P3 is 10. What will be the new priorities for these three processes when priorities are recalculated? Based on this information, does the traditional UNIX scheduler raise or lower the relative priority of a CPU-bound process?
https://brainly.com/question/15193173
Using the banker's algorithm, determine whether or not each of the following states is unsafe. If the state is safe, illustrate the order in which the threads may complete. Otherwise, illustrate why the state is unsafe. (a) Available = (0,3,0,1) (b) Available = (1,0,0,2)
https://gateoverflow.in/307024/galvin-edition-9-exercise-7-question-22-page-no-343
Short Answer: The program example shown in Figure 8.3.1 doesn't always lead to deadlock. Describe what role the CPU scheduler plays and how it can contribute to deadlock in this program.
https://learn.zybooks.com/zybook/SMUCS7343HankaFall2022SILBERZYVERSION/chapter/8/section/3 If thread_one is scheduled before thread_two and thread_one is able to acquire both mutex locks before thread_two is scheduled, deadlock will not occur. Deadlock can only occur if either thread_one or thread_two is able to acquire only one lock before the other thread acquires the second lock.
Short Answer: Suppose that you have coded the deadlock-avoidance safety algorithm that determines if a system is in a safe state or not, and now have been asked to implement the deadlock-detection algorithm. Can you do so by simply using the safety algorithm code and redefining Maxi = Waiting_i + Allocation_i, where Waiting_i is a vector specifying the resources for which thread i is waiting and Allocation_i is as defined in Section 8.7? Explain your answer.
https://www.os-book.com/OS8/os8j/practice-exer-dir/7-web.pdf
Prove that the safety algorithm presented in Section Banker's algorithm requires an order of m×n2 operations.
https://www.os-book.com/OS9/practice-exer-dir/7-web.pdf
Short Answer: Answer the following questions using the banker's algorithm: (a) What is the content of the matrix Need? (b) Is the system in a safe state? (c) If a request from thread T1 arrives for (0,4,2,0), can the request be granted immediately?
https://www.os-book.com/OS9/practice-exer-dir/7-web.pdf
Short Answer: Suppose that a system is in an unsafe state. Show that it is possible for the processes to complete their execution without entering a deadlock state.
https://www.os-book.com/OS9/practice-exer-dir/7-web.pdf
Short Answer: How you find the need in the bankers algorithm
https://www.youtube.com/watch?v=2V2FfP_olaA&t=134s
An address generated by a CPU is referred to as a _____________.
logical address
The most common method used by attackers to breach security is _________.
masquerading
The mapping of a logical address to a physical address is done in hardware by the __________.
memory management unit
_____ _____ _____ s used mostly for comparison with other page-replacement schemes.
optimal page replacement
seek time
the time it takes the read-write head to position over the desired cylinder
positioning time
the time it takes the read-write head to position over the desired track
rotational latency
the time it takes the read-write head, once over the desired cylinder, to access the desired track
The surface of a magnetic disk platter is divided into ___________.
tracks
Swap space management __________.
tries to provide the best throughput for the virtual memory system
SSL is commonly used for secure communication on the Internet.
true
In deadlock detection, the _____ graph is a variant of the _____ _____ graph with _____ nodes removed. It indicates a deadlock if the graph contains a _____.
wait-for, resource-allocation, resource, cycle
Windows uses a local page replacement policy _______________.
when a process exceeds its working set maximum
The _____ _____ is an approximation of a program's locality.
working set
A _____ is structured as a complete, standalone program whereas a is a _____ fragment of code embedded in a legitimate program.
worm, virus
Which of the following statements are true with respect to hashed page tables?
A common approach for handling address spaces larger than 32 bits.
Principle of Least Privilege
A design principle stating that every program and every privileged user of the system should operate using the least amount of privilege necessary to complete the job.
Protection Rings
A model of privilege separation consisting of a series of rings, with each successive ring representing greater privilege
Compartmentalization
A process for protecting each system component through the use of specific permissions and access restrictions
Short Answer: In Section No preemption, we described a situation in which we prevent deadlock by ensuring that all locks are acquired in a certain order. However, we also point out that deadlock is possible in this situation if two threads simultaneously invoke the transaction() function. Fix the transaction() function to prevent deadlocks.
Add a new lock to this function. This third lock must be acquired before the two locks associated with the accounts are acquired. The transaction() function now appears as follows: void transaction(Account from, Account to, double amount){ Semaphore lock1, lock2, lock3; wait(lock3); lock1 = getLock(from); lock2 = getLock(to); wait(lock1);wait(lock2); withdraw(from, amount); deposit(to, amount); signal(lock3); signal(lock2);signal(lock1); }
Short Answer: Distinguish between PCS and SCS scheduling.
Both process contention scope (PCS) and system contention scope (SCS) are thread scheduling. The process contention scope executes the many-to-one and many-to-many threads. On the other hand, the system contention scope executes only one-to-one threads.
Short Answer: Explain the difference between preemptive and nonpreemptive scheduling.
CPU-scheduling decisions may take place under the following four circumstances:When a process switches from the running state to the waiting state (for example, as the result of an I/0 request or an invocation of wait for the termination of one of the child processes).When a process switches from the running state to the ready state (for example, when an interrupt occurs).When a process switches from the waiting state to the ready state (for example, at completion of I/0).When a process terminates.When scheduling takes place only under circumstances 1 and 4, we say that the scheduling scheme is non-preemptive or cooperative; otherwise, it is preemptive.
_____ occurs when memory is allocated and returned to the system. As this occurs, free memory is broken up into small chunks, often too small to be useful. _____ _____ occurs when there is sufficient total free memory to satisfy a memory request, yet the memory is not contiguous, so it cannot be assigned. _____ _____ occurs when a process is assigned more memory than it has requested and the wasted memory fragment is internal to a process.
Fragmentation, external, Fragmentation, internal, fragmentation
Short Answer: Explain why a capability-based system provides greater flexibility than a ring-protection scheme in enforcing protection policies.
In a capability based system, each user-level component can access resources by providing a key. However, a ring-protection scheme works by providing different levels of access based on the ring level. The lack of flexibility in the ring-based system, is that rings cannot invoke upon any external rings. In a capability based system, resources can act upon one another as long as access is granted.
Short Answer: What advantage is there in having different time-quantum sizes on different levels of a multilevel queuing system?
Processes which need more frequent servicing, for instance interactive processes such as editors, can be in a queue with a small time quantum. Processes with no need for frequent servicing can be in a queue with a larger quantum, requiring fewer context switches to complete the processing; making more efficient use of the computer.
Audit Trail
The collection of activities in a log for monitoring or view
Short Answer: Assume val is an atomic integer in a Linux system. What is the value of val after the following operations have been completed?
The final value of val is 10 - 8 + 1 + 1 + 6 - 3 = 7
What are the two main varieties of authentication algorithms?
The first one is message-authentication code. It utilizes symmetric encryption. The second is digital signature algorithm, which utilizes a public and private key.
What role do keys play in modern cryptography?
The keys are used to ensure that the scrambled message is readable only by the intended recipients and to verify and authenticate the sender of a message.
Short Answer: How does the principle of least privilege aid in the creation of protection systems?
The principle of least privilege works by allowing just enough access for a job to get complete. Systems are protected by having a limit on the control and damage a user may have on the system.
transfer rate
The rate at which data flows.
Short Answer: Discuss the strengths and weaknesses of implementing an access matrix using capabilities that are associated with domains.
The strengths of implementing an access matrix include the smoothness of transferring capabilities form one domain to another. However, this ease can result in a lack of control that revokes and complicates the flow of these capabilities.
Defense in Depth
The theory that more layers of defense provide stronger defense layers than fewer layers
Short Answer: A CPU-scheduling algorithm determines an order for the execution of its scheduled processes. Given n processes to be scheduled on one processor, how many different schedules are possible? Give a formula in terms of n.
The total number of schedules possible (number of ways to order n distinct objects in a sequence) is n!
Short Answer: Explain why Windows and Linux implement multiple locking mechanisms. Describe the circumstances under which they use spinlocks, mutex locks, semaphores, and condition variables. In each case, explain why the mechanism is needed.
These operating systems provide different locking mechanisms depending on the application developers' needs. Spinlocks are useful for multiprocessor systems where a thread can run in a busy-loop (for a short period of time) rather than incurring the overhead of being put ina sleep queue. Mutexes are useful for locking resources. Solaris 2 uses adaptive mutexes, meaning that the mutex is implemented with a spin lock on multiprocessor machines. Semaphores and condition variables are more appropriate tools for synchronization when a resource must be held for a long period of time, since spinning is inefficient for a longduration.
___________ occurs when a process spends more time paging than executing.
Thrashing
An unsafe state may lead to a deadlocked state.
True
It is possible only if relocation is dynamic and done at execution time.
True
Short Answer: List three examples of deadlocks that are not related to a computer-system environment.
Two cars crossing a single-lane bridge from opposite directions. A person going down a ladder while another person is climbing up the ladder. Two trains traveling toward each other on the same track.
Consider the following resource-allocation policy. Requests and releases for resources are allowed at any time. If a request for resources cannot be satisfied because the resources are not available, then we check any processes that are blocked, waiting for resources. If they have the desired resources, then these resources are taken away from them and are given to the requesting process. The vector of resources for which the process is waiting is increased to include the resources that were taken away. For example, consider a system with three resource types and the vector Available initialized to (4,2,2). If process P0 asks for (2,2,1), it gets them. If P1 asks for (1,0,1), it gets them. Then, if P0 asks for (0,0,1), it is blocked (resource not available). If P2 now asks for (2,0,0), it gets the available one (1,0,0) and one that was allocated to P0 (since P0 is blocked). P0's Allocation vector goes down to (1,2,1) and its Need vector goes up to (1,0,1). a. Can deadlock occur? If you answer "yes", give an example. If you answer "no," specify which necessary condition cannot occur. b. Can indefinite blocking occur? Explain your answer.
a. Deadlock cannot occur because preemption exists. b. Yes. A process may never acquire all the resources it needs if they are continuously preempted by a series of requests such as those of process C. 7.7 Suppose that you hav
Suppose that the following processes arrive for execution at the times indicated. Each process will run for the amount of time listed. In answering the questions, use nonpreemptive scheduling, and base all decisions on the information you have at the time the decision must be made. Process Arrival Time Burst Time: P1 0.0 8 P2 0.4 4 P3 1.0 1 a. What is the average turnaround time for these processes with the FCFS scheduling algorithm? b. What is the average turnaround time for these processes with the SJF scheduling algorithm? c. The SJF algorithm is supposed to improve performance, but notice that we chose to run process P1 at time 0 because we did not know that two shorter processes would arrive soon. Compute what the average turnaround time will be if the CPU is left idle for the first 1 unit and then SJF scheduling is used. Remember that processes P1 and P2 are waiting during this idle time, so their waiting time may increase. This algorithm could be known as future-knowledge scheduling.
a. Execute in order arrived to the CPUP1 → P2 → P3 = ( 8 + (12 - 0.4) + (13 - 1)) / 3 = 10.53 b. P1 executes and then we find P3 is a shorter process than P2.P1 → P3 → P2 = ( 8 + (9 - 1) + (13 - 0.4)) / 3 = 9.53 c. Idle for 1, then use SJF. P3 shortest, P2 next shortest, P1 longest.Idle → P3 → P2 → P1 = ((2 - 1) + ( 6 - 0.4 ) + ( 14 - 0)) / 3 = 6.87
Short Answer: In a real computer system, neither the resources available nor the demands of threads for resources are consistent over long periods (months). Resources break or are replaced, new processes and threads come and go, and new resources are bought and added to the system. If deadlock is controlled by the banker's algorithm, which of the following changes can be made safely (without introducing the possibility of deadlock), and under what circumstances? a. Increase Available (new resources added). b. Decrease Available (resource permanently removed from system). Increase Max for one thread (the thread needs or wants more resources than c. allowed). d. Decrease Max for one thread (the thread decides it does not need that many resources). e. Increase the number of threads. f. Decrease the number of threads.
a. Increase Available (new resources added)—This could safely be changed without any problems. b. Decrease Available (resource permanently removed from system)—This could have an effect on the system and introduce the possibility of deadlock as the safety of the system assumed there were a certain number of available resources. c. Increase Max for one process (the process needs more resources than allowed, it may want more)—This could have an effect on the system and introduce the possibility of deadlock. d. Decrease Max for one process (the process decides it does not need that many resources)—This could safely be changed without any problems. e. Increase the number of processes—This could be allowed assuming that resources were allocated to the new process(es) such that the system does not enter an unsafe state. f. Decrease the number of processes—This could safely be changed without any problems.
Deadlock _____________ is a set of methods intended to ensure that at least one of the necessary conditions for deadlock cannot hold.
prevention