Question: Question 3 This question is about Processes, Memory management & Scheduling. (a) The program shown below is compiled and run on a UNIX machine. Predict

 Question 3 This question is about Processes, Memory management & Scheduling.
(a) The program shown below is compiled and run on a UNIX

Question 3 This question is about Processes, Memory management & Scheduling. (a) The program shown below is compiled and run on a UNIX machine. Predict all possible outputs that this program will print to the console and explain your answer. 1 #include 2 #include 3 #include 4 #include Cunistd.h> 5 int main() { 6 int x - 1; 7 pidt pid - fork(); 8 if (pid - 0) { 9 X-X. 2: 10 } else if (pid > 0) { 11 wait (NULL); 12 13 ) 14 printf("%d ",x); 15 ) (4 marks] (b) Schedule the processes (given in Table 1) using round robin scheduling with quantum 10. Also, calculate the total turnaround time. [5 marks] PO Table 1. Process table ID Arrival Time Duration 3 20 P1 15 22 P2 0 32 P3 5 3 P4 49 29 (c) What are the physical memory addresses for each of the following logical addresses for the segment table (Table 2)? Note any that are invalid. The logical addresses are: 03.15 (6) 0.512 (i) 1, 4096 (iv) 0.1 [4 marks] Table 2: Segment table Segment Base Address Length 0 16384 400 1 4096 4096 2 32768 810 3 20480 1024 (d) Consider a system with four frames of memory, and the following sequence of page accesses: 0,1.2.3.4.2.3.0.1.4.2. When do page faults occur using FIFO and LRU replacement algorithms? Briefly justify your answer. [4 marks] (e) Consider a demand-paged computer system which was recently measured to deter- mine the utilisation of CPU and the paging disk to decide the degree of multipro- gramming. The results are shown in the figure below. Explain what is happening in each scenario and what actions an operating system can take. Scenario 1 Scenario 2 Scenario 3 0 80 20 40 60 *CPU utilisation Disk utilisation 100 [3 marks]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!