UNIVERSITY OF YORK
COM00021 Systems & Devices
1 (10 marks)
(i) [4 marks] Explain with an example how a Process can trigger a change in its own state by making a system call.
(ii) [6 marks] In a system designer role, you are asked to design an Operating System (OS) that provides a given set of system services. However, you are asked to consider that one or more of these services may change in the future. What is the practical OS design approach you would follow and why? Explain the pros and cons of your design.
2 (10 marks)
(i) [6 marks] You are asked to write a matrix multiplication program by creating two new threads within the program. How many total program counters, heaps and stacks will be created in user-space when you execute this program? Explain your answer.
3 (12 marks)
Consider the following set of processes, with the length of the CPU burst given in milliseconds (in Table 1):
Each process is assigned a numerical priority, with a higher number indicating a higher relative priority. The scheduler will execute the highest-priority process. For processes with the same priority, a round-robin scheduler will be used with a time quantum of 2 units. If a process is preempted by a higher-priority process, the preempted process is placed at the end of the queue.
(i) [6 marks]
(ii) [3 marks] answers.
(iii) [3 marks] answers.
Draw the Gantt chart that illustrates the scheduling order of these processes.
What is the turnaround time of each process.
What is the waiting time of each process?
4 (8 marks)
Two processes are running on two different computers connected through a communication link. What are the advantages and disadvantages of using shared memory and message passing as Interprocess communication mechanisms? Explain your reasoning.
5 (20 marks)
Suppose the following two processes, increment and decrement, are executed concurrently and share the semaphore variables Sem1 and Sem2 (each initialized to 1) and the integer variable z (initialized to 0).
(i) [6 marks] Provide an execution sequence in which one or both of these processes are blocked forever.
(ii) [6 marks] Provide an execution sequence in which one process is indefinitely postponed.
(iii) [8 marks] Provide the modified code so you can prevent blocking, indefinite postponement and livelock.
Please note: Focus on the logic and meaning of your solution. Do not worry about minor issues of C syntax as long as the meaning and structure is clear.
6 (20 marks)
(i) [10 marks] Consider the following page reference string:
7, 2, 3, 1, 2, 5, 3, 4, 6, 7, 7, 1, 0, 5, 4, 6, 2, 3, 0, 1.
Assuming demand paging with three frames, how many page faults would occur for the following replacement algorithms? Provide explanation with a sequence flow.
(A) Least Recently Used replacement (B) First In First Out replacement
(ii) [10 marks] A computer supports 32-bit long virtual address and has 256 MB of physical memory and 4 KB page and frame size. A page table entry in the page table reserves one extra byte for control bits alongside the frame number.
(A) What are the maximum number of frames and pages available for a process? Explain your reasoning.
(B) What is the maximum size of the page table in Bytes? Explain your reasoning.
咨询 Alpha 小助手,获取更多课业帮助