Skema Jawapan Operating System

Only available on StudyMode
  • Topic: Virtual memory, AirTrain Newark, File system
  • Pages : 6 (935 words )
  • Download(s) : 140
  • Published : April 6, 2013
Open Document
Text Preview
Answer Scheme for Test 2 Operating System 1. a) What is synchronization? (1m) - Synchronization is an act of ensuring that independent processes/threads begin to execute a designated block of code at the same time b) How does a race condition happen? (2m) - Incorrect timing in accessing same shared resource c) Explain TWO possible solutions of handling critical section?(2m) - Disabling interrupt prevents processes/threads to be in the critical section at the same logical time - Software solution : locking mechanism, semaphore, monitor d) Draw the graph reduction (with your explanation) when there is no deadlock.(4m) - R1 and R3 are reusable resource graph (RRG) whereas R1 is a consumable resource graph(CRG) Order of reduction: i) Assign R1 to p1, p1 executes and terminates. One unit of R2 and 2 units of R3 are available.

P1

P2

R3
P3

R2
P4

R1

ii) Assign a unit of R3 to P3 and another unit of R3 to P2.

P1

P2

R3
P3

R2
P4

R1

Good luck for your final examination!! –Zima167-

iii) P3 terminates and can produce more units of R2. Since P3 is the producer of R2, unit of R2 is infinity.

P1

P2

R3
P3

R2
P4

R1

iv) Now, a unit of R2 is assign to P2 and P4, so that both can terminate. Notice that two units of R2 are missing, this is because P2 and P3 consumes the resources.

P1

P2

R3
P3

R2
P4

R1

v) Lastly, all processes had received the resources needed, the graph is reducible. Thus, no deadlock.

P1

P2

R3
P3

R2
P4

R1

e) Describe TWO ways of preventing deadlock. (2m) - Preempt resource use numbering in circular wait Hold & wait (get all resources at once or release all resource before requesting) f) What is the difference between deadlock and starvation.(2m) - Endless vs indefinite waiting Good luck for your final examination!! –Zima167-

2. a) What is the difference (in terms of address) between relocatable object module and absolute program? (1m) - Relocatable object module is produce before absolute program - Relocatable object module represents one module while absolute program contains combination of other module such as library function. b) Describe the meaning of ‘cost of moving a program’ in compaction.(2m) - Recalculating address in address binding. c) Give TWO functions of memory manager.(2m) - Allocate/reallocate primary memory to process - Map process address space to primary memory. - Minimize access time using a cost effective memory optimization. d) Give TWO differences between fixed-partition and paging.(2m) - Contiguous vs non-contiguous - Fixed vs free size of program e) There are 5 processes, A,B,C,D and E ready to enter the job queue. Their sizes are 300k, 240k, 400k, 200k, and 60k respectively. The arrival time at job queue for process A is 0, B is 1, C is 2, D is 3 and E is 4. Their turnaround time is 8,4,10,6 and 5 respectively. The size of the primary memory is 1200k and the operating system takes 200k of the memory size. Show the changes of the memory content(best fit) until all jobs are completed.(5m) lukis sendiri

Good luck for your final examination!! –Zima167-

3. a) If the size of a program is 275k and a frame size is 70k, what is the size of the program in number of blocks? What is the size of fragmentation it has? Show your work. (2m) - no of block = 275/70 = 3 , baki 65 -> 4 block - size of fragmentation = 70-65 = 5k. b) What is the advantage of segmentation over paging? (1m) Easy code or data sharing with similar locality references Less segmentation/page fault

c) Why does memory manager need to reduce the number of page faults?(1m) Minimize access time

d) State the function of valid/invalid bit in a page table. (1m) To indicate whether the referenced page is (or not) currently in the primary memory.

e) Let………. LRU page fault=12 LFU page fault=9

f) Describe about Belady’s Anomaly.(2m) Against the logical expectation of performance, increase number of frame will increase the number of...
tracking img