Final OS BS CS F2018
Final OS BS CS F2018
Question 2 (2 points): In order to copy the content of one file and write them to another file, multiple systems calls must
be executed
1. True 2. False
Question 3 (2 points): Which of the following technique uses kernel memory space to do interprocess communication
Question 4 (2 points): Which of the following type of scheduling requires the use of a special hardware to improve the
time in repeated context switching
Question 6 (2 points): Which of the following table in Linux keeps a copy of File Control Block (inode) of each opened
file in memory
Question 7 (2 points): Which of the following phenomenon can reduce the number of page faults without degrading the
performance
Question 8 (2 points): Dynamic loading and demand paging are both dynamic techniques. The difference between them
is that the former is a programmer level decision and demand paging is system-level decision.
1. True 2. False
1. True 2. False
Question 10 (2 points): The two common implementation methods of LRU page replacement algorithm are via (choose
two)
1. Stack 3. Tree
2. Counting 4. Queue
Question 11 (2 points): The two primary jobs of a memory management unit (MMU) are (choose two)
Question 12 (2 points): In Linux, the data structure that can be generally referred to as the process control block (PCB)
is called
Question 13 (5 points): On a virtual memory system we have a page size of 1 MB. If 1 byte is accessed in 1
nanoseconds, and 1 MB data is transferred from memory to the permanent storage in 1000 nanoseconds. The same
1000 nanoseconds are consumed to transfer 1 MB data from permanent storage to memory. Now calculate the time (in
nanoseconds) of accessing a single byte in worst case scenario. Also mention the time for each step.
Question 14 (5 points): According to the same scenario as above, calculate the time for the best case scenario. Mention
the time for each step and the accumulative time.
byte getByte ( int logicalAddress , int PID ) // the address to be read and the process ID are the
p a r a m e t e r s of the function .
{
Question 16 (10 points): Three processes are running in parallel sharing variables i and j, which are initialized as i = 1
and j = 1. You have to synchronize the following processes such that the output on the console is the Fibonacci series.
First few elements are as given; 1, 1, 2, 3, 5, . . .
NOTE: You can change the following code only by calling the wait and signal methods of semaphores. No other change
in the code is allowed. You should use semaphores judiciously. Also, you have to mention the initial values of all the
semaphores. You cannot add any statement which alters the values of variables i and j.
Question 17 (10 points): Get the physical byte stored in a file which exists in a file system that uses single indexed table.
Parameters are the logical address of the byte, and the file ID.
# define BLOCK_SIZE xxxx ; // tells how many bytes are there in one block
int ge t I n d e x B l oc k N u m b e r ( int fileID ) ; // takes the file ID and returns the block where index
table is stored .
int * lo ad I nd ex F ro m Bl oc k ( int blockNumber ) ; // takes the block number and loads the index table
in memory and returns its pointer .
byte * lo ad B yt es F ro m Bl oc k ( int blockNumber ) ; // takes the block number and loads raw bytes in
that block in memory , and returns its address .
Table 1: List of holes in memory as maintained by OS. Their order in the list is same as their position in the memory, and
their position in the list of holes.
Table 2: List of process with their numbers and sizes. Small number shows that the process arrived earlier. So the order
here represents order of their arrival.
• The algorithm accommodates all processes, but other algorithms do not. (1)
Process # Process Size Hole# where Process is loaded Remaining Size of the hole
1 212 KB 2 500-212 = 288 KB
2 417 KB
3 112 KB
4 421 KB
Process # Process Size Hole# where Process is loaded Remaining Size of the hole
1 212 KB 4 300-212 = 88 KB
2 417 KB
3 112 KB
4 426 KB
Process # Process Size Hole# where Process is loaded Remaining Size of the hole
1 212 KB 5 600-212 = 388 KB
2 417 KB
3 112 KB
4 426 KB