Operating Systems Sessional: Mid-Term Examination Archive
Mid Term Examination: July–December 2023
Course Code: CIT 322 | Course Title: Operating Systems Sessional Session: 2020-21 | Program: B.Sc. Engg.(CSE) | Semester: 6th Total Marks: 15 | Instructions: Answer the marked questions.
SET-A (Answer any one from 1 to 3)
-
Implement Peterson’s solution for ensuring synchronization. [07] -
Implement mutex locks to ensure synchronization. -
Semaphore implementation to solve busy waiting problem.
SET-B (Answer one from 4–5; Question 6 is mandatory)
[âś“] 4. Multithreading Basics [04]
Write a code to demonstrate how to create and start Python’s or Java’s threads using the threading module (or Thread class).
-
It should run a function
print_namethat prints a name along with provided arguments. -
This example should create two threads, start them using the
start()method, and wait for completion using thejoin()method.
5. Concurrent Calculation [04]
Write code to use Python’s or Java’s threading module to calculate the square and cube of a number concurrently.
-
Create two threads (
t1andt2) for these calculations. -
Print results in parallel and print “Done!” only when both threads finish.
-
Note: Threading is used to achieve parallelism and improve performance for computationally intensive tasks.
6. Linux Command Operations [04]
Perform/Explain the following terminal operations:
-
Display information about files in the current directory.
ls ls -lah -
Create a directory with your own student name; inside it, create a file. Then create a directory in the home directory and copy the previously created file there.
mkdir sharafat touch text.txt cp /home/sharafat/sharafat/test.txt /home/sharafat/test cp test.txt ~/test -
Navigate between different folders.
cd -
Remove empty directories from the directory list.
find . -type d -delete -
File copy/cut and paste operations via terminal.
cp source/ destination/ mv source/ destination/ -
Download files from the internet.
wget URL aria2c URL -
Display the current user’s name.
whoami echo $USER -
View the calendar in the terminal.
cal cal 8 11 2002 -
Check the details of the file system.
neofetch fastfetch lscpu lsblk -
Check lines, word count, and characters in a file using different options.
wc filename wc -l filename wc -c filename wc --help
Mid Term Examination: July–December 2022 (PART-B)
Course Code: CIT 322 | Course Title: Operating Systems Sessional
Session: 2019-20 | Program: B.Sc. Engg.(CSE) | Semester: 6th
Total Marks: 08
-
Compiling Environment: Running a C/C++ Program in Linux. [02]
g++ input.cpp .\a.exe -
Linux Shell Commands: Use commands to perform the following: [06]
-
(i) Show home directory of your user.
echo $HOME -
(ii) List files in the current directory.
ls -
(iii) Change directory.
cd -
(iv) Create a folder/directory.
mkdir name -
(v) Delete files and directories.
rm filename -
(vi) Create a file.
touch file.txt -
(vii) Access manual pages (help) for a command.
ls --help man ls -
(viii) Change file permissions (make a file executable).
chmod +x filename -
(ix) Move files via command line.
mv source/ destination/ -
(x) Locate a file in the system.
ls -R | grep input.jpg -
(xi) Check server connectivity (ping).
ping 9.9.9.9 ping -c 5 sharafat.xyz -
(xii) Redirect data/text into a file.
ping -c 5 sharafat.xyz > file.txt
-
Mid Term Examination: July–December 2021
Course Code: CIT 322 | Course Title: Operating Systems Sessional
Session: 2018-19 | Program: B.Sc. Engg.(CSE) | Semester: 6th
Total Marks: 15 | Instructions: Answer questions 1, 2, 3 and marked questions.
-
Installation of Linux with Virtual Machine. [01]
-
Running a C/C++ Program in Linux. [02]
g++ input.cpp .\a.exe -
Running a Java Code in Linux. [02]
javac Main.java java Main[âś“] 4. System Administration & Navigation Commands: [10]
-
List home directory, navigate folders, and create/delete files/directories.
-
Check disk space in partitions.
lsblk -
Run commands with administrative/root privileges (
sudo).sudo commmand -
Compress files into a
.ziparchive.zip compressed.zip file_1 file_2 ... -
Check disk usage of a specific file.
du -h compressed.zip -
Check network connection.
ping sharafat.xyz
-
Mid Term Examination: July–December 2020
Course Code: CIT 322 | Course Title: Operating Systems Sessional
Session: 2017-18 | Program: B.Sc. Engg.(CSE) | Semester: 6th
Total Marks: 15 | Instructions: Answer the marked questions.
1. FCFS Scheduling Analysis [10]
Consider three CPU-bound processes arriving at an FCFS scheduler:
| Process | Arrival Time | Duration (Burst) |
| 0 | 3 | |
| 1 | 12 | |
| 5 | 1 |
-
Tasks: Give the schedule (Gantt Chart) and compute the average waiting time. -
Analysis: Define the “Convoy Effect.” Provide an alternative arrival order that improves average waiting time and a second order that demonstrates the convoy effect.
2. Comparative Scheduling [10]
Compare the average waiting time for FCFS, SJF, and SRTF for the following processes:
| Process | Arrival Time | Burst Time |
| 0 | 8 | |
| 3 | 3 | |
| 5 | 4 | |
| 6 | 6 |
3. Algorithm Simulation
[âś“] 3. Simulate the CPU scheduling algorithm Round-Robin. [10]
-
Simulate the Priority Scheduling algorithm (Random). [10] -
Simulate the First Come First Serve (FCFS) algorithm. [10] -
Simulate the Shortest Job First (SJF) (Non-Preemptive) algorithm. [10] -
Simulate the Shortest Job First (SJF) algorithm. [10] -
Simulate the Shortest Remaining Time (SRT) algorithm. [10]
9. Linux Customization & Management [05]
[âś“] Tasks:
-
Change wallpaper and screensaver via Linux command line.
gsettings set org.gnome.desktop.background <<image-name/path>> -
Create a directory (student name), create a file within, and copy it to a new directory in the home folder.
mkdir sharafat touch text.txt cp /home/sharafat/sharafat/test.txt /home/sharafat/test cp test.txt ~/test -
Create disk partitions.
lsblk -
Install and configure a printer.
-
Perform file copy, cut, and paste operations.