Your IP : 216.73.216.40


Current Path : /var/www/html/bibhas.ghoshal/lecture_slides/lect3/
Upload File :
Current File : /var/www/html/bibhas.ghoshal/lecture_slides/lect3/hw_lect3.tex~

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{color}
\usepackage{graphicx}
\usepackage{graphics}
%opening
\title{Home work - Set3}
%\author{}

\begin{document}

\maketitle

\textbf{\underline{This problem is set is common for both sections.}} \\

%\textcolor{red}{Section 1 is for IOPC 332C} while \textcolor{green}{Section 2 for IOSY 332C}


%\section{\underline{ Section1 : IOPS 332C }}

\begin{enumerate}
   \item Describe the differences among short-term, medium-term, and longterm
scheduling 
    
% % Ans: Short-term (CPU scheduler)—selects from jobs in memory those
% jobs that are ready to execute and allocates the CPU to them.
% • Medium-term—used especially with time-sharing systems as an
% intermediate scheduling level. A swapping scheme is implemented
% to remove partially run programs from memory and reinstate them
% later to continue where they left off.
% • Long-term (job scheduler)—determines which jobs are brought into
% memory for processing.
% The primary difference is in the frequency of their execution. The shortterm
% must select a new process quite often. Long-term is usedmuch less
% often since it handles placing jobs in the system and may wait a while
% for a job to finish before it admits another one
 \item Describe the actions taken by a kernel to context-switch between processes.
 
%  In general, the operating system must save the state of the
% currently running process and restore the state of the process scheduled
% to be run next. Saving the state of a process typically includes the
% values of all the CPU registers in addition to memory allocation. Context
% switches must also perform many architecture-specific operations,
% including flushing data and instruction caches
 
  
 \item Using the program shown in Figure 3.30 of the text book (Galvin et al.) - 8th edition (Chapter 3 - Process) , explain what will be output at
Line A.
 


\item For each of the system calls, give a condition that causes it to fail: fork,exec 

% % Fork can fail if there are no free slots left in the process table (and possibly if
% there is no memory or swap space left). Exec can fail if the file name given
% does not exist or is not a valid executable file.


\item The Fibonacci sequence is the series of numbers 0, 1, 1, 2, 3, 5, 8, .... 
Write a C program using the fork() system call that that generates the
Fibonacci sequence in the child process. The number of the sequence
will be provided in the command line. For example, if 5 is provided, the
first five numbers in the Fibonacci sequence will be output by the child
process. Because the parent and child processes have their own copies
of the data, it will be necessary for the child to output the sequence.
Have the parent invoke the wait() call to wait for the child process to
complete before exiting the program. Perform necessary error checking
to ensure that a non-negative number is passed on the command line.


\item What are the outputs of the following pseudo-code?

a. Figure1
b. Figure2
\end{enumerate}

\begin{figure}
 % \centering
  \includegraphics[width=0.85\textwidth]{ex1.pdf}
  \caption{Figure1}
\end{figure}


  
\end{document}