Professional Documents
Culture Documents
VL2018191004391 Ast03 PDF
VL2018191004391 Ast03 PDF
VL2018191004391 Ast03 PDF
Assessment-1 Questions
1) Shell Programming
Handling the command line arguments
String reversal
If-Else, Nested If Else,Switch cases in shell
m
e r as
Checking the Process Identifier
co
Assigning new task to child
eH w
Providing the path name and program name to exec()
o.
rs e
Synchronizing Parent and child process using wait()
ou urc
Assessment-2 Questions
o
https://www.coursehero.com/file/34664196/VL2018191004391-AST03pdf/
Assessment-3 Questions
Process and Thread Management
d) The Collatz conjecture concerns what happens when we take any
positive integer n and apply the following algorithm:
n = n/2, if n is even n = 3 × n + 1, if n is odd
The conjecture states that when this algorithm is continually applied,
all positive integers will eventually reach 1. For example, if n = 35,
the sequence is 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1.Write
a C program using the fork () system call that generates this
m
e r as
sequence in the child process. The starting number will be provided
co
eH w
from the command line. For example, if 8 is passed as a parameter
o.
on the Command line, the child process will output 8, 4, 2, 1.
rs e
Because the parent and child processes have their own copies of the
ou urc
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
o
aC s
numbers on the command line and will then create three separate
ar stu
third will determine the minimum value. For example, suppose your
Th
https://www.coursehero.com/file/34664196/VL2018191004391-AST03pdf/
Assessment-4 Questions
CPU Scheduling
(a) Implement the various process scheduling algorithms such as
FCFS, SJF, Priority (Non Preemptive). (Easy )
(b) Implement the various process scheduling algorithms such as
Priority, Round Robin (preemptive). (Medium)
Assessment- 5 Questions
m
e r as
CPU Scheduling
co
eH w
(c) Consider a corporate hospital where we have n number of
o.
patients waiting for consultation. The amount of time required
rs e
ou urc
to serve a patient may vary, say 10 to 30 minutes. If a patient
arrives with an emergency,he /she should be attended
o
waiting time of other patients. If you are given this problem with
v i y re
https://www.coursehero.com/file/34664196/VL2018191004391-AST03pdf/
of queues, the scheduling algorithm 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 quantum). What (if any) relation holds between the
following pairs of algorithm sets? Implement the below mentioned
algorithms and determine the efficiency of each algorithm. (Assume
your own data for input)
1. Priority and SJF 2. Multilevel feedback queues and FCFS 3. Priority
m
e r as
and FCFS 4. RR and SJF
co
eH w
o.
rs e Assessment- 6 Questions
ou urc
Process Synchronization
o
scenario. Medium
Th
Assessment- 7 Questions
Process Synchronization
(d) Write a Program to implement banker’s algorithm for Deadlock
avoidance. Medium
(e) The Crisp Cafe in the strip mall near my house serves customers
FIFO in the following way. Each customer entering the shop takes a
https://www.coursehero.com/file/34664196/VL2018191004391-AST03pdf/
single “ticket” with a number from a “sequencer” on the counter. The
ticket numbers dispensed by the sequencer are guaranteed to be
unique and sequentially increasing. When a barista (a person who
makes and serves coffee) is ready to serve the next customer, it calls
out the “event count”, the lowest unserved number previously
dispensed by the sequencer. Each customer waits until the
eventcount reaches the number on its ticket. Each barrista waits until
the customer with the ticket it called places an order. Implement
sequencers, tickets, and eventcounts using mutexes and condition
variables. Your solution should also include code for the barrista and
m
customer threads. High
e r as
co
eH w
(f) The Sleeping Professor Problem: Once class is over, professors
o.
like to sleep — except when students bother them to answer
rs e
questions. You are to write procedures to synchronize threads
ou urc
representing one professor and an arbitrary number of students. A
professor with nothing to do calls IdleProf(), which checks to see if a
o
the office for a signal from the professor; if no students are waiting,
then the student wakes up the sleeping professor. The idea is that the
professor and exactly one student will return from their respective
sh is
functions “at the same time”: after returning they discuss a topic of
Th
mutual interest, then the student goes back to studying and the
professor calls IdleProf again. Implement IdleProf and ArrivingStudent
using mutexes. High
https://www.coursehero.com/file/34664196/VL2018191004391-AST03pdf/
Assessment- 8 Questions
Memory Management
(a) Consider a memory hole of size 1kb initially. When a sequence of
memory request arrives as following, illustrate the memory allocation
by various approaches and calculate the total amount memory wasted
by external fragmentation and internal fragmentation in each
approach.
a. First fit; b. Best fit c. Worst fit (Easy)
(b) Write a program to implement the page replacement algorithms.
m
e r as
co
a. FIFO b. LRU c. OPT (Medium)
eH w
(c) Write a program that implements the FIFO, LRU, and optimal
o.
rs e
pager replacement algorithms. First, generate a random page-
ou urc
reference string where page numbers range from 0 to 9. Apply the
random page reference string to each algorithm, and record the
o
Assessment- 9 Questions
File system and Disk Management
sh is
Th
https://www.coursehero.com/file/34664196/VL2018191004391-AST03pdf/
(b) Consider a file of size 1 MB. The size of a disk block is 512Bytes.
Assume any number of available free blocks in the disk contiguously
or noncontiguously. Implement the following algorithms to perform
file allocation. Determine the efficiency of each file allocation
strategies. a. Sequential b. Indexed c. Linked (High)
m
e r as
co
eH w
o.
rs e
ou urc
o
aC s
v i y re
ed d
ar stu
sh is
Th
https://www.coursehero.com/file/34664196/VL2018191004391-AST03pdf/