Professional Documents
Culture Documents
Ahmad Bilal Mehmood - ANSWER SHEET
Ahmad Bilal Mehmood - ANSWER SHEET
A. For request management in AirShop which of the method do you recommends thread implementation or
process implementation? Give reason for your answer.
Answer(a)
Thread is better option because thread can handle and accep multiple requests at same time . So Basically in Air
shop thera might come multiple requests.So, Thread can handle multiple requests. So, Thread is better.
(b)
Justify which of the scheduling will be most appropriate in this scenario and why? answer in the light of
scenario.
Answer(b)
The best was pre-emptive priority scheduling algorithm. Because it have different priorities. Honour has his own
priority. Customer has different priorities. And we give different time unit to everyone. 4 to 6 unit.
Honour has higher priority. After certain unit time it switch to single customers.
(c)
Answer©:
Mutex gives mutual exclusion as buffer is occupied by consumer or produce one needs to wait at time.
Only one thread can wrote with whole buffer at one time.But for semaphore it is initialized mutex we can divide 4
kb buffer into four 1KB Buffer where all these buffers a semaphore can deal.
Qno2:
2. Consider a there are 5 process been stored on hard disk among them 1is selected to be scheduled on the CPU and
submitted in ready queue. The process size is 1030 bytes. If RAM size is (1048576 X 4) Byte. Calculate total pages
in the system and the total addressing bit of the RAM. Calculate total pages need by Process. Assess if there is any
internal fragmentation in current state of RAM allocation if yes, give reasoning argument and also calculate internal
fragmentation if there exist any .
Answer:
Number f process=5
Selectd process=1
1 process sie=1030 BYTES
Memory/RAM size=(1048576X4) bytes
HERE N is ram size
M is process size
Page size k=2 bytes
Using formula:
(M/K) *p
(1048576*4)/2
2097152
Qno3:
Apply SJF Preemptive version. Draw Gantt chart, calculate waiting time for each process also calculate the
avg wait time, competition time and turnaround time of system. Also calculate the completion time for each
process.
Answer:
QNO4:
Given the following stream of page references by an application, calculate the number of page faults the
application would incur with the following page replacement algorithms you need to apply LRU. Assume
that all pages are initially free. The system has 2 frames and after a cycle change it have 3 frame run for both
the system [10]
Reference Stream: A B C D F G H D A B C F G H I A B C D
Answer: