Operating System Word
Operating System Word
Operating System
Subject code: CS-PC303
Lab File
int i, wt[n];
wt[0] = 0;
OUTPUT:
OUTPUT:
Q 3. Write a program in C language to convert logical address to physical
address.
Program :
#include<stdio.h>
int main()
{
int relocation_register=14000;
int limit_register=1000;
int logical_address,physical_address;
printf("Enter logial address : ");
scanf("%d",&logical_address);
if((logical_address<limit_register)&&(logical_address>=0))
{
physical_address=relocation_register+logical_address*1 ;
printf("Allocated Physical Address is : %d\n",physical_address);
}
else{
printf("Fatal Error!\n");
}
return 0;
}
Output:
Q 4.Create a file using vi editor having commands to save and close file.
To save a file, In Command Line mode, type “:w” and Press Enter. The contents of the file
will be saved.
To close a file, In Command Line mode, type “:q” and Press Enter. The file will be closed.
But, this not works when we haven’t saved the file.
When we want to save and close at the same time, we type “:wq” and Press Enter. The
content of file will be saved and file gets closed.
Sometimes, we want to forcefully close the file, so we will type “:q!” to close the file, this
will not save changes.
There are 6 ways to enter into insertion mode from Command Mode in Vi Editor:-
1. Press ‘i’
For newly created file, when we press ‘i’, the cursor moves to BOF (Beginning of
File). But, when we have saved changes, the cursor moves before the current location.
2. Press ‘I’
This will place cursor at the Beginning of current line.
3. Press ‘a’
This will place cursor after the current location.
4.Press ‘A’
This will insert text at the end of the current line.
5. Press ‘o’
This will create a new line below the cursor location.
6. Press ‘O’
Ans. STEP-1
This is question 1 in
Ans. In this question we are going to paste the text which we copy in
editor
2. STEP-1 In this we
are create a file
STEP-2
Now we are deleting the
selected text
STEP-
Q 9. Create a file in vi editor yourname.txt in current folder and
assign reading, writing and execution permission to user, reading
permission to group, none to other.
Q 10.Create a file with your name and write your roll_no, batch,
name, address, University in it and recursively search your name using case
insensitive approach.
Ans: first we have created aniket.txt and input all details ATQ. The content of
(Yogeshwar.txt) Shown below by using( cat ) cmd.
OUTPUT
Q11.Create a shell script program where u have taken file name from user
and three-digit octal number from user and write a program to change the
set of permission over the given file.
Q12. Create a program file to multiply two numbers and display the result
(take input from user).
Q13. Take your name, roll no, address as input from user and create a file
using shell scripting and input your name, roll no, address into it and
display the result.
Q 14. Create a directory in current directory with your name in Linux OS.
Q 15. Create a txt file with your name in that directory and insert your name,
roll number and address in it in Linux OS.