Final 22
Final 22
3 10 CLO3
4 10 CLO4
5 10 CLO2
6 10 CLO3
7 5 CLO4, CLO5
3. On a system that has a single CPU, which of the following scenarios may cause the ready queue to
be empty?
a. All processes are I/O bound.
b. All processes are CPU bound.
c. 50% of the processes are CPU bound. The remaining processes are I/O bound.
d. Both a and b
6. The time it takes for a process to begin executing for the first time is known as:
a. turnaround time
b. waiting time
c. dispatch latency
d. response time
10. In ordinary pipes, communication between parent and child is possible because:
a. the pipe’s buffer is part of address space of both child and parent
b. child inherits parent’s file descriptor table
c. the data is read from and written to a file present on hard disk.
d. none of these
Question 2: Give short and precise answers to following questions: [15 marks]
2. What is the difference between short-term scheduler (CPU-scheduler) and long-term scheduler (job
scheduler)? Which one of these two schedulers runs more often? [2 + 1= 3 marks]
a. Short term scheduler selects one of the processes from the ready queue for execution.
b. Long term scheduler decides which process to remove from the memory (and hence from
the ready queue) to limit the number of processes that are executing concurrently.
Short term scheduler runs more often.
4. What is task parallelism? What is data parallelism? Give one example of both. [1+1+1+1=4 marks]
Task parallelism involves distributing task (threads) across multiple computing cores. Each thread is
performing a unique operation. Different threads may be operating on the same data, or they may be
operating on different data.
Data parallelism focuses on distributing subsets of the same data across multiple computing cores and
performing the same operation (but on a different subset of data) on each core.
Example of Task parallelism: performing addition, subtraction and multiplication (on same data or on
different data).
Example of Data Parallelism: Search on first half of the array and on the second half of the array using
two threads.
5. Suppose we have an operating system that has two versions of mutex implementation. One
implementation allows busy wait whilst the other implementation does not allow busy wait, i.e., the
process that could not acquire the lock is put to sleep until the other process releases the lock. Now
Under what circumstance, is it desirable to use the version of mutex that allows busy wait? [2
marks]
Mutex with busy wait is desirable in the case if the other process will use the critical section for a very
short time.
Question 3: Consider the following processes, their arrival and CPU burst times. [5 + 5= 10 marks]
Process Arrival Time CPU Burst Time
P1 0 9
P2 1 7
P3 2 4
Question 4: Suppose that a machine has 48-bit virtual address and 32-bit physical address, and the
memory is byte-addressable, i.e., each byte can be accessed individually using its physical address. The
size of a page is 4KB, i.e. 4*1024 bytes. Now calculate the following: [10 marks]
2. Number of bits required for the physical page (also called frame) offset. [2 marks]
Same as page offset.
6. The size of physical memory in MBs. Assume 1KB=1024B and 1MB=1024KB. [1 mark]
2^32= 4294967296B =4194304KB= 4096MB
Question 5: There is an executable program named “sort.out” that, whenever executed, asks a list of
numbers from the user via the keyboard. The executable program then sorts the list and prints the
numbers in sorted order. Your task is to write another program that calls the executable program
sort.out in such a way that sort.out gets the list of numbers from a file nums.txt rather than from the
user via keyboard. Also, after sorting, the sort.out program will print the numbers to another file
sorted_nums.txt rather than on screen. After sort.out has finished execution, your program will print
“Task Completed!”. Write the program using C/C++ syntax. There is no need to write code to include the
required libraries. [10 marks]
wait(w); wait(m);
noOfWomen--; noOfMen--;
if (noOfWomen==0) if (noOfMen==0)
signal(entry); signal(entry);
signal(w); signal(m);
2 3 1 4 3 5 1 2 1 4
Assume there are only three frames in the RAM. Show contents of memory frames after each page
access from the reference string. (Please note that the number of boxes below maybe less or more
depending upon the question. It certainly does not mean you have to utilize exactly the given number of
boxes.)
2 2 2 4 4 4 4 4 4 4
3 3 3 3 5 5 2 2 2
1 1 1 1 1 1 1 1