Вы находитесь на странице: 1из 56

1

Name zain zulfiqar


Roll No 15-uglc-336
Class CS(M)
Sir Engr. Naeem Raza

Operating System
(CMP-3621)
Contents
 System Information............................................................................................................................... 2
 System Configuration ............................................................................................................................ 3
 Task Manager ........................................................................................................................................ 4
 Disk Management (Shrink, Extend Volumes ets…) ............................................................................... 6
 Introduction to Command Line Interface (CLI) ..................................................................................... 8
2

 Introduction to Operation System(DOS)............................................................................................... 9


 Difference b/w Internal and External Commands .............................................................................. 10
 Diskpart utility ..................................................................................................................................... 22
 Network commands ............................................................................................................................ 24
 CPU Scheduling ................................................................................................................................... 26
 Banker Algorithm ................................................................................................................................ 43
 FIFO page replacement algorithm ...................................................................................................... 50

 System Information
A free tool included with Microsoft Windows that allows users to
view information about the computer, its hardware, drivers, and software
related data. The picture below is an example of the Windows System
Information tool showing the System Summary for the computer.
3

 System Configuration
A system configuration (SC) in systems engineering defines the
computers, processes, and devices that compose the system and its
boundary. More generally, the system configuration is the specific
definition of the elements that define and/or prescribe what a system
is composed.

Some function enabled when computer start that’s program strat .


4

 Task Manager
Task Manager, previously known as Windows Task
Manager, is a task manager, system monitor, and startup
manager included with Microsoft Windows systems. It
provides limited information about computer performance
and running
applications, processes and CPU usage, commit charge and
memory information, network activity and statistics, logged-in
users, and system service
5

s
6

 Disk Management (Shrink, Extend Volumes


ets…)
Disk Management is a Microsoft Windows utility first introduced
in Windows XP as a replacement for the f disk command. It
enables users to view and manage the disk drives installed in
their computer and the partitions associated with those drives.

1. Open the Disk Management console by typing disk management.


MSC at an elevated command prompt.
2. In Disk Management, right-click the volume that you want to
shrink, and then click Shrink Volume.
7

1. Right click My Computer and choose Manage -> Storage -


> Disk Management.
8

2. Select the adjacent disk of the disk you want to extend, right
click and choose Shrink Volume to create some free disk space.

 Introduction to Command Line Interface


(CLI)
A command-line interface or command language
interpreter (CLI), also known as command-line user
interface, console user interface and character user
interface (CUI), is a means of interacting with a computer
9

program where the user (or client) issues commands to the


program in the form of successive lines of text (command
lines). A program which handles the interface is called
a command language interpreter or shell.

 Introduction to Operation System(DOS)


DOS (Disk Operating System) is an operating system that
runs from a hard disk drive. The term can also refer to a
particular family of disk operating systems, most
commonly MS-DOS (Microsoft Disk Operating System).
An operating system (OS) is the software that controls a
computer's hardware and peripheral devices and allows
other programs to function.
10

 Difference b/w Internal and External


Commands
Internal
These commands are automatic loaded into the memory when
operating system is loaded into the memory. Thus these are also
called memory-resident commands. The command available are
all combined together and are stored in Command.com file, which
is a executable command file.
External
External commands are known as Disk residence commands.
Because they can be store with DOS directory or any disk which is
used for getting these commands. Theses commands help to
perform some specific task.
 All commands using help
By using help command
For more information on a specific command, type HELP
command-name
ASSOC Displays or modifies file extension associations.
ATTRIB Displays or changes file attributes.
BREAK Sets or clears extended CTRL+C checking.
BCDEDIT Sets properties in boot database to control boot
loading.
CACLS Displays or modifies access control lists (ACLs) of files.
11

CALL Calls one batch program from another.


CD Displays the name of or changes the current directory.
CHCP Displays or sets the active code page number.
CHDIR Displays the name of or changes the current directory.
CHKDSK Checks a disk and displays a status report.
CHKNTFS Displays or modifies the checking of disk at boot
time.
CLS Clears the screen.
CMD Starts a new instance of the Windows command
interpreter.
COLOR Sets the default console foreground and background
colors.
COMP Compares the contents of two files or sets of files.
COMPACT Displays or alters the compression of files on NTFS
partitions.
CONVERT Converts FAT volumes to NTFS. You cannot convert
the current drive.
COPY Copies one or more files to another location.
DATE Displays or sets the date.
DEL Deletes one or more files.
DIR Displays a list of files and subdirectories in a directory.
DISKPART Displays or configures Disk Partition properties.
DOSKEY Edits command lines, recalls Windows commands,
and creates macros.
DRIVERQUERY Displays current device driver status and
properties.
ECHO Displays messages, or turns command echoing on or
off.
ENDLOCAL Ends localization of environment changes in a
batch file.
12

