You are on page 1of 4

General Instructions and List of Programs for Operating System Lab Practical Lab Manual 2022

(For Batches: BCS3C and BCS3D)

Module I: Process Management using fork() system call

i. Write a program to show the execution of fork() system call in respect to parent and child
processes.
ii. Write a Program for showing the choice of child process and then parent process using
loop.
iii. Write a program to call a function from the main function. Note: the called function contain
a single fork(). Explain the output

iv. Write a Program to show the execution of Parent process until the Child process complete
its execution
v. Write a Program to show the execution of Parent process until the Child process complete
its execution. Print process ids to check.

Module II: Simulation of scheduling algorithms:

Write a program (Algorithm / Steps) to implement the following process scheduling algorithms

i. First Come First Serve


ii. Shortest Job First
iii. Priority Scheduling

iv. Round Robin

SAMPLE:

Round Robin CPU Scheduling:


The round-robin (RR) scheduling algorithm is designed especially
for time-sharing systems. It is similar to FCFS scheduling. A
small unit of time, called a time quantum or time slice, is
defined. A time quantum is generally from 10 to 100 milliseconds.
The ready queue is treated as a circular queue. The context
switching takes place after each time quantum.
ALGORITHM:
Step 1: Start the process
Step 2: Accept the number of processes in the ready Queue and
time quantum (or) time slice Step 3: For each process in the
ready Q, assign the process id (Process #) and accept the CPU
burst time
Step 4: Calculate the no. of context switch for each process
where
No. of time division (context switch) for process(n) = burst time
process(n)/time quantum
Step 5: If the burst time is less than the time quantum then the
no. of time division (context switch) =1.
Step 6: Consider the ready queue is a circular Q, calculate
(a) Waiting time for process(n) = waiting time of process(n-1)+
burst time of process(n-1 ) + the time difference in getting the
CPU from process(n-1)
(b) Turnaround time for process(n) = waiting time of process(n) +
burst time of process(n)+ the time difference in getting CPU from
process(n).

Step 7: Calculate
(c) Average waiting time = Total waiting Time / Number of process
(d) Average Turnaround time = Total Turnaround Time / Number of
process

Step 8: Stop the process

INPUT: Valid Input: ROUND ROBIN SCHEDULING

Enter the number of Processors: 4

Enter the Time quantum: 5

Enter the Burst Time for the process # 1: 10

Enter the Burst Time for the process # 2: 15

Enter the Burst Time for the process # 3: 20

Enter the Burst Time for the process # 4: 25

Valid output:
……..

INPUT: Invalid Input: ROUND ROBIN SCHEDULING

Enter the number of Processors 4

Enter the Time quantum: -5

Enter the Burst Time for the process # 1: 10

Enter the Burst Time for the process # 2: 15

Enter the Burst Time for the process # 3: 20

Enter the Burst Time for the process # 4: 25

Invalid output:
……..

NOTE: Take appropriate burst time, priority queue info, time quantum etc. as input and
compute Average Waiting Time, Average Turn Around Time as Output

Module III: Simulation on Classical Process Synchronization Algorithms

i. Write a program to implement the Producer Consumer problem using Semaphore. Show the
Programming steps, input and output parameters
ii. Show the programming steps (Only the Algorithm) to implement the Dining Philosopher’s
Problem

Module IV: Basic Linux Commands and Shell Programming

i. Using suitable example list the details about following linux commands
ls , cat, head, tail, chmod, chown, grep, wc, gunzip, diff, sort, uniq

SAMPLE

chgrp
is used to Change the Group Ownership:

The chrgp command changes the group ownership of a file.


syntax :
$ chgrp group filename

ii. Write a Shell Script to find out the biggest number in 3 numbers – If – elif block

SAMPLE

ALGORTHIM :

Step1: Declare the three variables.

Step2: Check if A is greater than B and C.

Step3: If so print A is greater.


Step4: Else check if B is greater than C.
Step5: If so print B is greater.
Step6: Else print C is greater.

INPUT: Valid Input:


Enter A: 23
Enter B: 45
Enter C: 67

Valid Output: C is greater Invalid Input:

Enter A: GEC
Enter B: 45
Enter C: 67

Invalid Output:

iii. Write a Shell Script to perform the Arithmetic Operations (summation, subtraction,
multiplication and division) of two numbers – using Switch
iv. Write a Shell Script to print the Pascal triangle – using for loop

GENERAL INSTRUCTIONS:

1. Handwritten practical Lab copy book is preferred. However, students can submit the printed
version in a channel file. The index page (contains the list of programs) at the beginning is highly
recommended.
2. The programming steps (Algorithm), Input, and Output can be included (see the sample
programs). Line by line code is not required
3. If completely identical lab copies are found, the marks will be deducted for all such students
4. Submission date: During the lab exam date and time
5. During the practical Evaluation session one or two similar program can be asked to implement
and show the output (Module I to Module IV)
6. Viva questions will be based on theoretical knowledge and programming skill from each module.

You might also like