Question: Unix and MTX support the system calls fork ( ) , exec ( ) and wait ( ) , each returns - 1 if the
Unix and MTX support the system calls fork exec and wait each returns if the syscall fails. Assume that aout is the binary executable of the following program:
main int argc, char argv i
if fork
A: execaout again";
else
B: waitbargc;
a Starting from a process, eg P
i After fork which process executes the statement A and what does it do
ii Which process executes the statement B and what does it do
b Analyse the runtime behaviour of this program. If you think it would cause MTX to crash, think again, carefully.
Question Marks
a If a pipe has no more readers, a writer considers this as a BROKEN PIPE error and aborts. On the other hand, if a pipe has no more writers, it is not a BROKENPIPE to a reader. Explain why this is the case?
b A bidirectional pipe is a pipe that supports mathrmRmathrmW in both directions. If a process creates a pipe but does not close the RW ends of the pipe, can such a pipe be bidirectional? Explain your answer.
c Assume a free memory linked list containing the holes in memory is used to keep track of the available memory areas. Each list clement contains the beginning address and the size of a hole in memory. A syscall function knfree beginAddress size is used to release the memory area back to the free memory list after a process terminates or changes image size.
What possible cases may arise when releasing memory with kmfree and how can they be addressed?
Question Marks
Conceptually, the heap area of an execution image is in between the Data and Stack areas. This is because we would like to keep the stack at the high end of the virtual address space. In practice, the heap area can be located after the stack area, as shown below.
In this case, brk sbrk would extend the heap area towards the right. Assume that the maximal heap size is KB
a Show how to set the initial stack pointer of an image.
b When the heap is expanded by brk sbrk is it necessary to adjust the stack frame pointers in the new image? Justify your answer.
c Design and write down an algorithm for this kind of brk sbrk
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
