Question
this are the hints they gave me, but I still dont understand how to desipher this problem: 1. A shared memory has to be maintained
this are the hints they gave me, but I still dont understand how to desipher this problem:
1. A shared memory has to be maintained by the parent process, and protected by one semaphore. Only one process can enter and modify the shared memory at a time.
2.. A virtual clock (counter) has to be maintained in the shared memory and modified each time a process gets into the shared memory.
3. After requests made by the child processes, the parent process will determine which child process to be granted to execute next based on SJF(tie breaking case: EDF)/LLF(tie breaking case: EDF).
4. Calculate() and useresource() are essentially sleep() as this is a simulation.
Both the deadlock-handling process and the processes requesting resources are real Unix/Linux processes created using fork(). However, you do not need to actually allocate any resource. The main process executes the Banker's algorithm. You are required to use shared memory controlled by Unix/Linux semaphores to synchronize the resource-requesting processes and the deadlock-handling process. This allows the resource-requesting processes to make requests to the deadlock-handling process. The deadlock-handling process chooses the next process with a resource request having the shortest remaining execution time (Shortest Job First - SJF) to be serviced. Ties are broken in favor of the process with the nearest absolute deadline (Earliest Deadline First EDF). After having one request serviced, a process has to allow another process to make a request before making another one, that is, another process with the shortest remaining execution time is chosen for service. A process can also release resources during its execution, and releases all resources held when it terminates Associated with each process is also a relative deadline (that is, the deadline from the current time instant). One time unit is needed for servicing each request (whether the resource is allocated or not), so the relative deadline for each process is decreased by 1 whether it is serviced or not. If the resource is allocated for a request, then the computation time of this process decreases by 1 otherwise, the computation time remains the same. If a process misses its deadline, keep servicing its requests but indicate the deadline miss in the output. A release" instruction also needs 1 unit of computation time just like a request A "calculate" instruction does not use resources and its computation time is indicated in paren- theses. A "useresources" instruction simulates the use of allocated resources and its computation time is indicated in parentheses Both the deadlock-handling process and the processes requesting resources are real Unix/Linux processes created using fork(). However, you do not need to actually allocate any resource. The main process executes the Banker's algorithm. You are required to use shared memory controlled by Unix/Linux semaphores to synchronize the resource-requesting processes and the deadlock-handling process. This allows the resource-requesting processes to make requests to the deadlock-handling process. The deadlock-handling process chooses the next process with a resource request having the shortest remaining execution time (Shortest Job First - SJF) to be serviced. Ties are broken in favor of the process with the nearest absolute deadline (Earliest Deadline First EDF). After having one request serviced, a process has to allow another process to make a request before making another one, that is, another process with the shortest remaining execution time is chosen for service. A process can also release resources during its execution, and releases all resources held when it terminates Associated with each process is also a relative deadline (that is, the deadline from the current time instant). One time unit is needed for servicing each request (whether the resource is allocated or not), so the relative deadline for each process is decreased by 1 whether it is serviced or not. If the resource is allocated for a request, then the computation time of this process decreases by 1 otherwise, the computation time remains the same. If a process misses its deadline, keep servicing its requests but indicate the deadline miss in the output. A release" instruction also needs 1 unit of computation time just like a request A "calculate" instruction does not use resources and its computation time is indicated in paren- theses. A "useresources" instruction simulates the use of allocated resources and its computation time is indicated in parentheses
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