1
T ECHNO I NDIA U NIVERSITY, W EST B ENGAL
Operating Systems Lab
Assignment - 01
Stream: B.Tech CSE Semester: 5
Subject Name: Operating Systems Lab Subject Code: TIU-UCS-L317
Deadline: 04-08-24 Total Marks: 20
Write the code in C / C++ language and show the output [20]
1) Do the following task as the perquisite task before the simulation a long-term scheduler—
(a) Consider the following information will be stored in a PCB—- 1. Process ID, 2. CPU Burst
time, 3. I/O Burst Time 4. Total Burst time 5. Priority 6. Status( CPU Bound / I/O Bound)
(b) Randomly generate the unique process ID for each process. In every iteration create a process
and make a new state queue to store the process containing the above information.
(c) Randomly generate CPU burst time and I/O Burst time for every process within the range of
1-10ms.
(d) Every Process will be given a priority based on total burst time and consider the lower priority
value signifies the higher priority.
(e) Label the status of the process based on the ration of CPU burst time and I/O burst time.
——————-End—————
2
T ECHNO I NDIA U NIVERSITY, W EST B ENGAL
Operating Systems Lab
Assignment - 02
Stream: B.Tech CSE Semester: 5
Subject Name: Operating Systems Lab Subject Code: TIU-UCS-L317
Deadline: 25-08-24 Total Marks: 20
Write the code in C/ C++ language and show the output [20]
1) Simulate a long-term scheduler that will follow the following conditions—
(a) Maintain two queues for this implementation. The input process queue will have the list of
processes that are in the new state. Every process will have a process number and be marked as
either CPU Bound or I/O Bound( Randomly marked at the time of input). Output queue( Ready
queue) will be containing the processes after the decision of long-term scheduler.
(b) There will be a process mix for long-term scheduler. Always maintain a ratio of CPU bound
and I/O Bound process as 2:1( this ration can be considered as symbolic, we have wanted to make
number of I/O bound processes would be lesser than CPU bound processes). Always first two
process would be CPU Bound process as an initial situation. In every Iteration, check whether it
is maintained or not.
(c) Let us assume that we do have a fixed set of processes in our input queue before starting
of your scheduling decisions. There will be no such addition of the processes in the input queue
further.
(d) In every iteration, there will be decision on one process to admit into output queue( ready
queue). If the ratio is not maintained then discard the process and move to the next process. The
number of iteration be equal to the total number of processes in input queue.
(e) Print the Ready queue( Show the process number and status-CPU bound or I/O Bound) in
every iteration.
——————-End—————
3
T ECHNO I NDIA U NIVERSITY, W EST B ENGAL
Operating Systems Lab
Assignment - 03
Stream: B.Tech CSE Semester: 5
Subject Name: Operating Systems Lab Subject Code: TIU-UCS-L317
Deadline: 15-09-24 Total Marks: 20
Write the code in C/C++ language and show the output [20]
1) Do the following task to create and manage new process—
(a) Call fork() two times in your main function. Put three printf(“Hello guys”); —one before the
first fork() call, one after the Second fork() call and one between the two fork() calls. Each time
print the process ID along with the “hello guys”. Justify your output with proper explanation.
(b) Call fork() function inside a loop, the number of iteration of the loop would be controlled by
the user input. For every process print the process ID and also print the parent process ID of the
corresponding process. Justify the output with proper explanation.
(c) Child process would print next even number, Parent process would print next odd number of
a number taken through keyboard in parent process.
(d) Write a program to update the value of variable x by assigning a new constant in the child
process.
——————-End—————
4
T ECHNO I NDIA U NIVERSITY, W EST B ENGAL
Operating Systems Lab
Assignment - 04
Stream: B.Tech CSE Semester: 5
Subject Name: Operating Systems Lab Subject Code: TIU-UCS-L317
Deadline: 31-08-24 Total Marks: 20
Write the code in C/C++ language and show the output [20]
1) Simulate the following Short-term scheduler that will follow the following conditions—
(a) Maintain two queues for this implementation. The input process queue( Ready queue) will
have the list of processes. Every process will have a process ID and some other information( CPU
Burst time and I/O Burst time, Arrival time, total burst time, Priority score, Turn around time,
wait time, response time). Consider the CPU Burst time and I/O Burst time, Arrival time as
random value but it should be within some certain range.
(b) There will be an another output queue which will represent the Gantt chart after the schedule
of the processes. We also need to keep the information regarding the process execution start time,
execution finish time.
(c) We need to implement two different CPU scheduling algorithms : FCFS, SJF
(d) We need to plot a graph to show the variation of average turnaround time, average wait time
for every scheduling algorithm with respect to avg. burst time.
(e) Explain the graph in details and write your inference of the graph.
——————-End—————
5
T ECHNO I NDIA U NIVERSITY, W EST B ENGAL
Operating Systems Lab
Assignment - 05
Stream: B.Tech CSE Semester: 5
Subject Name: Operating Systems Lab Subject Code: TIU-UCS-L317
Deadline: 22-09-24 Total Marks: 20
Write the code in C/C++ language and show the output [20]
Do the following simulation to check the safe state of the system at a specific time stamp—
Single Resource, Multiple Instances: Consider there are n processes and one resource having multiple
instances. The allocation vector A[ ] represents the current allocation of the resource instances concerned to
the corresponding process. Max vector M[ ] represents the maximum requirement of the resource instances
concerned to the corresponding process. The total number of instances of the resource and currently available
resource instances are stored in the Totinst and Curinst respectively. We need to do two types of work—
1) We need to check if a given sequence is safe or not. User will give the inputs as follows:i) number
of processes ii) Totinst and Curinst iii) allocation vector A[ ] iv) Max vector M[ ]. v) a sequence
of processes.
2) On a given following input, we need to figure out all possible safe sequences. User will give the
inputs as follows:i) number of processes ii) Totinst and Curinst iii) allocation vector A[ ] iv) Max
vector M[ ].
3) On a given following input, we need to figure out all possible unsafe sequences. User will give the
inputs as follows:i) number of processes ii) Totinst and Curinst iii) allocation vector A[ ] iv) Max
vector M[ ].
——————-End—————
6
T ECHNO I NDIA U NIVERSITY, W EST B ENGAL
Operating Systems Lab
Assignment - 06
Stream: B.Tech CSE Semester: 5
Subject Name: Operating Systems Lab Subject Code: TIU-UCS-L317
Deadline: 29-09-24 Total Marks: 20
Write the code in C/C++ language and show the output [20]
Multiple Resource, Multiple Instances(Bankers safety algorithm): Consider there are n processes
and every resource having multiple instances. The allocation Matrix A[ ][ ] represents the current
allocation of the resource instances concerned to the corresponding process. Max Matrix M[ ][ ]
represents the maximum requirement of the resource instances concerned to the corresponding
process. The total number of instances of the resources and currently available resource’s instances
are stored in the vector Totinst[ ] and Curinst[ ] respectively. User will give the inputs as follows:i)
number of processes ii) Totinst[ ] and Curinst[ ] iii) allocation Matrix A[ ][ ] iv) Max Matrix M[
][ ] v) a sequence of processes. We need to check the system is safe or not on the given sequence
of processes. Afterward take a input of request for the allocation and do the allocation if it can
be done according to the algorithm. Finally print the allocation matrix after the allocation( if
allowed).
——————-End—————
7
T ECHNO I NDIA U NIVERSITY, W EST B ENGAL
Operating Systems Lab
Assignment - 07
Stream: B.Tech CSE Semester: 5
Subject Name: Operating Systems Lab Subject Code: TIU-UCS-L317
Deadline: 01-11-24 Total Marks: 20
Write the code in C/C++ language and show the output [20]
Memory Allocation Algorithms: Implement the following algorithms— a) First Fit b) Next Fit c)
Best Fit and d) Worst Fit:
Consider there are n processes and each of them have a process size. Consider we need to implement the
static partitioning memory allocation system where one partition can allocate one process only. We have
m partitions in our system. We need to consider the following points when we will develop the system
for simulation— 1) number of partitions m should be greater than or equal to number of processes n.
2) Number of process and number of partitions are to be randomly decided by the system at run time.
3) The process size and partition size are to be randomly managed though the partition size would be
power of 2 always. 4) We need to calculate the total leftover amount after execution of each of the
algorithm.
——————-End—————
8
T ECHNO I NDIA U NIVERSITY, W EST B ENGAL
Operating Systems Lab
Assignment - 08
Stream: B.Tech CSE Semester: 5
Subject Name: Operating Systems Lab Subject Code: TIU-UCS-L317
Deadline: 08-11-24 Total Marks: 20
Write the code in C/C++ language and show the output [20]
Demand Paging Algorithms: Implement the following page fault algorithms — a) FIFO b) LRU
c) Optimal
Consider there are n number of pages are being referred. Consider we need to implement the page
fault service system. We need to develop the simulated environment for the same. Consider We have
m frames in cache in our system. We need to consider the following points when we will develop the
system for simulation— 1) number of frame m should be lesser than the number of pages n in sequence.
2) System would generate randomly the sequence of page numbers 3) We need to count the number of
page fault of the each algorithms.
——————-End————–
9
T ECHNO I NDIA U NIVERSITY, W EST B ENGAL
Operating Systems Lab
Assignment - 09
Stream: B.Tech CSE Semester: 5
Subject Name: Operating Systems Lab Subject Code: TIU-UCS-L317
Deadline: 15-11-24 Total Marks: 20
Implement the following program into shell script :
• Print Hello World!!
• Add two numbers
• Check if the number is even or odd.
• Print numbers from 1 to 10 using loop.
• Check if a file exists or not.
• Find the largest number among three numbers
• Display the current date and time.
• Create a directory.
• Check if the string is palindrome.
• Calculate the factorial of a number.
——————-End————–