| Current Path : /var/www/html/bibhas.ghoshal/OS_2019/ |
| Current File : /var/www/html/bibhas.ghoshal/OS_2019/quiz-2.tex.backup |
\documentclass[11pt,a4paper]{article}
\usepackage[left=0.7in,right=0.8in,top=0.6in,bottom=0.67in,nohead]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{fancyvrb}
\newcommand{\fonttitle}{\fontsize{14}{16}\selectfont}
\newif\ifanswers
\answerstrue % comment out to hide answers
\begin{document}
\begin{center}
\fonttitle \textbf{Indian Institute of Information Technology Allahabad}
\end{center}
\begin{center}
\vspace{-0.1in} \textbf{Quiz-2 (Nov. 2018)} \\ \textit{Third semester B.Tech (IT): Section A \& B} \vspace{0.3cm}
\noindent
\begin{tabular}{|l|p{1in}|p{1.2in}|p{0.35in}|l|}
\hline
\textbf{Course Name} & \textbf{Course Code} & \textbf{Date of Exam} & \textbf{MM} & \textbf{Time} \\ \hline
Operating Systems & IOPS332C & Nov. 20, 2018 & 20 & 1 Hrs \\ \hline
\end{tabular}
\end{center}
\textit{\\ \hspace{-0.3in} \noindent \textbf{Important Instructions}: All questions are compulsory. Answer all questions in strict order as is given in the question paper. }
\begin{enumerate}
\item \textbf{(1 x 5 = 5 marks)} Answer True/False and briefly justify your answer: %\textbf{(\textit{Note for marking: no partial marking})}:
\begin{enumerate}
\item A smaller page size leads to smaller page tables. \ifanswers \textbf{F} \fi
\item Seek time is time for a disk to rotate to the desired sector. \ifanswers \textbf{F} \fi
\item The Least Recently Used (LRU) page replacement strategy is based on the principle of spatial locality (locality in space) as opposed to temporal locality (locality in time) \ifanswers \textbf{F} \fi
\item Contiguous allocation of files leads to both internal and external disk fragmentation.\ifanswers
\textbf{T}
\fi
\item Swap space exists in primary memory.\ifanswers
\textbf{F}
\fi
\end{enumerate}
\item \textbf{(1 x 10 = 10 marks)} Answer the following with a brief discussion. Every question can have multiple correct choices. %\textbf{(\textit{Note for marking: Give \textbf{0.5} marks if selected choice is correct and give full marks if correct explanation is provided.})}
\begin{enumerate}
\item What is the mounting of file system?
\begin{verbatim}
a) creating of a filesystem
b) deleting a filesystem
c) attaching portion of the file system into a directory structure
d) removing portion of the file system into a directory structure
\end{verbatim}
\ifanswers
\textbf{Solution:} \textbf{(c)}
\fi
\item Which table contains the information about each mounted volume?
\begin{verbatim}
a) mount table
b) system-wide open-file table
c) per-process open-file table
d) all of the mentioned
\end{verbatim}
\ifanswers
\textbf{Solution:} \textbf{(b)}
\fi
%\item To create a new file, application program calls?
%\begin{verbatim}
%a) basic file system
%b) logical file system
%c) file-organisation module
%d) none of the mentioned
%\end{verbatim}
%
%\ifanswers
%\textbf{Solution:} \textbf{(iv)}
%
%\fi
%\item The data structure used for file directory is called
%\begin{verbatim}
%a) mount table b) hash table c) file table d) process table
%\end{verbatim}
%
%\ifanswers
%\textbf{Solution:} \textbf{(iv)}
%
%\fi
\item In UNIX, the open system call returns :
\begin{verbatim}
a) pointer to the entry in the open file table
b) pointer to the entry in the system wide table
c) a file to the process calling it
d) none of the mentioned
\end{verbatim}
\ifanswers
\textbf{Solution:} \textbf{(a)}
\fi
\item The directory can be viewed as a \verb|___________| that translates file names into their directory entries.
\begin{verbatim}
a) symbol table b) partition c) swap space d) cache
\end{verbatim}
\ifanswers
\textbf{Solution:} \textbf{(a)}
\fi
\item In indexed allocation :
\begin{verbatim}
a) each file must occupy a set of contiguous blocks on the disk
b) each file is a linked list of disk blocks
c) all the pointers to scattered blocks are placed together in one location
d) none of the mentioned
\end{verbatim}
\ifanswers
\textbf{Solution:} \textbf{(c)}
\fi
\item \verb|______| controller sends the command placed into it, via messages to the \verb|_____| controller.
\begin{verbatim}
a) host, host b) disk, disk c) host, disk d) disk, host
\end{verbatim}
\ifanswers
\textbf{Solution:} \textbf{(c)}
\fi
\item Consider the following page reference string : 1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6. For LRU page replacement algorithm with 5 frames, the number of page faults is :
\begin{verbatim}
a) 10 b) 14 c) 8 d) 11
\end{verbatim}
\ifanswers
\textbf{Solution:} \textbf{(d)}
\fi
\item A process is thrashing if :
\begin{verbatim}
a) it spends a lot of time executing, rather than paging
b) it spends a lot of time paging, than executing
c) it has no memory allocated to it
d) none of the mentioned
\end{verbatim}
\ifanswers
\textbf{Solution:} \textbf{(d)}
\fi
\item Memory management technique in which system stores and retrieves data from secondary storage for use in main memory is called
\begin{verbatim}
a) fragmentation b) paging
c) mapping d) none of the mentioned
\end{verbatim}
\ifanswers
\textbf{Solution:} \textbf{(d)}
\fi
\item The page table contains
\begin{verbatim}
a) base address of each page in physical memory
b) page offset
c) page size
d) none of the mentioned
\end{verbatim}
\ifanswers
\textbf{Solution:} \textbf{(a)}
\fi
%\item Swap space exists in
%\begin{verbatim}
%a) primary memory
%b) secondary memory
%c) cpu
%d) none of the mentioned
%\end{verbatim}
%
%\ifanswers
%\textbf{Solution:} \textbf{(iv)}
%\fi
\end{enumerate}
\item \textbf{(5 marks)} A computer system has a 36-bit virtual address space with a page size of 8K, and 4 bytes per page table entry. Answer the following.
\begin{enumerate}
\item How many pages are in the virtual address space?
\item What is the maximum size of addressable physical memory in this system?
\item If the average process size is 8GB, compute the average size of page table for one-level, and two-level paging? Which is a better choice?
\end{enumerate}
\ifanswers
\textbf{Solution:}
\begin{Verbatim}[frame=single]
(i) A 36 bit address can address 2^36 bytes in a byte addressable machine.
Since the size of a page 8K bytes (2^13), the number of addressable pages
= 2^36 / >2^13 = 2^23
(ii) With 4 byte entries in the page table we can reference 2^32 pages.
Since each page is 2^13 B long, the maximum addressable physical memory
size = 2^32 * 2^13 = 2^45 B
(assuming no protection bits are used).
(iii) We need to analyze memory and time requirements of paging schemes
in order to make a decision.
Average process size is considered
in the calculations below.
1 Level Paging
Since we have 2^23 pages in each virtual address space,
and we use 4 bytes per page table entry,
the size of the page table will be
2^23 * 2^2 = 2^25. This is 1/256 of the
process' own memory space, so it is quite costly. (32 MB)
2 Level Paging
The address would be divided up as 12 | 11 | 13 since we want page table pages
to fit into one page and we also want to divide the bits roughly equally.
Since the process' size is 8GB = 2^33 B, we assume what this means is that the
total size of all the distinct pages that the process accesses is 2^33 B.
Hence, this process accesses 2^33 / 2^13 = 2^20 pages.
The bottom level of the page table then holds 2^20 references.
We know the size of each bottom level chunk of the page table is 2^11 entries.
So we need 2^20 / 2^11 = 2^9 of those bottom level chunks.
The total size of the page table is then:
//size of the outer page table //total size of the inner pages
1 * 2^12 * 4 + 2^9 * 2^11 * 4= 2^20 * ( 2^-6 + 4) ~4MB
\end{Verbatim}
\fi
\item \textbf{(5 marks)} Consider a very simple file system for a tiny disk. Each sector on the disk holds 2 integers, and all data blocks, indirect blocks, and inodes are 1 disk sector in size (each contains 2 integers). All files stored on disk are interpreted as directories by the file system (there are no ``data files''). The file system defines the layout for the following data types on disk:
\begin{itemize}
\item inode = 1 pointer to a data block + 1 pointer to indirect block
\item indirect block = 2 pointers to data blocks
\item directory = a regular file containing zero or more pairs of integers; the first integer of each pair is a file name and the second is the file's inumber
\item The value ``99'' signifies a null pointer when referring to a disk block address or directory name. An empty directory has one disk block with the contents ``99 99''. The inumber for root directory is ``/'' is 0.
\end{itemize}
The following data are stored on disk: inode array and disk blocks. Answer the following.
\begin{enumerate}
\item How many entries can appear in a maximum-sized directory? (Each entry is a pair of integers)
\item List all directories stored on this disk (full path names) along with the names of the files stored in each directory.
\end{enumerate}
\ifanswers
\textbf{Solution:}
\begin{Verbatim}[frame=single]
(i) 3 ( one data block and two other data blocks
pointed by the one indirect block)
(ii)
dir path name inumber indirectblocks datablocks subdir
/ 0 6 10 1 /32,/57
/32 3 n/a 8 n/a
/57 6 n/a 3 /57/96
/57/96 1 n/a 7 n/a
\end{Verbatim}
\fi
\end{enumerate}
\end{document}