0% found this document useful (0 votes)
314 views29 pages

CS604 Mid Term Past Papers Mega File

The document contains a quiz on operating system concepts with multiple choice questions. It covers topics like CPU scheduling, process states, memory management, file systems, and inter-process communication.

Uploaded by

Khadija Hassan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
314 views29 pages

CS604 Mid Term Past Papers Mega File

The document contains a quiz on operating system concepts with multiple choice questions. It covers topics like CPU scheduling, process states, memory management, file systems, and inter-process communication.

Uploaded by

Khadija Hassan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

FOR MORE PAPERS, GO TO VUINSIDER.

COM

CS604 Mid Term

__________ integer shows the highest priority of a process in CPU scheduling.

1. small
2. Large

The process of switching from one process to another is called latency.

1. True
2. False

Batch programs are usually __________ programs.

1. interactive
2. Non-interactive
3. Fore ground
4. Preemptive

___________ is used in real time operating systems.

1. Non-preemptive scheduling
2. Preemptive scheduling
3. Dispatching scheduling
4. FCFS scheduling

Page 1 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

The procedure “The time at which the process finished working MINUS the
arrival time of the process MINUS CPU burst for that process” will help calculate
the _________.

1. Non-preemptive Shortest Job First scheduling


2. Preemptive Shortest Job First scheduling.
3. FCFS
4. RR Scheduling

The priorities of processes in the __________ group remain fixed.

1. Kernel
2. User

_____________ is a preemptive scheduling algorithm.

1. First Come First Serve


2. Shortest Job First
3. Round Robin
4. None of these

_______________ scheduling algorithm can be preemptive or non-preemptive.

1. First Come First Serve


Page 2 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

2. Shortest Job First


3. Round Robin
4. Priority

Cooperating processes never share any data, code, memory or state.

1. True
2. False

Whenprocess opens its first file explicitly it will get descriptor number ______

 1
 2
 3
 4

Taking the CPU from one process and giving the CPU to another process is
termed as

1. Context switching
2. Dispatching
3. Swapping
4. Tracking

Page 3 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

The correct command for compiling C program named program.c in Linux


environment is

1. gcc program.c –o FirstPrgram


2. gcc –o FirstProgram program.c
3. gcc –z FirstProgram program.c
4. gcc program.c –m FirstPrgram

In Unix/ Linux, by default the standard output file is attached to the_________

1. File
2. Screen
3. Printer
4. Scanner

The priority of a process can be changed using __________ command.

1. nice
2. cmd
3. cat
4. grep

Page 4 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

___________ is the basis of queuing theory which is branch of mathematics


used to analyze systems involving queues and servers.

1. Little’s Formula
2. Deterministic Modeling
3. Queuing Theory
4. Queuing analysis

In Unix/ Linux, by default the standard output file is attached to the ___________

1. File
2. Screen
3. Printer
4. Scanner

___________ is a solution to the problem of indefinite blockage of low-priority


processes.

1. Starvation
2. Deadlock
3. Aging
4. None of the these

Page 5 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

_____ system call is used to write to a file or FIFO or any other IPC channel.

1. read
2. write
3. open
4. fork

____________ scheduling allows a process to move between queues.

1. Round Robin
2. First Come First Serve
3. Multilevel Feedback Queue
4. Shortest Remaining Time First

The hardware mechanism that enables a device to notify CPU is called an —

1. Interrupt
2. Signal
3. Trap
4. Process

You can display the contents (names of files and directories) of a directory in
UNIX/Linux directory structure with the ————— command.

Page 6 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

1. ll
2. s
3. ls
4. none of the given options

The ————– system call suspends the calling process.

1. fork
2. wait
3. exec
4. exit

In ———addressing, the recipient is not required to name the sender.

1. Symmetric
2. Asymmetric
3. Both symmetric and asymmetric
4. None of the given options

——– command gives a snapshot of the current processes.

1. ps
2. top

Page 7 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

3. who
4. ls

————–command to resume the execution of a suspended job in the


foreground

1. fg
2. bg
3. jobs
4. kill

You can use the ————- command to display the status of suspended and
background processes

1. fg
2. bg
3. jobs
4. kill

You can terminate a foreground process by pressing ————–

1. <Ctrl-A>
2. <Ctrl-C>

Page 8 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

3. <Ctrl-Z>
4. None of the given options

A time sharing system is

1. Multi tasking
2. Interactive
3. All of these
4. Multi user

scheduler selects the process from the job pool and put them in main
memory.

1. Long term
2. Short term
3. Medium term
4. Swapper

In indirect inter process communication, a sender mention the name of the


recipient.

1. do
2. do not

Page 9 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

A is an integer variable that, apart from initialization is accessible


only through two standard atomic operations: wait and signal.

1. Semaphore
2. Monitor
3. Critical region
4. Critical section

The execution of critical sections must NOT be mutually exclusive

1. True
2. False

The performance of Round Robin algorithm does NOT depends heavily on the
size of the time quantum.

1. True
2. False

The following requirement for solving critical section problem is known


as _. “There exists a bound on the number of times that other processes
are allowed to enter their critical sections after a process has made a request to
enter its critical section and before that request is granted.”

Page 10 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

1. Progress
2. Bounded Waiting
3. Mutual Exclusion
4. Critical Region

The critical section problem can be solved by the following except

1. Software based solution


2. Firmware based solution
3. Operating system based solution
4. Hardware based solution

_ is also called Swapper.

1. Swap space
2. Medium term scheduler
3. Short term scheduler
4. Long term scheduler

I MB or 1 megabyte is equivalent to—

1. 1024 bytes
2. 10242 bytes (may be this)

Page 11 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

3. 10243 bytes
4. 1000000 bytes

The bottom layer in the layered approach of Operating System is———–

1. User interface
2. Hardware
3. Kernel
4. None of the given options

————has a hierarchical file system structure.

1. DOS
2. Windows
3. UNIX
4. None of the given options

You can use the ———command in UNIX to create a directory.

1. rmdir
2. mkdir
3. cp
4. gcc

Page 12 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

Files that start with a ——– in UNIX/Linux directory structure are known as
hidden files.

1. . (dot)
2. # ( hash )
3. / (slash)
4. ~ (tilt)

The creating process is called a————— process while the new processes are
called the ————– of that process

1. None of the given options


2. Children, parent
3. Parent, children
4. Zombie, single

————buffer places no practical limit on the size of the buffer

1. Bounded
2. Unbounded
3. Both Unbounded & bounded
4. None of the given options

Page 13 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

The ———— are used for communication between related or unrelated


processes on the same system or unrelated processes on different systems.

1. Pipes
2. BSD Sockets
3. Named pipe (FIFO)
4. None of the given options

A —————is an abstract key for accessing a file.

1. File descriptor
2. Input Redirection
3. Output Redirection
4. FIFO

——– command gives a snapshot of the current processes.

1. ps
2. top
3. who
4. ls

Page 14 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

You can display all of the signals supported by your system, along with their
numbers, by using the ———–command

1. <Ctrl-A>
2. Fg
3. jobs
4. kill -l

Questions:
QNo.1 List and define the different metrics by which might evaluate a
scheduler (List at least 4). 5 marks

Answer:-

When evaluating a scheduler’s performance, utilization and Throughput are


traded off for better Response Time. Response time is important for OS’s that aim
to be user-friendly.

List of Schedulers include:

First-Come, First-Served (FCFS)

Round-Robin (RR)

Page 15 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

Shortest-Job-First (SJF)

Priority Scheduling (PS)

REF :: handouts Page No. 80

QNo.2 Write brief the multilevel feedback queue scheduling. 5 marks

Answer:-

Multilevel feedback queue scheduling allows a process to move between queues.


The idea is to separate processes with different CPU burst characteristics. If a
process uses too much CPU time, it will be moved to a lower-priority queue. This
scheme leaves I/O bound and interactive processes in the higher-priority queues.
Similarly a process that waits too long in a lower-priority queue may be moved o a
higher priority queue. This form of aging prevents starvation.

In general, a multi-level feedback queue scheduler is defined by the following


parameters:

Number of queues

Scheduling algorithm for each queue

Method used to determine when to upgrade a process to higher priority queue

Page 16 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

Method used to determine when to demote a process

Method used to determine which queue a process enters when it needs service

REF :: handouts Page No. 89

Qno.3 Assumption made while formulating a solution to the critical


section problem. 2 marks

Answer:-

A solution to the critical section problem must satisfy the following three
requirements:

Assumptions made While formulating a solution, we must keep the following


assumptions in mind:

Assume that each process executes at a nonzero speed

No assumption can be made regarding the relative speeds of the N processes.

REF :: handouts Page No. 98

Qno.4 There are many commands. Write the method through which these
commands can communicate with each other. 3 marks
Page 17 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

Answer:-

There are many commands some of these are given below:-

Command Name $ pw

Details

You can display the absolute pathname of your working directory with the pwd
command

Syntax

/home/students/nadeem/courses/cs604/programs

Command Name cp

Details

You can use the cp command for copying files. You can use the cp file1

file2 command to copy file1 to file2.

Syntax

cp ~/file1 ~/memos/file2

Page 18 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

Command Name mv

Details

You can use the mv command for moving files. You can use the mv file1

file2 command to move file1 to file2.

Syntax

$ mv ~/file1 ~/memos/file2

Command Name rm

Details

You can use the rm command to remove files. You can use the rm file1

command to remove file1

Syntax

$ rm ~/courses/cs604/programs/test.c $ For single file

rm *.o For all files

REF :: handouts Page No. 27

Page 19 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

Qno.5 Write Difference between SJF and Shortest Remaining Time First
Scheduling algorithm. 3 marks

Answer:

Shorted Job First (SJF) Scheduling Shortest Remaining Time First


Scheduling
For long term scheduling in a batch Whenever a new job comes in,
system, we can use as the length the check the remaining service time on
process time limit that a user the
specifies when he submits the job current job.
Preemptive SJF scheduling is For all but the longest jobs, SRT
sometimes called shortest- better than SJF
remaining-time-first scheduling.
The response ratio is good (Fast) The response ratio is good (low)
Waiting time is fast Waiting time is also quite low for
most processes
REF :: handouts Page No. 82

Qno6. Write the formula/ procedure for calculating the waiting time
in preemptive Shortest Job First scheduling

Page 20 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

Answer:-

Preemptive SJF scheduling is sometimes called shortest-remaining-time-first


scheduling.

We illustrate the working of the SJF algorithm by using the following system state.

Process Arrival Time Burst Time

P1 0.0 7

P2 2.0 4

P3 4.0 1

P4 5.0 4

REF :: handouts Page No. 83

Qno7. Define race condition and how prevent this condition. 2 marks

Answer:-

A situation like this, where several processes access and manipulate the same
data concurrently and the outcome of the manipulation depends on the particular
order in which the access takes place, is called a race condition
Page 21 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

REF :: handouts Page No. 97

Qno.8 What is Convoy Effect?


Answer:-

When FCFS scheduling algorithm is used, the convoy effect occurs when short

Processes wait behind a long process to use the CPU and enter the ready queue in
a Convoy after completing their I/O.

REF :: handouts Page No. 82

Qno.9 What are the common data structures in Bakery Algorithm?


Answer:-

The bakery algorithm is due to Leslie Lamport and is based on a scheduling


algorithm commonly used in bakeries, ice-cream stores.

REF :: handouts Page No. 103

Qno.10 How a pipe can be created?


Answer:-

Page 22 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

The pipe() system call creates a pipe and returns two file descriptors, one for
reading and second for writing,

REF :: handouts Page No. 103

Qno.11 Difference between “progress” and “ bounded time: in


critical section
Answer:-

Process:-

If no process is executing in its critical section and some processes wish to enter
their critical sections, then only those processes that are not executing in their
remainder section can participate in the decision on which will enter its critical
section next, and this selection cannot be postponed indefinitely.

Bounded Waiting:-

There exists a bound on the number of times that other processes are allowed to
enter their critical sections after a process has made a request to enter its critical
section and before that request is granted.

REF :: handouts Page No. 99


Page 23 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

Qno.12 What is Starvation and how it occures


Answer:-

Starvation:-

A process that is ready to run but lacking the CPU can be considered blocked-
waiting for the CPU.

How it occur:-

If a deadlock occurs, it can be resolved if one car backs up (preempt resources


and rollback). Several cars may have to be backed up if a deadlock occurs.
Starvation is
possible.

