Question
1. Describe the difference between a process and a thread (2 points). 2. Which of the following components of program are shared across threads in
1. Describe the difference between a process and a thread (2 points).
2. Which of the following components of program are shared across threads in a multithreaded process Select all that apply. (1 points)?
a. Register valuesb. Heap memoryc. Global variablesd. Stack memory
3. What is a busy waiting? What is an alternative to busy waiting ?(2 points) 4. What is the distinction between the critical section and the critical data?(2 points)5. Describe the difference between a monitor and a semaphore (2 points).
COP4610 HW2 2
6. A file is to be shared among different processes, each of which has a unique id number and a priority levelnumber. The file can be accessed simultaneously by several processes, subject to the following constraint:The process priority number must be greater than or equal to the priority numbers all of the other processesthat are currently accessing the file. Using pseudocode (see below), write a monitor to coordinate access to the file. (6 points)
7. There are three cooperating processes. They all read data from the same input device. Each process, when itgets the input device, must read two consecutive data, only one process may access the input device at a time(Hint: use mutual exclusion to achieve it). Use semaphores to synchronize. Include declaration and initialization.(SEE example on BB and Video on ) (8 points)
P1: input (x1, x2) P2: input (y1, y2) P3: input (z1, z2)C = y1 + z1 B = x1 + z2 + A A = y2 x2 ` Print D D = B + C
8. Consider the following snapshot of a system(6 points)R1 has 8 instances, R2 has 10 instances, and R3 has 7 instances Allocation Max Need Available
Is the system in a safe state? If yes, list an ordered sequence of processes. Show all work.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started