ERASE Deletes one or more files.


EXIT Quits the CMD.EXE program (command interpreter).
FC Compares two files or sets of files, and displays the
differences between them.
FIND Searches for a text string in a file or files.
FINDSTR Searches for strings in files.
FOR Runs a specified command for each file in a set of files.
FORMAT Formats a disk for use with Windows.
FSUTIL Displays or configures the file system properties.
FTYPE Displays or modifies file types used in file extension
associations.
GOTO Directs the Windows command interpreter to a
labeled line in
a batch program.
GPRESULT Displays Group Policy information for machine or
user.
GRAFTABL Enables Windows to display an extended character
set in
graphics mode.
HELP Provides Help information for Windows commands.
ICACLS Display, modify, backup, or restore ACLs for files and
directories.
IF Performs conditional processing in batch programs.
LABEL Creates, changes, or deletes the volume label of a
disk.
MD Creates a directory.
MKDIR Creates a directory.
MKLINK Creates Symbolic Links and Hard Links
MODE Configures a system device.
MORE Displays output one screen at a time.
13

MOVE Moves one or more files from one directory to


another
directory.
OPENFILES Displays files opened by remote users for a file
share.
PATH Displays or sets a search path for executable files.
PAUSE Suspends processing of a batch file and displays a
message.
POPD Restores the previous value of the current directory
saved by
PUSHD.
PRINT Prints a text file.
PROMPT Changes the Windows command prompt.
PUSHD Saves the current directory then changes it.
RD Removes a directory.
RECOVER Recovers readable information from a bad or
defective disk.
REM Records comments (remarks) in batch files or
CONFIG.SYS.
REN Renames a file or files.
RENAME Renames a file or files.
REPLACE Replaces files.
RMDIR Removes a directory.
ROBOCOPY Advanced utility to copy files and directory trees
SET Displays, sets, or removes Windows environment
variables.
SETLOCAL Begins localization of environment changes in a
batch file.
SC Displays or configures services (background processes).
14

SCHTASKS Schedules commands and programs to run on a


computer.
SHIFT Shifts the position of replaceable parameters in batch
files.
SHUTDOWN Allows proper local or remote shutdown of
machine.
SORT Sorts input.
START Starts a separate window to run a specified program
or command.
SUBST Associates a path with a drive letter.
SYSTEMINFO Displays machine specific properties and
configuration.
TASKLIST Displays all currently running tasks including
services.
TASKKILL Kill or stop a running process or application.
TIME Displays or sets the system time.
TITLE Sets the window title for a CMD.EXE session.
TREE Graphically displays the directory structure of a drive
or
path.
TYPE Displays the contents of a text file.
VER Displays the Windows version.
VERIFY Tells Windows whether to verify that your files are
written
correctly to a disk.
VOL Displays a disk volume label and serial number.
XCOPY Copies files and directory trees.
WMIC Displays WMI information inside interactive
command shell.
15

Text file

Time cmd

Data cmd

Volum cmd
16

Version cmd

Directory cmd

Help Directory cmd


17

Backward cmd
18

Full Backward cmd

Help Color cmd


19

Color cmd

Attrib hide and un hide cmd


20

Hide

Unhide
21

Creat and Removed directory cmd

Create
22

Removed

 Diskpart utility
before
23

After
24

 Network commands
Ip configuration cmd

Ping cmd
25

Trace cmd
26

 CPU Scheduling
27

#include<iostream>
#include<conio.h>
using namespace std;
class cpus
{
int n,bt[20]; // bt( bust time),
n(no of processes)
float atat,awt,wt[20],tat[20];
//atat(averge turn aournd time),awt(averge
waiting time),wt(waiting time),tat(turn
aournd time)
public:
void getdata();
void fcfs ();
void sjf();
void rr();
void p();
};
// get processes and bust time
void cpus::getdata()
28

{
int i;
cout<<"Enter the no of processes
max[20]=";
cin>>n;
for( i=1;i<=n;i++)
{
cout<<"Enter bust time of proesses
p"<<i<<"=";
cin>>bt[i];
}
}
//First come First served Algorithm
void cpus::fcfs()
{
int i=1,b[20];
float sum=0.0,sum1=0.0;
atat=0.0;
b[1]=bt[1];
wt[0]=0;
29

for(i=1;i<=n;i++)
{
b[i]=bt[i];
cout<<"p"<<i<<"="<<b[i]<<"\t";
}
cout<<"\n\n FCFS \n\n";

cout<<"\n prosses \t bust time \t waiting


time \t turn around time";
for(i=1;i<=n;i++)
{
b[i]=bt[i];
cout<<"\np"<<i<< "\t\t \t";
cout<<b[i]<<" \t\t";
wt[i]=b[i]+wt[i-1];
cout<<wt[i-1]<<" \t \t";
tat[i]=wt[i];
cout<<tat[i];
sum+=wt[i]-bt[i];
sum1+=tat[i];
30

}
awt=sum/n;
atat=sum1/n;
cout<<"\nThe Averge of waiting time
="<<awt;
cout<<"\nthe averge of the turnaround
time ="<<atat;
}
//Shortest job First Algorithm
void cpus::sjf()
{
int i,j,temp,b[20];
float sum=0.0,sum1=0.0;
for(i=1;i<=n;i++)
{
b[i]=bt[i];
cout<<"p"<<i<<"="<<b[i]<<"\t";
}
cout<<"\n\n SJF
\n\n";
31

for(i=n;i>=1;i--)
{
for(j=2;j<=n;j++)
{
if(b[j-1]>b[j])
{
temp=b[j-1];
b[j-1]=b[j];
b[j]=temp;
}

}
}
wt[0]=0;
cout<<"\n prosses \t bust time \t
waiting time \t turn around time";
for(i=1;i<=n;i++)
{
cout<<"\np"<<i<<"\t\t\t";
cout<<b[i]<<"\t\t";
32

wt[i]=b[i]+wt[i-1];
cout<<wt[i-1]<<"\t\t";
tat[i]=wt[i];
cout<<tat[i];
sum+=wt[i]-b[i];
sum1+=tat[i];
}
awt=sum/n;
atat=sum1/n;
cout<<"\nThe Averge of waiting time
="<<awt;
cout<<"\nthe averge of the turnaround
time ="<<atat;
}
//Round Robin Algorithm
void cpus::rr()
{
int i,j,b[20],qt,totalbt,temp,count,value;
float sum=0.0,sum1=0.0;
count=0,value=0;
33

cout<<"Enter the Quantum=";


cin>>qt;
for(i=1;i<=n;i++)
{
b[i]=bt[i];
cout<<"p"<<i<<"="<<b[i]<<"\t";
totalbt=totalbt+b[i];
}
for(j=1;j<=totalbt;j++)
{
for(i=1;i<=n;i++)
{
if(b[i]==0)
{
count++;
continue;
}
else if(b[i]<=qt)
{
temp=b[i];
34

b[i]=0;
}
else if(b[i]>qt)
{
b[i]=b[i]-qt;
temp=qt;
}
value=value+temp;
tat[i]=value;
}
}
for(i=1;i<=n;i++)
{

wt[i]=tat[i]-bt[i];
sum+=wt[i];
sum1+=tat[i];
}
cout<<"\n\n Round Robin
\n\n";
35

cout<<"\n prosses \t bust time \t


waiting time \t turn around time";
for(i=1;i<=n;i++)
{
cout<<"\np"<<i<<"\t\t";
cout<<bt[i]<<"\t\t\t";
cout<<wt[i]<<"\t\t";
cout<<tat[i];
}
awt=sum/n;
atat=sum1/n;
cout<<"\nThe Averge of waiting time
="<<awt;
cout<<"\nthe averge of the turnaround
time ="<<atat;
}

// Priority Alogorithm
void cpus::p()
{
36

int
b[20],pr[20],c[20],count[20][99],i,j,temp;
temp=0;
float sum=0,sum1=0;
cout<<"\n priority processes\n";

for (i=1;i<=n;i++)
{
b[i]=bt[i];
cout<<"p"<<i<<"=";
cin>>pr[i];
c[i]=pr[i];
}
cout<<"\n user input
\n"<<endl;
cout<<"processes busttime
priority\n";
for(i=1;i<=n;i++)
{
37

cout<<" p"<<i<<"
"<<b[i]<<" "<<c[i]<<endl;
}
cout<<"\n\n output
table "<<endl;
for(i=n;i>=1;i--)
{
for(j=2;j<=n;j++)
{
if(c[j-1]>c[j])
{
temp=c[j-1];
c[j-1]=c[j];
c[j]=temp;

temp=b[j-1];
b[j-1]=b[j];
b[j]=temp;

}
38

}
}
wt[0]=0;
cout<<"\n\n Priority Alogorithm
\n\n";
cout<<"\n prosses \t bust time \t
waiting time \t turn around time";
for(i=1;i<=n;i++)
{
cout<<"\np"<<i<<"\t\t\t";
cout<<b[i]<<"\t\t";
wt[i]=b[i]+wt[i-1];
cout<<wt[i-1]<<"\t\t";
tat[i]=wt[i];
cout<<tat[i];
sum+=wt[i]-b[i];
sum1+=tat[i];
}
awt=sum/n;
39

atat=sum1/n;
cout<<"\nThe Averge of waiting time
="<<awt;
cout<<"\nthe averge of the turnaround
time ="<<atat;

}
main()
{
cpus c;
int a;
cout<<" 1: First come First served
Algorithm"<<endl;
cout<<" 2: Shortest job First
Algorithm"<<endl;
cout<<" 3: Round Robin
Algorithm"<<endl;
cout<<" 4: Priority Alogorithm"<<endl;
cout<<" 5: All Algorithm"<<endl;
cout<<" 6: Exit"<<endl;
40

do
{
switch(a)
{
case 0:
break;
case 1:
c.getdata();
c.fcfs();
break;
case 2:
c.getdata();
c.sjf();
break;
case 3:
c.getdata();
c.rr();
break;
case 4:
c.getdata();
41

c.p();
break;
case 5:
c.getdata();
cout<<endl;
c.fcfs();
cout<<endl;
c.sjf();
cout<<endl;
c.rr();
cout<<endl;
c.p();
break;
case 6:
break;
}
cout<<"\nEnter your choice=";
cin>>a;
}
while(a<6);
42

return 0;
}
43

 Banker Algorithm
#include<iostream>
#include<conio.h>
using namespace std;
main()
{
int
n,m,tot[10],alloc[10][10],max[10][10],i,j;
int avi[10],need[10][10];
cout<<"Enter no. of processes=";
cin>>n;
cout<<"enter no. of resources=";
cin>>m;
for(i=0;i<m;i++)
44

{
cout<<"Enter no.of instances:";
cin>>tot[i];
}
//create maxium instances matric
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
cout<<"Enter no. of maxium instances of P
"<<i+1<<" allocated to I "<<j+1<<":" ;
cin>>max[i][j];
}
}
//create allocations matrix
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
45

cout<<"Enter no. of instances of


P"<<i+1<<" allocated to A"<<j+1<<":" ;
cin>>alloc[i][j];
}

}
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
tot[j]=tot[j]-alloc[i][j];
avi[j]=tot[j];
}

for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
46

{
need[i][j]=max[i][j]-alloc[i][j];
}
}
cout<<"\nAviable"<<endl;
for(i=0;i<m;i++)
{
cout<<avi[i]<<"\t";
}

cout<<"\nAllocation "<<endl;
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
cout<<alloc[i][j]<<"\t";
}
cout<<"\n";
}
47

cout<<"\n maximum"<<endl;
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
cout<<max[i][j]<<"\t";
}
cout<<endl;
}
cout<<"\nneeded"<<endl;
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
cout<<need[i][j]<<"\t";
}
cout<<endl;
}
int work[10],k,p=0,q,e,f;
for(i=0;i<n;i++)
48

work[i]=avi[i];
k=0;
int ss[10],fin[10];
for(i=0;i<n;i++)
ss[i]=0;
cout<<"\nSafe Sequence\n";
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
if(need[i][j]<=work[j])
{
p++;
if(p==m)
{
p=0;
for(j=0;j<m;j++)
{
work[j]=work[j]+alloc[i][j];
}
49

k++;
cout<<i<<",";
}
}

}
}

/* cout<<"\nSafe Sequence\n";
for(i=0;i<k;i++)
cout<<ss[i]<<",";*/

if(k==n)
cout<<"\nSystem is safe\n";
else
cout<<"\nDeadlock occur \n";

}
50

 FIFO page replacement


algorithm
51

# include <iostream>
# include <conio.h>
using namespace std;
int getp(int count[],int b)
{
int max=count[0];
int pos=0;
for(int i=0;i<b;i++)
{
if(count[i]>max)
{
pos=i;
max=count[i];
}
}
return pos;
}
main()
{
int page[20],frame[10],count[10];
52

int np,nf,pf=0;
cout<<"Enter the number of page
max[20] : ";
cin>>np;
cout<<"Enter the number of frames
max[10] :";
cin>>nf;
cout<<"Enter string:\n";
for(int i=0;i<np;i++)
{
cin>>page[i];
}
cout<<"The page refernces string :";
for(int i=0;i<np;i++)
{
cout<<page[i]<<" ";
}
for(int i=0;i<nf;i++)
{
frame[i]=0;
53

count[i]=0;
}
for(int i=0;i<np;i++)
{
int f=0,j;
for(j=0;j<nf;j++)
{
if(frame[j]==page[i])
{
f=1; //if page is present in
frames
break;
}
}
// if page is not present in frame
if (f==0)
{
pf++;
for(j=0;j<nf;j++)
{
54

if(frame[j]==0)
{
frame[j]=page[i];
f=1;
count[j]++;
break;
}
}
}
//if there are no ampty frame
if (f==0)
{
int pos,k;
pos=getp (count,nf);
frame[pos]=page[i];
count[pos]=1;
for(k=0;k<nf;k++)
{
if(k!=pos)
{
55

count[k]++;
}
}
}
cout<<endl;
for(j=0;j<nf;j++)
{
cout<<frame[j]<<" ";
}

cout<<"\n Page Falut :"<<pf;


return 0;
}
56

Вам также может понравиться