0% found this document useful (0 votes)
11 views

Lab 1 OSG

Uploaded by

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

Lab 1 OSG

Uploaded by

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

1.

Using First Come First Serve (FCFS) and Shortest Remaining Time First (SRTF) Algorithm and Round
Robin (quantum time is 3 in Pre Emptive Approach to schedule the processes as given below. Which
one is better?
- FCFS non-preemptive:
Process ID Arrival Time Burst Time Completion Turn Around Waiting Response
Time Time Time Time
1 1 8 11 10 2 2
2 0 3 3 3 0 0
3 3 2 14 11 9 9
4 2 1 12 10 9 9
5 6 6 24 18 12 12
6 5 4 18 13 9 9
7 11 5 29 18 13 13

- FCFS Preemptive:
Process ID Arrival Time Burst Time Completion Turn Around Waiting Response
Time Time Time Time
1 1 8 29 28 20 20
2 0 3 3 3 1 0
3 3 2 6 3 1 1
4 2 1 4 2 0 1
5 6 6 16 10 4 4
6 5 4 10 5 1 1
7 11 5 21 10 5 5

- SRTF :
Process ID Arrival Time Burst Time Completion Turn Around Waiting Response
Time Time Time Time
1 1 8 29 28 20 20
2 0 3 3 3 1 0
3 3 2 6 3 1 1
4 2 1 4 2 0 1
5 6 6 16 10 4 4
6 5 4 10 5 1 1
7 11 5 21 10 5 5

- Round Robin ( quantum time = 3)


Process ID Arrival Time Burst Time Completion Turn Around Waiting Response
Time Time Time Time
1 1 8 29 28 20 3
2 0 3 3 3 0 0
3 3 2 9 6 4 7
4 2 1 7 5 4 6
5 6 6 25 19 13 12
6 5 4 22 17 13 9
7 11 5 27 16 11 15

- SRTF is better because it’s use the least completion times


2. Write a shell script program to display your student ID and your full name. Name the file with the
same name as your student ID and your full name.
#! /bin/bash
echo -n “Enter your name: “
read name
echo -n “Enter your student ID: ”
read studentID
echo “Hello, $name with ID $studentID”

3. Write a shell script to calculate the sum, difference, product, and quotient of 2 integers entered
from the keyboard.
echo -n “Enter a = ”
read a
echo -n “Enter b = “
read b
sum=$(($a+$b))
different=$(($a-$b))
product=$(($a*$b))
quotient=$(($a/$b))
echo “The sum $a + $b = $sum”
echo “The different $a - $b = $different”
echo “The product $a * $b = $product”
echo “The quotient $a / $b = $quotient”

You might also like