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

Lab Assignment_02

Uploaded by

haiderakt
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Lab Assignment_02

Uploaded by

haiderakt
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

COMSATS University Islamabad, Wah Campus

Lab Assignment # 02
Department of Computer Science

Class/Program: BS(SE) 5 Date: Oct 7, 2024

Subject: Principles of Operating System Instructor: Farah Jabeen

Total Time Allowed: Maximum Marks: 20

Student Name: Registration #:

Part I [CLO-05]
1. save cpp file in a folder (e.g. myFirstProg.cpp)
2. run following command to create compile your program
a. g++ -Wall -o progExeFile myFirstProg.cpp
Note: install g++ and gcc using Ubuntu Software Center if it is missing
3. run executable
b. ./progExeFile
4. Take Screenshot of above program and paste it in a word file
5. Make following changes in a “myFirstProgram.cpp”
a. Print your name in a new line
b. Print your complete Registration Number (e.g. CIIT/FA19-BSE-047/WAH) in a new line
c. Compile and run this program with new name
d. Take Screenshot of above program and past it in a word file

Part II [CLO-07]

1. Read following and understand, process creation in linux and fork() system call.
a. http://www.yolinux.com/TUTORIALS/ForkExecProcesses.html
2. Compile and run following program
a. process_creation.cpp
3. Take Screenshot of above program and past it in a word file
4. Explain, how it works?
5. Make following modifications in process_creation.cpp
a. Display process id and parents process id using following system calls in parent
process and child process
i. getpid()
ii. getppid()
b. Take Screenshot of above program and past it in a word file
6. Make following modifications in process_creation.cpp
a. Display your name in a parent process, and mention that currently parent
process is running
b. Display your Complete Registration Number(e.g. CIIT/FA19-BSE-047/WAH ) in a
parent process, and mention that currently parent process is running
c. Run following shell command in terminal to show “Base Board Information” in a
terminal
i. sudo dmidecode | grep -A4 '^Base Board Information'
ii. you will get serial number and other information about your computer
iii. Display serial number and other information of your computer in a child
process.
d. Take Screenshot of above program and past it in a word file

Part III [CLO-06]


1. Read following and understand shell command,
http://www.ee.surrey.ac.uk/Teaching/Unix/
2. Run commands in a terminal and paste screenshots in a word file
3. In case if you get any error and you are unable to fix that error
a. Please explain nature of error
b. How have you tried to solve the problem?

Part IV [CLO-06]

1. Implement a C or C++ program on orphan process?

Hint: Write a code for parent process in such a manner that after creating child the parent
terminates first.

2. Implement a C or C++ program on zombie process?

******************End******************

You might also like