REF :: handouts Page No. 129

Qno.13 What are the advantages of Round Robin Scheduling Algorithm?


Answer:-

If time slice is too short then you will have freq switching btw processes

if time slice is too long then you will have less switching btw processes and high
priority may have to wait for low priority tasks leading to starvation
Page 24 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

The average waiting time under the RR policy however is often quite long.

The CPU scheduler goes around the ready queue, allocating the CPU to each
process for a time interval of up to 1 time quantum

The process may have a CPU burst of less than 1 time quantum, in which case the
process itself will release the CPU voluntarily.

It is the most simple scheduling algorithm

It is easy to implement in software

If the processes are of varied length then it becomes slow.

REF :: handouts Page No. 86

Qno.14 Analyze the following algorithm to solve the critical section


problem and explain whether it satisfies the Mutual Exclusion Characteristic

Flag[i] = True;
Turn = j;
do{
while(Flag[j] = True && turn==j);
critical section
Flag[i] = False;
Page 25 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

remainder section
} While(1)

Answer:-

To enter its critical section, Pi sets flag[i] to true, and sets ‘turn’ to j, asserting that
if the other process wishes to enter its critical section, it may do so. If both try to
enter at the same time, they will attempt to set ‘turn’ to i and j. However, only
one of these assignments will last, the other will occur but be overwritten
instantly. Hence, the eventual value of ‘turn’ will decide which process gets to
enter its critical section.

To prove mutual exclusion, note that Pi enters its critical section only if either

flag[j]=false or turn=i. Also, if both processes were executing in their critical


sections at
the same time, then flag[0]= = flag[1]= = true. These two observations suggest
that P0 and
P1 could not have found both conditions in the while statement true at the same
time, since the value of ‘turn’ can either be 0 or 1. Hence only one process say P0
must-have successfully exited the while statement. Hence mutual exclusion is
preserved.To prove bounded wait and progress requirements, we note that a

Page 26 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

process Pi can be prevented the critical section only if it is stuck in the while loop
with the condition flag[j]= =true and turn=j. If Pj is not ready to enter the critical
section, then flag[j]=flase and Pi can enter its critical section. If Pj has set
flag[j]=true and is also executing its while statement then either turn=i or turn=j.
If turn=i then Pi enters its critical section, otherwise Pj. However, whenever a
process finishes executing in its critical section, lets assume Pj, it resets flag[j] to
false allowing Pi to enter its critical section. If Pj resets flag[j]=true, then it must
also set ‘turn’ to i, and since Pi does not change the value of ‘turn’ while executing
in its while statement, Pi will enter its critical section (progress) after at most one
entry by Pj (bounded waiting).

REF :: handouts Page No. 145

Qno.15 which command is used in Linux environment to get process


information? (2)

Answer:-

ps gives a snapshot of the current processes. Without options, ps prints


information
about processes owned by the user. Some of the commonly used options are -u, -

Page 27 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

e, and
-l.

-e selects all processes

-l formats the output in the long format

-u displays the information in user-oriented format

REF :: handouts Page No. 63

Qno.16 resource sharing is disadvantage of multithreading....explain?(5)

Answer:-

1. Resource sharing: Whereas resource sharing is one of the major advantages of


threads, it is also a disadvantage because proper synchronization is needed
between threads for accessing the shared resources (e.g., data and files).

2. Difficult programming model: It is difficult to write, debug, and maintain multi-


threaded programs for an average user. This is particularly true when it
comes to writing code for synchronized access to shared resources.

REF :: handouts Page No. 70

Page 28 of 29
For more papers, go to VUInsider.com
FOR MORE PAPERS, GO TO VUINSIDER.COM

CS604 Mid Term

Qno.17 Synchronization process is needed in resource sharing and data


sharing (3)

Answer:-

Often access to shared data and shared resources, if there is no controlled access
to shared data, it is often possible to obtain an inconsistent state of this data.
Maintaining data consistency requires mechanisms to ensure the orderly execution
of cooperating processes, and hence various process synchronization methods are
used.

REF :: handouts Page No. 70

Page 29 of 29
For more papers, go to VUInsider.com

You might also like