You are on page 1of 12

VASAVI COLLEGE OF ENGINEERING (AUTONOMOUS)

IBRAHIMBAGH, HYDERABAD-31
Department of Computer Science and Engineering
Name of the Course: Operating Systems
Assignment – 1

Name of the Faculty: Dr. M. Sunitha Reddy Date of submission: 19/4/2023


Class: B.E 2nd year CSE Time: 12:40 to 1:20
Section: B
Sem: IV
Academic Year: 2022-23

Set -1 (1602-21-733-096,102,121,100,084,090,076,073,119,128)
Q. No. Description of the question Marks BTL Mapped
(1/2/3/4/5/6) CO PO
Add a new system call which helps applications to know
1 schedule of a given process. This task requires to understand 1 3 1 1,2,3
system call invocation mechanism as well as steps of compil-
ing and installing Linux kernel. Submit the Executable code
with proper documentation.
Original versions of Apple’s mobile iOS operating system 2 3 1 1,2,3
provided no means of concurrent processing. Discuss three
2
major complications that concurrent processing adds to an
operating system
Consider the 7-state transition diagram. Suppose that it is 1 3 1 1,2,3
time for the OS to dispatch a process and there are processes
in both the Ready state and the Suspend-Ready state, and that
at least one process in the Suspend Ready state has higher
scheduling priority than any of the processes in the Ready
3 state. Two extreme policies are as follows: 1. Always dis-
patch from a process in the Ready state, to minimize swap-
ping and 2. Always give preference to highest-priority pro-
cess, even though that may mean swapping when swapping
is not necessary. Suggest an intermediate policy that tries to
balance the concerns of priority and performance.

Consider a multilevel feedback scheduling policy with five 1 3 1 1,2,3


priority queue levels. Each of these priority queues uses the
4 round robin scheduling policy with a time quantum of 3
units, and the maximum execution time at each priority level
is two quantum (or 6 units). All jobs needing the CPU begin
at the highest priority level and then move down the priority
levels as the time using the CPU grows. The CPU is allocat-
ed to the highest priority job.

a. Does this scheduling policy work well for CPU


bound processes? Explain.
b. Is this scheduling algorithm good for I/O bound
processes? Explain
c. Is starvation possible? If yes, how might you
modify the policy to avoid starvation?

Set-2 (1602-21-733-068,69,70,71,72,74, 308)


Q. Description of the question Mark BTL Mapped
No. s (1/2/3/4/5/6) CO PO
In a seven state process state diagram, suppose we want 1 3 1 1,2,3
1 our system to have two states: the normal READY state
and the SYSTEM READY state. Processes in the SYS-
TEM READY state have the highest priority in the sys-
tem and execute in a round robin fashion; the CPU
scheduling algorithm gives priority to processes in this
state and these system processes are never swapped.
Draw the resulting process state transition diagram, and
label each transition.

A variation of the round-robin scheduler is the regressive 2 3 1 1,2,3


round-robin scheduler. This scheduler assigns each pro-
cess a time quantum and a priority. The initial value of a
time quantum is 50 milliseconds. However, every time a
process has been allocated the CPU and uses its entire
time quantum (does not block for I/O), 10 milliseconds is
added to its time quantum, and its priority level is boost-
2 ed. (The time quantum for a process can be increased to a
maximum of 100 milliseconds.) When a process blocks
before using its entire time quantum, its time quantum is
reduced by 5 milliseconds, but its priority remains the
same. What type of process (CPU-bound or I/O-bound)
does the regressive round-robin scheduler favour? Ex-
plain.

A student have written a program and used pid = fork() 1 3 1 1,2,3


function call in it. The pid returned by the fork was 5119.
Which of the following is true about the process invoking
3
fork? Justify your answer.

a. Process is a parent process with pid = 5119


b. Process is a child process. Its Parent's pid is 5119

c. The process is a parent process. Its Child's pid is


5119

d. Process is a child process with pid = 5119

Given a system using the SJF algorithm for short term 1 3 1 1,2,3
scheduling and exponential averaging with α=0.5, what
4 would be next-expected burst time for a process with
burst times of 5,8,3 and 5 and an initial value of T1=10?

Set-3 (1602-21-733-075,77,78, 79,80,81,309)


Q. No. Description of the question Marks BTL Mapped
(1/2/3/4/5/6) CO PO
A uni-processor computer system only has two processes,
1 both of which alternate 10 ms CPU bursts with 90 ms I/O 1 3 1 1,2
bursts. Both the processes were created at nearly the same
time. The I/O of both processes can proceed in parallel.
Which of the following scheduling strategies will result in
the least CPU utilization (over a long period of time) for this
system? And Explain why?
(a) First come first served scheduling
(b) Shortest remaining time first scheduling
(c) Static priority scheduling with different priorities for the
two processes
(d) Round robin scheduling with a time quantum of 5 ms

If we have no indication of the length of various processes, 2 3 1 1,2,3


2 then which scheduling algorithm can we use?

The Sun UltraSPARC processor has multiple register sets. 1 3 1 1,2,3


Describe what happens when a context switch occurs if the
3 new context is already loaded into one of the register sets.
What happens if the new context is in memory rather than in
a register set and all the register sets are in use?
If the quantum time of round robin algorithm is very large, 1 3 1 1,2,3
4 then it is equivalent to which scheduling algorithm and ex-
plain it with an example?

Set-4 (1602-21-733-082,83,86,87,88,89,310)
Q. No. Description of the question Marks BTL Mapped
(1/2/3/4/5 CO PO
/6)
Suppose that the following processes arrive for exe- 1 3 1 1,2
cution at the times indicated. Each process will run
for the amount of time listed. In answering the ques-
tions, use nonpreemptive scheduling, and base all
decisions on the information you have at the time
the decision must be made.
Process Arrival Time Burst Time
P1 0.0 8
P2 0.4 4
P3 1.0 1
a. What is the average turnaround time for these
processes with the FCFS scheduling algorithm?
1
b. What is the average turnaround time for these
processes with the SJF scheduling algorithm?
c. The SJF algorithm is supposed to improve per-
formance, but notice that we chose to run process P1
at time 0 because we did not know CPU Scheduling
that two shorter processes would arrive soon. Com-
pute what the average turnaround time will be if the
CPU is left idle for the first 1 unit and then SJF
scheduling is used. Remember that processes P1 and
P2 are waiting during this idle time, so their waiting
time may increase. This algorithm could be known
as future-knowledge scheduling.
What is the output of the following program for any 1 3 1 1,2
value of a

int main()
{
int a, pid;

pid = fork();
if(pid == 0)
{
a=a+5;
2
printf("u = %d\n",a);

}
else
{
a=a-5;
printf("x = %d\n",a);
}

An OS contains 10 identical processes, which were 1 3 1 1,2,3


initiated at the same time. Each process contains 15
identical requests, and each request consumes
20msec of CPU time. A request is followed by an
I/O operation which consumes 10msec. The system
3
consumes 2msec in CPU scheduling. For time quan-
tum of 20msec, the response time of the first request
of the last process is?

Determine why user mode and kernel mode consid- 2 3 1 1,2


ered good operating system design? Give an exam-
4 ple that illustrates a user process being switched
from user mode to kernel mode, and then back to
user mode.

Set-5 (1602-21-733-091,92,93,94,95,97,311)
Q. Description of the question Marks BTL Mapped
No. (1/2/3/4/5/6) CO PO
Estimate the largest possible value of context switch 2 3 1 1,2
time an OS can support in order for multiprogram-
1 ming to be useful. Justify your estimate.

wait() system call inside the parent process returns 1 2 1 1,2,3


the status of the child. What does it returns when it is
2 called inside the child?

Consider three CPU-intensive processes, which re- 1 3 1 1,2,3


quire 10, 20 and 30 time units and arrive at times 0, 2
and 6, respectively. How many context switches are
3 needed if the operating system implements a shortest
remaining time first scheduling algorithm? Do not
count the context switches at time zero and at the end.

Suppose a computer has A input/output devices and B 1 3 1 1,2,3


processors. Further suppose that main memory is only
large enough to hold C processes at any given time.
You can assume that A<B<C , if needed

a. Determine the maximum number of pro-


cesses that can be in each of the Ready,
4 Running, Blocked, Suspend-Ready and
Suspend-Blocked states at one time?
b. Determine the minimum number of pro-
cesses that can be in each of the Ready,
Running, Blocked, Suspend-Ready and
Suspend-Blocked states at one time?

Set-6 (1602-21-733-098,99,101,103,104,105,312)

Q. No. Description of the question Marks BTL Mapped


(1/2/3/4/5/6) CO PO
What are the priorities of the processes to execute 1 3 1 1,2
which are in one of the process states below

P: Process in wait state


1 Q: Process in suspend-wait state
R: Process in suspend-ready state
S: Process in ready state
Suppose a computer has A input/output devices and 1 2 1 1,2
B processors. Further suppose that main memory is
only large enough to hold C processes at any given
time. You can assume that A<B<C , if needed

a. Determine the maximum number of pro-


cesses that can be in each of the Ready,
2 Running, Blocked, Suspend-Ready and
Suspend-Blocked states at one time?
b. Determine the minimum number of pro-
cesses that can be in each of the Ready,
Running, Blocked, Suspend-Ready and
Suspend-Blocked states at one time?

execlp() system call replaces the child process with 1 3 1 1,2,3


a new program file, but the process ID will not
change. State whether it is true or false and justify
3
your answer.

Consider the 3 processes, P1, P2 and P3 shown in 2 3 1 1,2,3


the table

----------------------------------------------

Process Arrival time Time unit required

----------------------------------------------

P1 0 5
4
P2 1 7

P3 3 4

----------------------------------------------

The completion order of the 3 processes under the


policies FCFS and RRS (round robin scheduling
with CPU quantum of 2 time units) are

Set-7(1602-21-733-106,107,108,109,110,111,313)

Q. No. Description of the question Marks BTL Mapped


(1/2/3/4/5/6) CO PO

1 Write correct order of the following statements 2 3 1 1,2


while running a program.
(1) Read byte by byte from memory

(2) Graphics card displays string on the monitor

(3) printf(“%s”,str)

(4) Device driver takes care of setting attributes.

Which resources are used when a thread is created? 1 3 1 1,2


Determine how they differ from those used when a
2 process is created?

Consider a multiprocessor system and a multithread- 1 3 1 1,2,3


ed program written using the many-to-many thread-
ing model. Let the number of user-level threads in
the program be more than the number of processors
in the system. Discuss the performance implications
of the following scenarios.

a. The number of kernel threads allocated to


the program is less than the number of pro-
cessors.
3
b. The number of kernel threads allocated to
the program is equal to the number of pro-
cessors.

c. The number of kernel threads allocated to


the program is greater than the number of
processors but less than the number of user
level threads.

A process executes the code 1 3 1 1,2,3

fork();
4 fork();
what is the total number of child processes
created?Justify.
Set-8 (1602-21-733-112,113,114,115,116,117,314)
Q. No. Description of the question Marks BTL Mapped
(1/2/3/4/5/6) CO PO
Determine the scheduling policy is most suitable for 1 3 1 1,2,3
time sharing operating systems? Justify your answer
1 with an example.

The time taken to switch between user and kernel 1 3 1 1,2


modes of execution is t1, while the time taken to
2 switch between two processes is t2. Explain the rela-
tion between t1 and t2.

Which one of the following is false? Justify your 1 3 1 1,2,3


answer
a. Monolithic Kernel has direct communication
3 with all the modules
b. Monolithic Kernel is faster than microkernel.
c. Microkernel is faster than monolithic kernels
d. Monolithic Kernel is more crashable com-
pared to microkernel
Calculate the average waiting time for the following 2 3 1 1,2
processes using Round Robin scheduling algorithm
with time quantum= 2ms

Processes Burst Time Arrival Time


4
P1 5 5

P2 10 8

P3 8 9

P4 4 0
Set-9 (1602-21-733-118,120,122,123,124,125,315)
Q. Description of the question Mark BTL Mapped
No. s (1/2/3/4/5/6) CO PO
Once the operating system decides, for whatever reason, 1 3 1 1,2,3
1 to create a new process, it proceeds the steps:

a. Initialize the Process Control Block


b. Set the appropriate linkages
c. Create or expand other data structures
d. Allocate space for the process
e. Assign a unique process identifier to the
new process.
What is the order?

Which of the following is false? Justify your answer. 2 3 1 1,2,3

a. Process : Contains
code+data+heap+stack+process state

2 b. Program : One program can be used to create


many processes

c. Process : Process is not a unique isolated entity

d. Program : Code + Static and Global data

Most scheduling algorithms maintain a run queue, which 1 3 1 1,2,3


lists processes eligible to run on a processor. On multi-
core systems, there are two general options: (1) each pro-
cessing core has its own run queue, or (2) a single run
3
queue is shared by all processing cores.

What are the advantages and disadvantages of each of


these approaches?

Explain the role of the init process on UNIX and Linux 1 3 1 1,2,3
4 systems in regard to process termination.

Set-10 (1602-21-733-126,127,129,130,131,132,133,134)
Q. Description of the question Mark BTL Mapped
No. s (1/2/3/4/5/6) CO PO
Many CPU-scheduling algorithms are parameterized. For 1 3 1 1,2,3
example, the RR algorithm requires a parameter to indi-
1
cate the time slice. Multilevel feedback queues require
parameters to define the number of queues, the schedul-
ing algorithms for each queue, the criteria used to move
processes between queues, and so on. These algorithms
are thus really sets of algorithms (for example, the set of
RR algorithms for all time slices, and so on). One set of
algorithms may include another (for example, the FCFS
algorithm is the RR algorithm with an infinite time quan-
tum). What (if any) relation holds between the following
pairs of algorithm sets? a. Priority and SJF b. Multilevel
feedback queues and FCFS c. Priority and FCFS d. RR
and SJF
Suppose that a scheduling algorithm (at the level of short- 2 3 1 1,2,3
term CPU scheduling) favors those processes that have
2 used the least processor time in the recent past. Why will
this algorithm favor I/O-bound programs and yet not
permanently starve CPU-bound programs?
The traditional UNIX scheduler enforces an inverse rela- 1 3 1 1,2,3
tionship between priority numbers and priorities: the
higher the number, the lower the priority. The scheduler
recalculates process priorities once per second using the
following function: Priority = (recent CPU usage / 2) +
base where base = 60 and recent CPU usage refers to a
value indicating how often a process has used the CPU
3
since priorities were last recalculated. Assume that recent
CPU usage for process P1 is 40, for process P2 is 18, and
for process P3 is 10. What will be the new priorities for
these three processes when priorities are recalculated?
Based on this information, does the traditional UNIX
scheduler raise or lower the relative priority of a CPU-
bound process?
Suppose that the following processes arrive for execution 1 3 1 1,2,3
at the times indicated. Each process will run for the
amount of time listed. In answering the questions, use
nonpreemptive scheduling, and base all decisions on the
4 information you have at the time the decision must be
made.
Process Arrival Time Burst Time
P1 0.0 10
P2 0.4 4
P3 1.0 2
a. What is the average turnaround time for these process-
es with the FCFS scheduling algorithm?
b. What is the average turnaround time for these process-
es with the SJF scheduling algorithm?
c. The SJF algorithm is supposed to improve perfor-
mance, but notice that we chose to run process P1 at time
0 because we did not know CPU Scheduling that two
shorter processes would arrive soon. Compute what the
average turnaround time will be if the CPU is left idle for
the first 1 unit and then SJF scheduling is used. Remem-
ber that processes P1 and P2 are waiting during this idle
time, so their waiting time may increase. This algorithm
could be known as future-knowledge scheduling.

You might also like