Operating Systems (H) - 2017 Exam

Section A

Assume three (3) processes (Process 1, 2, and 3), which share access to two semaphores U and V, as follows:

In each process, all commands are sequentially executed. Processes start their execution, request access to their critical section controlled by the acquire() method, and leave their critical section with the release() method. The method print('x') prints to the standard output (e.g., display/monitor) the character 'x'. The 'goto L' command transfers the control of the process execution to the command attached to the label 'L:'. Note: It is assumed that all the processes run (are scheduled) as often as possible; i.e. the semaphores are the only constraints on process execution.

1. How many characters 'C' are going to be printed?

2. How many characters 'D' are going to be printed?

3. Which is the minimum number of characters 'A' that will be printed?

4. Is the sequence of the characters: 'CABABDDCABCABD' possible to be printed (with exactly this order)?

Now consider the following cooperating processes A and B that share the (common) variable X:

The initial value of X is 5 (X=5;) before any process execution. The commands within each process are executed sequentially.

5. How many different values can the variable X get after the execution of both processes? Select one of the following:

Let us modify both programs by adding a semaphore S, which is initialized to 1 (S=1;), and X is initially 5 (X=5;). That is:

6. How many different values can the variable X get after the execution of both processes? Select one of the following:

Let us modify again the initial programs by adopting a semaphore T, which is initialized to 0 (T=0;), and X is initially 5 (X=5;). That is:

7. How many different values can the variable X get after the execution of both processes? Select one of the following:

Assume there are processes P and Q with the semaphores s and t, both initialized to 1 (s=1; t=1). Which of the following sequences of the commands P1, ..., P8, Q1, ..., Q5, leads those processes to a deadlock state, if any?

8. Select one of the following:

Section B

Imagine a system with an 8-bit byte-addressable physical address space.

9. How many bytes of memory will there be?

10. For this system, consider using a virtual addressing scheme with single-level paging. If each page contains 16 bytes, how many pages will there be?

11. In the worst case, what happens to memory access latency in a virtual addressing environments with a single-level page table, with respect to physical addressing?

12. What could be done to mitigate this worst-case memory access latency?

13. What is the purpose of the NX bit in the page table protection metadata?

Look at the following memory configuration, based on an 8-bit byte-addressable virtual address space with single- level paging. In each 8-bit virtual address, the most significant byte refers to the page number and the least significant byte refers to the offset within the page.

Consider the following low-level C memory copy operations, involving the routine

void memcpy(void *dst, void *src, size_t n)

which copies n bytes from address src to address dst. With reference to the above page table, answer the questions below.

14. To which frame(s) does memcpy(0x10, 0x02, 4) write data?

15. To which frame(s) does memcpy(0x10, 0x00, 32) write data?

16. To which frame(s) does memcpy(0x30, 0x00, 1) write data?

17. To which frame(s) does memcpy(0x20, 0x30, 16) write data?

18. In practice, why is it unlikely that 8-bit memory would feature a virtual addressing scheme?

Section C

19. Which of the following concepts is not used in the File Allocation Table (FAT) storage system?

20. Suppose a disk has X clusters. How many bits will be required for a cluster address in FAT directory entries?

21. Why are FAT filesystems restricted to fixed length filename extensions of three characters?

22. What happens if a file is too large to fit into one cluster in a FAT file system?

23. On a FAT-formatted disk, suppose every file is N bytes in size, but the cluster size is M bytes, where M > N. What is the proportion of wasted disk space in the limit, due to internal fragmentation?

24. Which of the following is a genuine status for a FAT data cluster, indicated by the file allocation table?

25. Why is it efficient to locate a large file in contiguous disk clusters?

26. What is the advantage of having a duplicate file allocation table for the file system?

27. Which of the following is an advantage of Unix inodes over the FAT structure?

28. Why aren’t read-only filesystems like data CDs formatted using FAT?