Nt1310 Unit 1 Question Paper

Words: 353
Pages: 2

Suryamani Singh
Homework 5

Answer 1:
1. The OS must be able to keep track of the various processes.
2. The OS must allocate and deallocate various resources for each active process.
3. The OS must protect the data and physical resources of each process against unintended interference by other processes.
4. The functioning of a process, and the output it produces, must be independent of the speed at which its execution is carried out relative to the speed of other concurrent processes.

Answer 2: semWait and semSignal
Answer 3:
Set semaphones to 2. Both processes enter wait and its decremented to 0 and suspended form critical section. Second process enters wait, decrements to -1 and suspended before it execute wait.
From condition where s is 0 so that process in critical section. Since one process is lost so there is one process in critical section. Process 2 executes Signal(), increment to 1, so it will not wake up process 3.
…show more content…
Suppose r1,r2 are reading at the same time, so the count is 2. Imagine a scenario where whenever r1,r2 read together, the first to finish (and decrements the counter to 1) immediately requests reading again (so the counter is back to 2). This way the counter will never reach 0 and the writer will be starved (stuck waiting).

Answer 5:

Peterson algorithm concurrent programming algorithm for mutual exclusion, which allows multiple processes to share a single use resource without conflict. It uses shared memory for communication. Whereas Dekker’s algorithm provides for modern operation systems which get uses when there is absence of mutual exclusion primitives.

Answer 6:
Sunnys-MacBook-Pro:~ SunnyD$ vm_stat
Mach Virtual Memory Statistics: (page size of 4096 bytes)
Pages free: 249828.
Pages active: 592685.
Pages inactive: