Nothing Special   »   [go: up one dir, main page]

OSY Practical No.5

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

OSY Practical

Enrollment no:- 1901160151


Name:- Aniket Abhay Bhoir.
Roll no.:- 46
Branch:- Information Technology.
Semester:- IF51

Practical No:-5.
Aim:- Execute process commands.

 Course Outcomes:
Execute process commands for performing process management
operations.

 Practical Outcomes:
Execute process commands-ps, wait, sleep, exit, kill.

 Resources Used:

Sr. No. Name of Recourses specifications

1 Hardware Computer System RAM - 4 GB


Processor - Intel ®

2 Operating System Windows 10 pro

3 Ubuntu ISO file 20.04.3 Desktop amd-64

4. Oracle Virtual Machine Box 6.1.26 platform


packages
 Program Code:
1. What is the process id of your login shell?
 $ps -p$$ this command will display the process id of any login shell.
Output:

2. Give PID of all processes, how you will terminal the processes
running on your terminal.
 $ps -A: This command will help to terminal all the processes running
on in any terminal and will show the PID of all processes.
Output:
3. What is the difference between wait and sleep?

Sleep Wait
It is used to hold the It puts thread in waiting
process state and it won’t back
automatically
It doesn’t release the lock It releases the lock while
while waiting waiting
It is used to produce pause It is used for inter-thread
on execution communication
Calls on thread Calls on object
 Practical Related Questions:
1. What is the name of your login shell?
echo “My current shell is $SHELL($0)” This command will let us know
the name of our current login shell.

2. What are various options of kill command?


 Options of the kill command:
1. $kill -1: This option is used for displaying every existing
signal
2. $kill pid: To show how to use a PID with kill command
3. $kill -s: To show how to send signal to process
4. $kill -L: This command is used to list available in a table format.

3. What are various options of ps commands?


 The options of ps commands are as follows:
1. $ps : Simple process selection command : show process of current
shell
2. $ps -A, $ps -e : View all the running processes with the given
command.
3. Ps -a: View processes not associated with terminal.

4. Explain the exit command.


 exit command in linux is used to exit the shell where it is currently
running.
It takes one more parameter as [N] and exits the shell with a return of
status N. If n is not provided, then it simply returns the status of the last
command that is executed.
Syntax: exit [n]
5. List the system calls for process management.
 Following are the System calls for process management along with its
Description
▪ fork() To create a new process
▪ exec() To execute a new program in a process
▪ wait() To wait until a created process completes its execution
▪ exit() To exit from a process execution
▪ getpid() To get a process identifier of the current process
▪ getppid() To get parent process identifier
▪ nice() To bias the existing priority of a process
▪ brk() To increase/decrease the data segment size of a process

 Exercise:
1. Observe the output of following commands?

a) $ echo$$
Output :-
b) $sleep 10;date
Output :-

2. Display a full listing of all the processes running on your terminal.


Command for listing all the processes running on the terminal :
$ps –A

Output:
 Conclusion:
Hence, I have successfully executed various process commands on my
personal Linux window.

You might also like