OS Lab Manual.docx_removed
OS Lab Manual.docx_removed
List of
Datta Meghe College of Experiments Course Name : Operating
Engineering
System Course Code :
Airoli, Navi Mumbai CSL403/CSC404
Practical Incharge
DATTA MEGHE COLLEGE OF ENGINEERING, AIROLI, NAVI
MUMBAI
Institute Vision : To create value - based technocrats to fit in the world of work and research
Institute Mission : To adapt the best practices for creating competent human beings to
work in the world of technology and research.
Department Mission :
M1: To promote an educational environment that combines academics with intellectual curiosity.
M2: To develop human resource with sound knowledge of theory and practical in the discipline of
Computer Engineering and the ability to apply the knowledge to the benefit of society at large.
M3: To assimilate creative research and new technologies in order to facilitate students to be a lifelong
learner who will contribute positively to the economic well-being of the nation.
Course Outcomes
CSC404.1 Understand the objectives, functions and structure of OS
CSC404.6 Apply concepts of I/O management and analyze techniques of disk scheduling.
DATTA MEGHE COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER
ENGINEERING ACADEMIC YEAR 2022-23
(TERM II) SUBJECT: OERATING SYSTEM
SEM: IV
RUBRICS FOR GRADING EXPERIMENTS
Rubric Rubric Title Criteria Marks
Number
(out of 15)
R1 Punctuality, On-time 3
Completion Time
Delayed by not more than a Week 2
/ Timeline
Delayed more than a Week 1
Weak understanding 1
Partial Implementation 2
Partial Results 2
Moderate documented 2
ENGINEERING DEPARTMENT OF
OPERATING SYSTEM
SEM: IV
R1 Punctuality, On-time 2
Completion Time
Delayed by not more than a Week 1
/ Timeline
Delayed more than a Week 0
Weak understanding 0
AIM:-To study and implement the internal commands of Linux like ls, chdir, mkdir,
chown , chmod , chgrp, ps , etc
THEORY:-
WHAT IS LINUX?
Linux is an Operating System’s Kernel. You might have heard of UNIX. Well, Linux is a
UNIX clone. But it was actually created by Linus Torvalds from Scratch. Linux is free
and open-source, that means that you can simply change anything in Linux and
redistribute it in your own name! There are several Linux Distributions, commonly called
“distros”. A few of them are:
● Ubuntu Linux
● Red Hat Enterprise Linux
● Linux Mint
● Debian
● Fedora
1. Command - ls
OUTPUT:
2. Command – chmod
OUTPUT:
4.Command - chdir
Example chdir /
OUTPUT:
5.Command - mkdir
OUTPUT:
6.Command - chown
Name chown
Purpose To change owner, change the user and/or group ownership of each given
File to a new Owner.
Syntax chown [options] new_owner object(s)
Example The following would transfer the ownership of a file named file1 and a
directory named dir1 to a new owner named alice:
chown root test.php
OUTPUT:
7.Command - chgrp
Name chgrp
Purpose 'chgrp' command changes the group ownership of each given File to
Group (which can be either a group name or a numeric group id) or to
match the same group as an existing reference file.
Syntax chgrp [OPTION]… GROUP FILE…
Example To Make oracleadmin the owner of the database directory
$ chgrp wheel .
OUTPUT:
8.Command - ps
Name ps
Purpose displays information about a selection of the active processes.
Syntax ps aux
Example $ ps aux
OUTPUT:
9.Command – man
Name man
Purpose It is used to show the manual of the inputted command.
Syntax $ man <command_name>
Example The inputting command will show the manual or all relevant information
for the change directory command.
$ man cd
OUTPUT:
10.Command – rm
OUTPUT:
R1 R2 R3 R4 R5 Total Signature
THEORY: -
SHELL SCRIPTS:
Shell scripts are short programs that are written in a shell programming
language and interpreted by a shell process. They are extremely useful for automating
tasks on Linux and other Unix-like operating systems.
A shell is a program that provides the traditional, text-only user interface for
Unix- like operating systems. Its primary function is to read commands (i.e., instructions)
that are typed into a console (i.e., an all-text display mode) or terminal window (i.e.,
all-text mode window) and then execute (i.e., run) them. The default shell on Linux is the
very commonly used and highly versatile bash.
The process list shows all the processes with various process specific details in separate
columns.Some of the column names are pretty self explanatory.
PID –Process ID
USER - The system user account running the process.
%CPU - CPU usage by the process.
%MEM - Memory usage by the process
COMMAND - The command (executable file) of the process
OUTPUT:
OUTPUT:
OUTPUT:
R1 R2 R3 R4 R5 Total Signature
AIM:- To study and implement the following system calls: open, read, write, close,
getpid, setpid, getuid, getgid, getegid, geteuid.
THEORY: -
SYSTEM CALL:
When a program in user mode requires access to RAM or a hardware resource, it
must ask the kernel to provide access to that resource. This is done via something called a
system call.
When a program makes a system call, the mode is switched from user mode to kernel
mode. This is called a context switch.
Then the kernel provides the resource which the program requested. After that, another
context switch happens which results in change of mode from kernel mode back to user
mode.
Generally, system calls are made by the user level programs in the following situations:
OUTPUT:
3. Writing to a File: write()
Description: To write bytes to a file, it uses the “write()” system call,
OUTPUT:
4. Closing a File: “close()”
Description: uses the “close()” system call to free the file descriptor of the input.
OUTPUT:
5. Process management - getpid() & getppid()
Description: A process may obtain its own process ID and parent process ID
numbers by using the “getpid()” and “getppid()” system calls, respectively.
Here “getpid()” and “getppid()” return a process’ID number and parent process’ ID
number, respectively.
The parent process ID number of PID 1 (i.e., “init”) is 1.
OUTPUT:
6. Accessing User and Group IDs
Description: The system calls that allow you to read a process real and effective IDs
OUTPUT:
CONCLUSION:- Thus we have studied and explored the commands of system calls.
R1 R2 R3 R4 R5 Total Signature
AIM: - To Implement basic commands of Linux like ls, cp, mv and others using kernel
APIs.
THEORY:-
1. Command – stat
Name stat
Purpose To check the status of a file. This provides more detailed information
about a file than ‘ls -l’ output.
Syntax $ stat usrcopy
Example stat data.txt
OUTPUT:
Name VI editor
Purpose VI stands for Visual editor; another text editor in Linux. This is a
standard editor in many Linux/Unix environments.
Syntax $ vi filename
Example $ vi hello.txt
OUTPUT:
4. Command – mv
Name mv - move
Purpose Move files or directories. The 'mv' command works like 'cp' command,
except that the original file is removed. But, the mv command can be
used to rename the files (or directories).
Syntax $ mv source destination
Example mv myfile.txt myfiles
Move the file myfile.txt into the directory myfiles. If myfiles is a file, it will
be overwritten. If the file is marked as read-only, but you own the file, you
will be prompted before overwriting it.
OUTPUT:
OUTPUT:
6. Command – date
Name date
Purpose Displays current time and date.
If you are interested only in time, you can use 'date +%T' (in hh:mm:ss):
Syntax $ date
Example $ date
Fri Jul 6 01:07:09 IST 2012
$ date +%T
01:13:14
OUTPUT:
Name whoami
Purpose This command reveals the user who is currently logged in.
Syntax $ whoami
Example $ whoami
raghu
OUTPUT:
8. Command – pwd
Name pwd
Purpose ‘pwd’ command prints the absolute path to current working directory.
Syntax $ pwd
Example $ pwd
/home/raghu
OUTPUT:
OUTPUT:
R1 R2 R3 R4 R5 Total Signature
AIM: - Write a program to implement CPU Scheduling algorithms like FCFS & SJF.
THEORY:-
1. FIRST-COME, FIRST-SERVE SCHEDULING (FCFS):
In this, which process enter the ready queue first is served first. The OS maintains DS
that is ready queue. It is the simplest CPU scheduling algorithm. If a process request the
CPU then it is loaded into the ready queue, which process is the head of the ready queue,
connect the CPU to that process.
OUTPUT:
2. SHORTEST JOB FIRST:
The criteria of this algorithm are which process having the smallest CPU burst, CPU is
assigned to that next process. If two process having the same CPU burst time FCFS is
used to break the tie.
CONCLUSION:- Thus we have studied FCFS & SJF scheduling algorithm and its
implementation.
SIGN AND REMARK
R1 R2 R3 R4 R5 Total Signature