Cooper, CoryU3 Assignment 1CS-213 1. (4pts) What is a process that can affect or be affected by other processes executing in the system? What are the two ways these types of process share data or...

1 answer below »
File attached


Cooper, CoryU3 Assignment 1CS-213 1. (4pts) What is a process that can affect or be affected by other processes executing in the system? What are the two ways these types of process share data or code? 2. (5pts) Describe a race condition? What are the general solutions to mitigate race conditions? 3. (6pts) What is the critical section? Describe how each of these provides part of the solution to the critical section problem: · Mutual Exclusion · Progress · Bounded Waiting 4. (5pts) Name and Describe the two general approaches Operating Systems use to handle critical sections? Which has possible race-condition problems? 5. (8pts) Where is the busy-wait implemented in the Peterson Solution (Ref: the code below)? What is the condition(s) that changes to end the busy-wait and ensures mutual exclusion? Where is this condition changed to continue progress? Which section(s) of code must be atomic? 6. (2pts) Is an atomic process preemptive or non-preemptive? 7. (2pts) Why is this important for the locking process for the synchronization hardware? 8. (8pts) Where is the busy-wait implemented in the Test and Set Solution (Ref: the code below)?  What is the condition(s) that changes to end the busy-wait and ensures mutual exclusion? Where is this condition changed? Which section(s) of code must be atomic? 9. (8pts) Where is the busy-wait implemented in the Compare and Swap Solution(Ref: the code below)? What is the condition(s) that changes to end the busy-wait? Where is this condition changed? Which section(s) of code must be atomic? 10. (5pts) What is the problem with busy wait for a single CPU? Which of the critical section partial solutions solve this: Mutual Exclusion, Progress, and/or Bounded Waiting? Why? 11. (8pts) Where is the spinlock implemented in the Mutex Locks Solution (Ref: the code below)? What is the condition(s) that changes to end the spinlock? Where is this condition changed? Which section(s) of code must be atomic? 12. (10pts) Where is the spinlock implemented in the Semaphore Solution (Ref: the code below)? What is the condition(s) that changes to end the spinlock? Where is this condition changed? Which section(s) of code must be atomic? Does this solution use a counting or a binary semaphore? Explain 13. (5pts) What is deadlock? What is starvation? Which of the critical section partial solutions solve this: Mutual Exclusion, Progress, and/or Bounded Waiting? Why? What is the Priority Inversion Problem? What is used to solve this problem and how does it work? 14. (8pts) Name and Describe the four Necessary Conditions for a deadlock to occur? 15. (8pts) Draw the Resource-Allocation graph to show this deadlock situation. 16. (4pts) How would you use the Deadlock Prevention solution to solve the traffic issue? 17. (4pts) How would you use the Deadlock avoidance solution to solve the traffic issue? References Silberschatz, A., Peter, B. G., & Greg, G. (n.d.). Operating System Concepts Essentials Second Edition. John
Answered 4 days AfterAug 02, 2021

Answer To: Cooper, CoryU3 Assignment 1CS-213 1. (4pts) What is a process that can affect or be affected by...

Neha answered on Aug 06 2021
141 Votes
Cooper, Cory    U3 Assignment 1    CS-213
1. (4pts) What is a process that can affect or be affected by other processes executing in the system? What are the two ways these types of process share data or code?
A cooperating process can be defined as a process which can affect, or it can be affected by other processes which are executing in the same system. These processes can either share th
e logical address space directly or allowed to share the data using messages or files. The two methods to share data is to share messages with each other or they can cooperate with each using shared data like variables, databases, memory etc.
2. (5pts) Describe a race condition? What are the general solutions to mitigate race conditions?
Arrest condition takes place then of the threads are trying to access shared variable at the same time. The first thread is reading the variable and second thread is also reading the same value from the variable. Then first and second thread will perform their operation on the value, and they will start the race to see which thread will be able to write the value last for the shared variable. This condition can be avoided by using proper thread synchronization present in critical sections.
3. (6pts) What is the critical section? Describe how each of these provides part of the solution to the critical section problem:
The critical section problem can be defined as which can be used by the processes for cooperating. Each process needs to request the permission for entering into the critical section. The section of code which will implement the request is entry section.
Solutions:
· Mutual Exclusion: If the process is executing in the critical section then no other process will be able to execute in its critical section.
· Progress: If there is no process in critical section and some process wants to enter into their critical section then only those processes which are not executing in the remainder section will be able to participate to decide which can enter in critical section next.
· Bounded Waiting: There will be bound on the number of times processes will be allowed to enter into the critical section once a process has made the request to enter into the critical section.
4. (5pts) Name and Describe the two general approaches Operating Systems use to handle critical sections? Which has possible race-condition problems?
A pre-emptive kernel will allow a process to be pre-empted when it is executing in the kernel mode. A non-pre-emptive kernel will not allow the process to run in kernel mode. A kernel mode process will execute until it is out of the kernel mode. The nonpreemptive kernels may have the problem of race condition.
5. (8pts) Where is the busy-wait implemented in the Peterson Solution (Ref: the code below)? What is the condition(s) that changes to end the busy-wait and ensures mutual exclusion? Where is this condition changed to continue progress? Which section(s) of code must be atomic?
This algorithm is used for synchronizing the two process. It use two variables. One is bool array flag with size 2 and another one is int variable. The i is used for the consumer and j shows producer. The flags are set as false initially. When the process is executing critical section, it will set flag to true and turn it as index of another process. This means that process which want to execute but it will allow the other process to execute first. The process is able to perform busy waiting until the other process has finished its critical section. After this the current process will enter into critical section and either remove or add random number present in shared buffer.
6. (2pts) Is an atomic process preemptive or non-preemptive?
Atomic process is preemptive.
7. (2pts) Why is this important for the locking process for the synchronization hardware?
The solution says that before entering into the...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here