(a) Consider that two processes, P1 and P2, are executing concurrently. Both the processes share a standard variable named "Counter", having an initial value \( =5 \). Find the final value of Counter and update tables below: - Process P1 tries to increment the value of the counter. - Process \( \mathrm{P} 2 \) tries to decrement the value of the counter. - Update column Reg 1, Counter and Reg 2 .
ii. The execution order of the instructions may be P1, P1 without updating the counter value, P2, P2 without updating the counter value, P1, P2 . [7] (Notes: Column P1 with value 1 is produce 1 slot and column P2 with value 1 is consume 1 slot)
b) There are 2 concurrent processes wishing to enter their Critical Sections (CSi). Using Paterson's algorithm complete table below: [8]
a) A paging system with 512 pages of logical address space, a page size of \( 2^{8} \) and number of frames is 1024 . Answer the following questions (in bytes or in form \( 2^{\mathrm{n}} \) ) and show all your work. i. What is the total size of the logical address space? [2] ii. What is the total size of the physical address space? [2] iii. What is the frame size of the physical memory? [1] iv. How many frames of the physical memory in a number of the form \( 2^{\text {t}} \) ? [1] v. How many number of entry in the page table? [1] vi. What is the number of bit for the page number in logical memory address and frame number in physical memory address? [2] vii. What is the logical address (in decimal) given a physical address of \( 101000010010_{2} \). [2] b) There are 4 jobs (in order) of \( A(100 \mathrm{~KB}), B(350 \mathrm{~KB}), C(450 \mathrm{~KB}) \) and \( D(220 \mathrm{~KB}) \) need to be placed in the memory. Assume a fixed partition is used with six memory partitions of \( 200 K B, 300 K B, 125 K B, 600 K B, 450 K B \) and \( 250 K B \) (in order). i. Use the Next-fit algorithm to indicate which memory blocks are allocated to each of the four arriving jobs. Draw the memory stack and label the partition size clearly (shaded for unused). [4] ii. Does internal fragmentation occur? State the internal fragmentation total? [2]