Busy. Please wait.
or

show password
Forgot Password?

Don't have an account?  Sign up 
or

Username is available taken
show password

why


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
We do not share your email address with others. It is only used to allow you to reset your password. For details read our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.

Remove ads
Don't know
Know
remaining cards
Save
0:01
To flip the current card, click it or press the Spacebar key.  To move the current card to one of the three colored boxes, click on the box.  You may also press the UP ARROW key to move the card to the "Know" box, the DOWN ARROW key to move the card to the "Don't know" box, or the RIGHT ARROW key to move the card to the Remaining box.  You may also click on the card displayed in any of the three boxes to bring that card back to the center.

Pass complete!

"Know" box contains:
Time elapsed:
Retries:
restart all cards




share
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

0. Word Problems

Operating Systems: Word Problems

ProblemSolution
What are the two main functions of an operating system? (1) providing users with a virtual machine; (2) managing I/O devices and system resources
What is multiprogramming? Rapid CPU switching between multiple memory processes
Give three benefits of multiprogramming. (1) it keeps the CPU busy while processes perform I/O; (2) it allows multiple users to use the same computer simultaneously; (3) it allows users to start up multiple processes at the same time
Why was timesharing not widespread on second generation computers? Because they did not contain the hardware needed to protect operating systems from malicious user programs.
What is input spooling? The act of reading jobs onto the disk so there will be work for the CPU after executing current processes
What is output spooling? The act of copying files onto the disk before printing them instead of printing directly.
Do you think that advanced personal computers will have spooling as a standard feature in the future? Output spooling is likely, but input spooling isn't since jobs are normally created on the disk
On early computers, every byte of data read or written was handled by the CPU. What implications does this have for multiprogramming? It "ruins" multiprogramming since the CPU cannot work on processes if one is performing I/O
Should "Disable all interrupts." be allowed only in kernel mode? Yes
Should "Read the time-of-day clock." be allowed only in kernel mode? No
Should "Set the time-of-day clock." be allowed only in kernel mode? Yes
Should "Change the memory map." be allowed only in kernel mode? Yes
Give a condition that will cause the fork system call to fail. There are no free slots in the process table.
Give a condition that will cause the exec system call to fail. The file name given does not exist.
Give a condition that will cause the unlink system call to fail. The file to be unlinked does not exist.
The client-server model is popular in distributed systems. Can it also be used in single-computer system? Yes, especially when the kernel is a message passing system.
Give another use of the client-server model ( other than a single-computer system). Splitting programs into a more flexible system.
Is a process state transition from blocked->running possible? Yes; technically the transition goes from blocked to ready to running, but it can be interpreted as a blocked to running transition.
Is a process state transition from ready->blocked possible? No; a process needs to run before it can perform I/O.
What is the key difference between a trap and an interrupt? A trap is caused by the program in reproducible time; an interrupt is caused by an external event.
How long will it take for two jobs to complete if they run sequentially with 50% I/O wait? 40 minutes ((10+10) + (10+10))
How long will it take for two jobs to complete if they run parallel with 50% I/O wait? 26.67 minutes; CPU utilization is 1 - 0.5^2 = .375; each job then runs for 10/.375 minutes -> 26.67 minutes.
Why would a thread ever voluntarily give up the CPU by calling thread_yield? After all, since there is no periodic clock interrupt, it may never get back the CPU? Threads in a process cooperate, therefore if yielding is needed for the good of the application, then a thread will yield.
Can a thread ever be preempted by a clock interrupt. If so, under what circumstances? If not, why not. Kernel-level threads can be preempted; user-level threads are not preemptable, but the kernel-level thread running this thread can be.
What is the biggest advantage of implementing threads in user space? No OS modification is needed.
What is the biggest disadvantage of implementing threads in user space? When a blocking system call or a page fault occurs, all the threads in the process are blocked.
Can a situation where a high-priority process and low-priority process result in the high-priority process looping forever occur with round-robin scheduling? No; at some point, the low-priority process will run. With round robin, all processes get an equal amount of time.
In a system, the average process runs for time (T) before blocking on I/O. A process switch requires overhead time (S). For round-robin scheduling with quantum (Q), give a formula for the CPU efficiency for: Q=∞. CPU efficiency is the useful time divided by the total CPU time; the CPU efficiency formula is T/(S+T).
In a system, the average process runs for time (T) before blocking on I/O. A process switch requires overhead time (S). For round-robin scheduling with quantum (Q), give a formula for the CPU efficiency for: Q>T. CPU efficiency is the useful time divided by the total CPU time; the CPU efficiency formula is T/(S+T).
In a system, the average process runs for time (T) before blocking on I/O. A process switch requires overhead time (S). For round-robin scheduling with quantum (Q), give a formula for the CPU efficiency for: S<Q<T. CPU efficiency is the useful time divided by the total CPU time; the CPU efficiency formula is T/(T+ST/Q) --> Q/(Q+S).
In a system, the average process runs for time (T) before blocking on I/O. A process switch requires overhead time (S). For round-robin scheduling with quantum (Q), give a formula for the CPU efficiency for: Q=S. CPU efficiency is the useful time divided by the total CPU time; the CPU efficiency formula is T/(Q+T)
In a system, the average process runs for time (T) before blocking on I/O. A process switch requires overhead time (S). For round-robin scheduling with quantum (Q), give a formula for the CPU efficiency for: Q approaching 0. CPU efficiency is the useful time divided by the total CPU time; as Q approaches 0, efficiency approaches 0.
Round-robin schedulers normally maintain a list of all runnable processes, with each process occurring exactly once in the list. What would happen if a process occurred in the list? If a process occurs multiple times in the list, it will get multiple quanta per cycle.
Round-robin schedulers normally maintain a list of all runnable processes, with each process occurring exactly once in the list. Can you think of any reason for allowing this? This approach could be used to give more important processes a larger share of the CPU.
Give an argument favoring a large quantum. A large quantum is more efficient than a small one, since fewer process switches take place.
Give an argument favoring a small quantum. Interactive response time reviews, since the average case delay until a process gets to run is reduced.
If a process needed T sec to complete in the absence of competition, how much time would it need if processor sharing was used with n processes? nT sec.
Five jobs are waiting to be run. Their expected run times are 9, 6, 3, 5, and X. In what order should they be run in order to minimize average response time? (Your answer will depend on X.) Shortest Job First is the way to minimize average response time. [0 < x <= 3 : x, 3, 5, 6, 9]. [3 < x <= 5 : 3, x, 5, 6, 9]. [5 < x <= 6 : 3, 5, x, 6, 9]. [6 < x <= 9 : 3, 5, 6, x, 9]. [9 < x : 3, 5, 6, 9, x].
Five jobs A through E arrive at computer at the same time. The have run times [10, 6, 2, 4, 8]. Their priorities are [3, 5, 2, 1, 4] with 5 highest priority. For round-robin scheduling, determine the mean process turnaround time. In first 10min each job gets 1/5 of CPU. After 10min, C finishes. In next 8min, each job gets 1/4 of CPU, after which D finishes. Then remaining jobs get 1/3 of CPU for 6min, etc.. The finishing times are 10, 18, 24, 28, and 30, (avg. 22min).
Five jobs A through E arrive at computer at the same time. The have run times [10, 6, 2, 4, 8]. Their priorities are [3, 5, 2, 1, 4] with 5 highest priority. For priority scheduling, determine the mean process turnaround time. B is run first. After 6 minutes it is finished. The other jobs finish at 14, 24, 26, and 30, for an average of 20 minutes.
Five jobs A through E arrive at computer at the same time. The have run times [10, 6, 2, 4, 8]. Their priorities are [3, 5, 2, 1, 4] with 5 highest priority. For FCFS scheduling, determine the mean process turnaround time. They finish at 10, 16, 18, 22, and 30, for an average of 19.2 minutes.
Five jobs A through E arrive at computer at the same time. The have run times [10, 6, 2, 4, 8]. Their priorities are [3, 5, 2, 1, 4] with 5 highest priority. For shortest-job-first scheduling, determine the mean process turnaround time. Shortest job first yields finishing times of 2, 6, 12, 20, and 30, for and average of 14 minutes.
What is busy waiting? The act of constantly using the CPU to test a condition in a tight loop.
What is blocking process synchronization? The act of giving up the CPU, to be awakened later when a condition it is waiting for becomes true.
In the solution to the dining philosophers problem, why is the state variable set to HUNGRY in the procedure take_forks? If a philosopher blocks, neighbors can later see that he is hungry by checking his state, in test, so he can be awakened when the forks are available.
Consider the procedure put_forks. Suppose that the variable state[i] was set to THINKING after the two calls to test, rather than before. How would this change affect the solution? The change would mean that after a philosopher J stopped eating, neither of his or her neighbors could be chosen if they were hungry. The reason is that when J tests to see if his right or left neighbor can eat, the test will find J still eating.
Do illegal graphs exist, that is, graphs that structurally violate the model we have used of resource usage? If so, give an example of one. Yes illegal graphs exist; any graph in which multiple arcs leave a square and end in different circles violates the rules
Consider Figure 6-4. Suppose that in step (o) C requested S instead of requesting R. Would this lead to deadlock? Suppose that it requested both S and R. Neither change leads to deadlock. There is no circular wait in either case.
All the trajectories in Figure 6-8 are horizontal or vertical. Is is possible for a trajectory to be a diagonal. If the system had two or more CPUs, two or more processes could run in parallel, leading to diagonal trajectories.
Can the resource trajectory scheme of Fig. 6-8 also be used to illustrate the problem of deadlocks with three processes and three resources? If so, how can this be done? If not, why not? Yes. Do the whole thing in three dimensions. The z-axis measures the number of instructions executed by the third process.
In theory, resource trajectory graphs could be used to avoid deadlocks. By clever scheduling, the operating system could avoid unsafe regions. Is there a practical way of actually doing this? The method can only be used to guide the scheduling if the exact instant at which a resource is going to be claimed is known in advance. In practice, this is rarely the case.
Take a careful look at Fig. 6-11(b). If D asks for one more unit, does this lead to a safe state or an unsafe one? What if the request came from C instead of D? Satisfying a request from D is unsafe, but satisfying one from C is safe.
A mailbox system has 2 IPC primitives, send & receive. Latter specifies process to receive, blocks if no message available, even if messages may be waiting from processes. No shared resources, but processes need to communicate. Is deadlock possible? Yes. Suppose all the mailboxes are empty. Now A sends to B and waits for a reply, B sends to C and waits for a reply, and C sends to A and waits for a reply. All the conditions for deadlock are now fulfilled.
Couple divorcing. Each sends letter requesting item. If same item requested, request cancelled. Separation between pets and houses are invalid, requiring do-over. Both want item. CPUs still negotiating. Why? Is deadlock possible? Is starvation possible? If both programs ask for Woofer first, the computers will livelock; if one of them asks for the doghouse and the other asks for the dog, we have a deadlock. Regardless, either livelock or deadlock occurs.
Draw the process state diagram from the notes --
Shortest Job First and Preemptive Shortest First have a very favorable property. What is it? They minimize average turnaround/response time.
Why is Shortest Job First/Preemptive Shortest First impractical for general purpose operating systems? General purpose systems do not know in advance how long the process will run before blocking/terminating.
Even if they were practical, Shortest Job First/Preemptive Shortest First also have an unfavorable property that would make them unsuitable purpose systems. What is it? They can easily starve processes with long burst times.
What would you add to Shortest Job First/Preemptive Shortest First scheduling algorithms to alleviate the problem of long processes being starved? Some form of priority aging.
Some arcs change the number of processes in the system. Which arcs are these and what system calls do they correspond to. Create (fork()) and terminate (exit()).
Define, but do NOT solve the Readers Writers problem. There are two process classes: readers (can cooperate) and writers (need exclusive access). You must be able to prevent concurrency for the following: writer/writer, and reader/writer.
Some systems simply treat the readers writers problems as critical section problems and hence the implementation simply use P and V. What requirement of the Readers Writers problem does this implementation not satisfy? It does not allow readers to be concurrent, even if there is no writer.
Draw a resource allocation graph that represents a deadlock state. --
Of course when execution started there were no arcs in the resource allocation graph. Give a scenario starting from this initial condition of no arcs and ending in the graph you gave for 4A. [resource: 1,2,3,4,5,6]; [P: request 3 units of R, granted, , , request 1 unit of S, ], [Q: , , request 3 units of S, granted, , request 1 unit of R]
Recall that the Banker's algorithm for resource allocation never enters a deadlocked state like the one in part A. Consider the scenario you gave for part B and tell at what point the Banker's algorithm will depart from the scenario. In line 4, the manager grants Q's request for 3 units of S.
Explain in detail why the Banker's algorithm refused to grant the request you noted in part C. The banker pretends to grant the request and checks if the resulting state is safe. At this points, all units have been allocated, so the banker cannot guarantee all processes will complete or terminate.
Draw a reusable resource graph that represents an UHsafe state that is NOT deadlocked. --
Process A is written, requests the printer, the plotter, the tape drive, and the robotic arm, in that order. Develop B and C. Both need the printer and the arm, B needs the tape drive, and C needs the plotter. What order should the requests be made? Why. B: printer, tape, arm. C: printer, plotter, arm. This way, all processes request the resources in order.
When a linker converts a relative address to the corresponding absolute address, we say it is ____________ the relative address. relocating
A program in execution is called ____________. a process
The processor scheduling algorithm resulting in the smallest average waiting time is ____________. shortest job first
A directed graph with processes represented as circles, resources represented as squares, and requests and allocations represented as arcs is called ____________. a reusable resource graph
The Banker's algorithm ensures that the system is always in ____________ a safe state
Created by: JJFresh814