Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
66 views39 pages

MCA 1 Sem OS Practical Assignments Solution 2022-23

Uploaded by

vfx.fun.extra88
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views39 pages

MCA 1 Sem OS Practical Assignments Solution 2022-23

Uploaded by

vfx.fun.extra88
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 39

Operating System Practical Assignments 1

SSIT, Ratlam
MCA 1st Sem.
MCA-103 : Operating System and Architecture
Practical Assignments

1. To Study DOS (Disk Operating System)


Internal Commands: DIR, CD, COPY, DEL, REN, MD, RD, CLR, EXIT, COPY CON,TYPE, DATE, TIME, VER
etc.

DOS Commands
DOS Commands are instructions to perform tasks on files and directories very useful to
Windows users. DOS commands are case insensitive. And as you already know, file is
the area where we store group of information or data, and collection of group of files is
called a directory.

In MS-DOS the file name follow 8dot3 format and is divided into two parts – primary
name and secondary name. Primary name is up to 8 characters long and secondary name
is up to 4 characters with dot. For example, in the file-name Logo.jpg, Logo is the
primary name and .jpg is the secondary name. Secondary names are fixed for particular
type of file, meaning for system files the secondary name is designated as .sys, for text
files it is .txt and so on. To name a file or directory special characters like < > , . / * ? | &
Space are not allowed. Here is the list of some of the important types of files with their
default secondary names:

Text file .txt

Command file .com

System file .sys

Programme file .prg

Database file .dbm

Library file .lib

Batch file .bat

Executable file .exe

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 2

DOS Commands are divided into 2 types:

1. Internal Commands
These are for performing basic operations on files and directories and they do not
need any external file support.

2. External Commands
These external commands are for performing advanced tasks and they do need
some external file support as they are not stored in COMMAND.COM

There are also Batch commands or Batch files which are text files that contain a list of
internal and/or external commands which are executed in sequence when the batch file is
executed. AUTOEXEC.BAT gets executed automatically on booting.
In MS-DOS, keyboard shortcuts involving handy ones like Functional keys, arrows, pipe
character (” | “), asterisk (*), ?, [] and ESC are of great help for recalling to searching to
clearing command line etc., Here are few of them:

 UP (↑) and DOWN (↓) arrows recall previously entered commands.


 ESC clears the present command line. It abandons the currently construct command
and the next prompt appears.
 F1 or → retypes one character at a time from the last command entry from the
current cursor position.
 F2 retypes all characters from the last command entry up to the one identical to
your next keystroke. It asks you to enter char to copy up to and retypes the last
command up to that char.
 F3 retypes all remaining characters from the last command entry.
 F4 stores all characters beginning at the first match with your next keystroke and
ending with the last command entry.
 F5 or F8 keys give all the previously typed commands.
 F6 places a special end-of-file code at the end of the currently open file. Sometimes
referred to as Ctrl+z or ^z.
 F7 key displays command history and ALT+F7/ESC hides it.
 F9 is used to select a command by number. Just enter the command number and it
fetches the command line for you.
 Pipe character (” | “) combines several series of commands or programs inter-
dependent.
 Name enclosed within [] indicate a sub-directory.
 Asterisk (*) is used to represent zero or more any characters.
 ? is used to present zero or single character.

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 3

MS-DOS commands perform tasks like:

 Manage files and directories


 Maintain Disks
 Configure Hardware and Networking
 Optimize the use of memory
 Customize MS-DOS

Most Commonly Used Internal DOS Commands

1. DATE
This command is used to display the system current date setting and prompt you to
enter a new date.
The syntax is: DATE [/T | date]

If you type DATE without parameters then it displays current date and prompts to
enter new date. We should give new date in mm-dd-yy format. If you want to keep
the same date just Press ENTER. DATE command with /T switch tells the
command to just output the current system date, without prompting for a new date.

2. TIME
This command is used to displays or set the system time.
The syntax is: TIME [/T | time]

Same as DATE command, typing TIME with no parameters displays the current
time and a prompt for a new one. Press ENTER to keep the same time. TIME
command used with /T switch tells the command to just output the current system
time, without prompting for a new time.

3. COPY CON

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 4

It is used to create a file in the existing directory. Here CON is a DOS reserved
word which stands for console.
Syntax is: COPY CON filename
after that press Enter and start typing your text and after you’re done typing your
text, to save and exit hit F6 key.

4. TYPE
This command is used to display the contents of a text file or files. The syntax is:
TYPE [drive:][path]filename
Now, lets try to display the contents of the file named filename we’ve created
earlier using COPY CON command.

5. CLS
It is used to clear the screen. Syntax is
CLS

6. REN
This command is used to change/modify the name of a file or files.
Syntax is:
REN [drive:] [path] filename1 filename2.
Here, filename1 is source file for which you wanted to change the name, and
filename2 will obviously becomes your new file name. Also note that you cannot
specify a new drive or path for your destination file.

7. DIR
This command displays a list of files and subdirectories in a directory. Syntax is:
DIR
DIR [drive:] [path] [filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L]
[/N] [/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]
Here,

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 5

[drive:][path]
[filename] Specifies drive, directory, and/or files to list.

Displays files with specified attributes. The possible attributes


are as follow: D → Directories, R → Read-only files, H →
Hidden files, A → Files ready for archiving, S → System files, –
/A:attributes Prefix meaning not

/B display in bare format with no heading information or summary

Using this attribute with dir by default displays the thousand


/C separator in file sizes. To disable display or separator use /-C

/D Displays file list sorted by column.

/L Uses lowercase in listing file names and sub-directories.

Display in new long list format where filenames are on the far
/N right.

Displays list by files in sorted order. The sortorder attributes are


as follow: N → By name (alphabetic), S → By size (smallest
first), E → By extension (alphabetic), D → By date/time (oldest
/O:sortorder first), G → Group directories first, – Prefix to reverse order

Display page wise pausing after each screenful of information


/P and prompts to press any key to continue.

/Q Displays the owner of a file or files.

Displays files in specified directory and all subdirectories. Bear


caution in using this in your root directory as you may end up in
overflowing information. To stop the screen overflow at any
/S point hit Pause-Break key.

This sorts and displays the list based on time field specified. C
T:timefield for Creation, A for Last Access, W for Last Written

/W Displays list width wise or wide list format.

This is used to display the short names generated for non-8dot3


/X file names.

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 6

Note that switches may be different in the DIRCMD environment variable, in


which case just override present switches by prefixing any switch with – (hyphen),
for example instead of using /P use /-P

8. PATH
This command displays the path that how we have come to the present position or
sets a search path for executable files.
Its Syntax is
PATH [[drive:]path[;…][;%PATH%]]
Typing PATH without any parameters displays the current path under current
directory. Typing PATH ; clears all search-path settings and direct cmd.exe to
search only in the current directory. And including %PATH% in the new path
setting causes the old path to be appended to the new setting.

9. VER
This command displays the version of the Microsoft Windows running on your
computer.

Syntax: VER

10. VOL
It displays the disk volume label and serial number, if they exist for the drive
specified. If no drive is specified it displays for the active drive.
Syntax is
VOL [drive:]

11. DEL/ERASE
Used to delete one or more files.
Syntax is
DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
Here,
tr>

names Specifies a list of one or more files or directories. Wildcards * and ? may be

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 7

used to delete multiple files. * indicates group of unknown characters


whereas using wildcard ? in file-names is for single unknown character.
And using this command if a directory is specified, all files within the
directory will be deleted.

Prompts for (Y)es/(N)o confirmation before deleting each file.

/P

/F Used to force delete read-only files.

Delete specified files from all subdirectories. If Command Extensions are


enabled DEL and ERASE change while using /S switch such that it shows
/S you only the files that are deleted, not the ones it could not find.

/Q Delete in quite mode and do not ask if ok to delete on global wildcard

/ Delete files based on specified attribute. The attributes are: R for Read-only
A:attribute files, S for System files, H for Hidden files, A for files ready for archiving
s and – Prefix meaning not.

12. COPY
This command is useful in copying one or more files to another file or location.
Syntax is
COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/A | /B ] source [/A | /B] [+ source
[/A | /B] [+ …]] [destination [/A | /B]]
The different switches that can be used with this command as follow along with
their use.
source It specifies the file or files to be copied.

/A Indicates an ASCII text file.

/B This switch indicates a binary file.

/D This allows the destination file to be created with decryption.

destinatio
n This specifies the directory and/or filename for the new file or files.

/V Helps to verify new files to be written correctly.

Specifying this switch uses short filename, if available, when copying a file
/N with a non-8dot3 file name.

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 8

If destination file already exists, this switch suppresses prompting to confirm


/Y you want to overwrite it and does it asap.

Contrary to above switch, this causes prompting to confirm you want to


/-Y overwrite an existing destination file.

/Z Copies networked files in restartable mode.

For appending multiple files for source use wildcard or file1+file2+file3 format and
make sure to specify a single file for destination.

13. MD, CD and RD


 MD (or MKDIR) command stand for make directory and it is used to create
a directory. Syntax is
MD [drive:]path
 CD (or CHDIR) stands for create or change directory and it allows to display
the name of or change the current directory or rather we can say come out of a
directory. Syntax is
CD [/D] [drive:][path]
→ Typing CD drive: displays the current directory in the specified drive.
This CD (or CHDIR) command does not treat spaces as delimiters due to
which it allows to CD into a subdirectory name that contains a space without
surrounding the name with quotes.
For example:
CHDIR program files mozilla firefox
is the same as:
CHDIR “program files mozilla firefox”
→ If you type CD without any parameters it displays current drive and
directory. CD.. specifies that you want to change to the higher directory in the
current path. Whereas, using CD you can directly change to parent/root
directory from any location in the current drive.
→Using /D switch changes current drive in addition to current directory for a
drive.

 RD (or RMDIR) command removes or deletes a directory. There are two


conditions to remove any directory – (1) Directory to be removed should be
empty. and (2) We should be outside the directory we are commanding to

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 9

delete.
Syntax is
RD [/S] [/Q] [drive:]path
Here, using the switch /S removes a directory tree meaning it removes all
directories and files in the specified directory in addition to the directory
itself. And using /Q is the quiet mode that doesn’t asks for ok approval to
remove a directory tree.

14. PROMPT
This changes the cmd.exe command prompt. By default the prompt is always set to
the name of current drive followed by > sign.

Customize the Prompt


To customize the prompt to display any text of your choice, use the syntax
prompt anytext
and this will change the prompt to new command prompt an text.

Prompt with Options (or Special Codes)


You can use prompt with options. To let the prompt display the current working
directory use
prompt $p$g
$p in the above signifies the current drive and path.
$g signifies the greater than sign >

The other options used with prompt command are as follows.


Any combination of these can be used with prompt command.
$A & (Ampersand)

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 10

$B | (pipe character)

$C ( (Left parenthesis)

$D Current date

$E Escape code (ASCII code 27)

$F ) (Right parenthesis)

$H Backspace (erases previous character)

$L < (less-than sign) $N Current drive $Q = (equal sign) $T Current time $V


Windows XP version number $_ Carriage return and linefeed $$ $ (dollar sign)

2. To Study DOS (Disk Operating System)


External Commands: EDIT, TREE, DELTREE, PATH, PRINT, FORMAT, FDISK, DISKCOMP, DISKCOPY,
XCOPY, SCAN, ATTRIB, MOVE etc.

Most Commonly Used External DOS Commands

1. EDIT
This command is used to modify or change the data of a file.
Syntax is
EDIT [/B] [/H] [/R] [/S] [filename(s)]

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 11

Using switch /B you can force the edit in monochrome mode. /H displays the
maximum number of lines possible for your system hardware. Whereas using /R
and /S one can load files in read-only mode and force the use of short filenames
respectively. [filename(s)] is used to specify file(s) to go edit. You can use
wildcards (* and ?) to specify multiple files.

2. XCOPY
This command is used to copy files and directory trees from one disk to another
disk.
Syntax is
XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V]
[/W] [/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U] [/K] [/N] [/O]
[/X] [/Y] [/-Y] [/Z] [/EXCLUDE:file1[+file2][+file3]…]

3. LABEL
It is used to create, change, or delete the volume label of a disk.
Syntax is
LABEL [drive:] [label]
LABEL [/MP] [volume] [label]
Here, [drive:] is for secifying the drive letter of a drive to be labelled and [label]
specifies the label of the volume disk. [/MP] is used to specify that the volume
should be created as a mount point and [volume] is used to specify volume name,
usually mentioned after drive letter followed by colon and then giving volume
name required.

4. DISKCOPY
This command copies the contents of one floppy from the source drive to a
formatted or un-formatted floppy disk in the destination drive. This command
copies the data from particular position on the source disk to exactly the same
position on the destination disk. Syntax
Diskcopy A: B:
copies contents of A: to B: drive. This command can be used with /V switch which
verifies that the disk is copied correctly.

5. CHKDSK
This command is used to check a disk and display a status report with properties of
disk like serial number, volume label, memory and other properties along with
errors on the disk if any.
Syntax is
CHKDSK [volume path] [/F] [/V] [/R] [/X] [/I] [/C] [/L[:size]]

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 12

[volume path] is where you specify the drive letter followed by a colon and volume
name to be checked. using /F switch allows you to fix errors on the disk. /V display
full path and/or cleanup message if any. /R is used in tandem with /F and used to
locate bad sectors and recover readable information. If you wanted to perform a less
vigorous check of index entries on the disk then the right option is to use /I or /C
rather then /R as they skip checking of cycles on the volume and helps in reducing
the amount of time required to run chkdsk. Using /X forces the volume to dismount
first before checking is performed. /L:size is all about specifying the log file size in
kilobytes.

6. TREE
This command is very useful to view the list of directories and subdirectories
present on the disk in graphical form. If you wanted to include files also with
directories and subdirectories, then you’ll have to give the command line as tree/f
which presents the tree view of all the content on your disk. Here is the syntax for
this command with allowed switches:
TREE [drive:path] [/F] [/A]
In case you wanted use ASCII instead of extended characters, then go ahead
include /A in the command line.

7. DELTREE
This command is used to remove a directory along with its contents.
Syntax is
deltree [drive:path]
here, [drive:path] specifies the directory name to be deleted. All the subdirectories
and files in this directory will be deleted without prompt and there’s not getting
back. So, keep caution while using this command.

8. DOSKEY
This command is generally used to edits command lines and recalls commands.
Syntax is
DOSKEY [/REINSTALL] [/HISTORY] [text]
Here, /REINSTALL installs new copy of doskey, /HISTORY is used to display all
previously given commands stored in memory. And [text] specifies the commands
you want to record.

9. FIND
This command searches for a specific text string in a file or files. Syntax is
FIND [/V] [/C] [/N] [/I] [/OFF] “string” [[drive:][path]filename[ …]]

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 13

The basic essential elements in the command line for find are – the string enclosed
in ” ” and [[drive:][path]filename(s)]. String specifies the text string to find in the
file and [[drive:][path]filename(s)] specifies the file or files where the text string
search is to be done. If a path is not specified, FIND searches the text typed at the
prompt or piped from another command. When you append /OFF in the command
line, it searches and finds even those files with offline attribute set. Apart from
searching the text string, this command is useful in:

 Displaying all lines not containing the specified string @ /V


 Displaying only the number count of lines containing the text string @ /C
 Displaying line numbers with the displayed lines @ /N

10. SORT
This command is used to arrange the data of a file in alphabetical order (A-Z, 0-9)
or reverse alphabetical order.

Syntax is
SORT [/R] [[drive1:][path1]filename1] [/T [drive2:][path2]] [/O [drive3:]
[path3]filename3]
/R in command line reverses the sort order; that is, the data of the specified file
sorts sorts Z to A, then 9 to 0. [drive1:][path1]filename1 specifies the file to be
sorted. /T [drive2:][path2] is used in cases of data overflow in main memory and it
specifies the path of the directory to hold the sort’s working storage.
And /O [drive3:][path3]filename3 specifies the file where the sorted input is to be
stored.

11. FORMAT
This command creates a new root directory and a File Allocation Table (FAT) for
the disk. In order for MS-DOS to be able to use a new disk you must use this
command to format the disk.

FORMAT with /S switch


When the disk is formatted with /s option, the disk can be used as a booting disk.
C:>DOS>Format A: /s
The above command copies the OS files MSDOS.SYS, IO.SYS and
COMMAND.COM which are required for booting the machine from your system
startup drive to the newly formatted disk. The disk can then be used for booting.
FORMAT with /U switch
Here’s the command

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 14

C:DOS>Format A: /U
This command specifies an Unconditional Format which destroys all existing data
and prevents you from later unformatting the disk.
FORMAT with /Q switch
This can be used only with the previously formatted disk. This deletes FAT, Root
directory and data of disk but doesn’t scan for the bad errors. This is generally used
for Quick formatting.
Warning As Format command deletes all existing data, use this command with
extreme caution. Any disk formatted (except with /U switch) may be later
unformatted using the UNFORMAT command.

12. BACKUP
The Backup command backs up one or more files from one disk to another. You
can backup files onto either a hard disk or on a floppy disk. Syntax is
BACKUP Source Destination
Here source specifies the location of files to be backed up and destination drive
specifies the drive on which you want to store the backup files. The backed-up files
are stored in backup.nnn and control.nnn files where nnn represents the backup disk
number.

Backup with Switches


 The /S switch can be used to backup the contents of all files in the source
including the contents of sub-directories.
 The /N switch can be used to backup only those files that have changed since
the last backup.
 Backup command with /D:mm-dd-yyyy switch will backup files that have
changed since the data specified.

13. RESTORE
The RESTORE command restores files that were backed up by using BACKUP
command. Syntax:
RESTORE drive1 drive2:path
Here drive1 specifies the drive on which backup files are stored.
drive2:path specifies the path to which those backup files will be restored.
► Using backup command with /S switch is used to restore all backup files to their
original directories and sub-directories.

3. To Study Windows Explore (File Explorer).

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 15

Windows Explorer is the file manager used by Windows 95 and later


versions. It allows users to manage files, folders and network connections,
as well as search for files and related components. Windows Explorer has
also grown to support new features unrelated to file management such as
playing audio and videos and launching programs, etc. The desktop and the
taskbar also form part of Windows Explorer. The look, feel and functionalities
of Windows Explorer have been enhanced with each version of Windows.

Starting with Windows 8.0, Windows Explorer has been called File Explorer.

Windows Explorer replaced the programs File Manager and Program Manager
that were used before Windows 95. In addition to file management,
Windows Explorer also provides shell services as well as manages the
desktop, the Start menu and the taskbar.

Windows Explorer should not be confused with Internet Explorer. The former
is a file browser, whereas the latter is a Web browser. There are different
ways to run Windows Explorer: one is by holding down the Windows button
on the keyboard (the button with the Windows logo) and then pressing the
"E" key. Another way is by clicking the Start menu and then "Run" and then
typing in "explorer" in the dialog box that appears.

Starting with Windows 8, the Ribbon interface was introduced to Windows


Explorer, now called File Explorer. This feature provides users with all the
commands needed for file access and file management.

Alternatively referred to as Windows Explorer or Explorer, File


Explorer is a file browser found in every version of Microsoft Windows since
Windows 95. It is used to navigate and manage the drives, folders,
and files on your computer. The image below shows File Explorer in Windows
10.

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 16

How to open Windows Explorer


There are several ways to open a new Explorer window, which vary
slightly depending on which version of Windows you are running.

If you repeat any of the options below, you can open two or more
separate Explorer windows.

In all versions of Windows

 Press Windows key+E (hold down the Windows key and press E).
 Click Start and select Run (or press Windows key+R),
type explorer or explorer.exe, and press Enter.
 If displayed on the Windows desktop, click or double-click the My
Computer icon (named Computer in Windows Vista & 7, and This PC in
Windows 8 & 10).

In Windows 10

 Press the Windows key+X to open the Power User Tasks Menu, then select File
Explorer (or press E).
 Click Start, select Windows System, then File Explorer.

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 17

In Windows 8 and 8.1

Right-click the bottom-left corner of the screen to open the Power User
Tasks Menu and select File Explorer (or press E).

In Windows 7 and earlier versions

Right-click Start and select Explorer or Open Windows Explorer.

File Explorer sections


Below is a diagram of the different sections of File Explorer, with brief
explanations of each.

 Toolbar - A quick menu for navigating around File Explorer. You can
customize what is shown here by clicking Customize Quick Access
Toolbar.
 Ribbon - Each section of the Ribbon, Home, Share, and View, has multiple
options for accessing features and executing actions in File Explorer. For
example, Home has standard features like copy and paste, and adding a
new folder.

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 18

 Back, Forward, Up - Pressing Back takes you to the last folder you were
viewing. Pressing Forward, moves to the next folder. Pressing Up takes you
to the drive or folder location of the object you're viewing, or to the Desktop
folder, depending on your location in File Explorer.
 Left Pane - Shows all the main devices and drives that are connected to
your computer. It also shows the network your computer is connected to, if
any.
 Status Bar - Shows the number of files or folders in each location and each
file or folder's size.
 Address Bar - Shows your current location in File Explorer. You can also use
this to type a drive or file you want to access.
 Search Bar - Allows you to search for a drive, folder, or file name.
 File List - Displays the current list of files in the selected drive or folder.

Examples of how Windows Explorer could be used

Below are examples of what can be done in Explorer.

Open a document

Microsoft made it easier to find your documents in Windows by


creating a My Documents folder. In Explorer, you can open My
Documents and double-click a document file to open the document.

Open a program

Although most programs create a shortcut to programs in the Start


menu or Start Screen after installing, you can also open a program
through Explorer. To open a program in Explorer, browse the Program
Files folder by opening the C: drive and then double-clicking the
Program Files folder. In the folder list, find the program you want to
open and double-click its folder. In the program's folder, find
the executable file and double-click that file to run the program.

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 19

Since file extensions may be hidden, you can determine an executable


by looking for a file with the same name as the program.

Search for a file or folder

In the Search tab, you can find files or folders on your computer. Press
the F3 shortcut key to open search at any time while in Windows
Explorer.

Other system tasks and functions

Using Windows Explorer, you can also perform any of the system tasks
listed below.

 Copy a file: How to copy files.


 Move a file: How to move files and folders on the computer.
 Rename a file: How to change or rename a file, folder, or directory.
 Delete a file: How to delete a file, directory, or folder.
 Change and view drives: How to see all drives available on the computer.
 Create a shortcut: How to create a Windows shortcut.

4. To Study Windows Control Panel.

The Control Panel in Microsoft Windows enables a user to change various


computer hardware and software features. Settings for
the mouse, display, sound, network, and keyboard represent a few examples
of what may be modified in the Control Panel. Below are examples of how
the Control Panel appeared in Windows.

In Windows 7, Windows 8, and Windows 10, you can use the search
box in the top-right corner of the Control Panel window to find the area
you're looking to adjust. For example, type firewall to search for
the Firewall settings in the Control Panel.

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 20

In Windows 8 and Windows 10, Microsoft is trying to transition users


away from using the Control Panel in favor of Windows Settings.

A Mac computer and Chromebook do not have a Control Panel. The


closest equivalent is System Preferences on a Mac and Settings on a
Chromebook.

Sections of the Windows Control Panel


There are eight main areas on the Control Panel, containing different
tools designed to optimize your computer.

 System and Security - A section to check your computer's status, backup


and restore, and others.
 Network and Internet - View network status.
 Hardware and Sound - View which devices are on your computer and add
devices.
 Programs - Uninstall programs.
 User Accounts - Change user accessibility.
 Appearance and Personalization - Change desktop options, like fonts and
screen readers.
 Clock and Region - Change date and time.
 Ease of access - Optimize your display settings.

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 21

The evolution of the Windows Control Panel

Microsoft Windows 7 Control Panel

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 22

Microsoft Windows XP Control Panel

Microsoft Windows 98 Control Panel

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 23

How to open the Control Panel in Windows 10


In Windows 10, the Control Panel has largely been superseded by
the Settings App. To open the Settings app, open the Start Menu and
click the gear icon (⚙), or press Win+I (hold down the Windows
Key and press "i").

However, the traditional Control Panel is still available:

There are several ways to open the Control Panel in Windows 10.

From the Start Menu

1. Open the Start Menu.

2. Scroll down to W, click Windows System, then click Control


Panel.

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 24

From the Cortana search bar

1. The Cortana search bar is on the left side of the taskbar, next to
Start Menu button. Click the search bar to place your cursor in this
box.

2. Type the word control. Cortana lists best matches above as you
type. In this list, select Control Panel.

From the Run box

The control command may be used to open the Control Panel. For
instance:

1. Open the Run box by pressing Win+R (hold down the Windows key on
your keyboard, then press the R key).

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 25

2. Type control and press Enter.

As mentioned below, you can also run the control command from the
Windows 10 Command Prompt.

How to open the Control Panel in Windows 8 and 8.1


1. Move the mouse to the bottom left corner of the screen and right-
click.

2. In the Power User Menu, select Control Panel.

If you are having trouble finding a specific icon, there is a search box
in the top-right corner of the Control Panel window.

How to open the Control Panel in Windows Vista and 7


1. On the Windows desktop screen, click Start.

2. Click Control Panel on the right side of the Start Menu.

3. You may see a window similar to the following image. You may also
see the expanded version of the Control Panel, with icons for all the
various utilities available in the Control Panel.

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 26

Microsoft Windows 7 Control Panel

5. To implement the CPU Scheduling Algorithm FCFS (First Come First Serve).
In Multiprogramming systems, the Operating system schedules the processes on the CPU to
have the maximum utilization of it and this procedure is called CPU scheduling. The Operating
System uses various scheduling algorithm to schedule the processes.

C program on FCFS (First come first serve) in operating system.

In this scheduling algorithm we allocate CPU to process that comes first in the
ready queue. That is, the process that comes first in the ready queue will
gets the CPU first. So it's called first come first serve algorithm.

It is Non preemptive it means in FCFS Scheduling once the CPU has been
allocated to a process , the process keeps the CPU until it releases the CPU
either by terminating or by requesting I/O.
Advantage:-

 Easy to implement
 Easy to understand
 The simplest form of a CPU scheduling algorithm

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 27

Disadvantage:-

 Average waiting time is often quite longer


 Because of its simplicity, FCFS is not very efficient
 Not an ideal technique for time-sharing systems

C program:-

Here I am going to give to two solution .In the first Code we will just use
Array and in the second Code we will use structure .

In this code we simply declare Some array for the arrival time , Burst time ,
Waiting time, and turn around time .

First we take a input from the user which is number of process in the Ready
queue. then After we take Arrival time and Burst time of all the process one by
one. Aftet that we will calculate the waiting time and Turn Around time of all
the process and store it in the Array WT and TT respectively .
#include<stdio.h>
int main()
{
int AT[10],BT[10],WT[10],TT[10],n;
int burst=0,cmpl_T;
float Avg_WT,Avg_TT,Total=0;
printf("Enter number of the process\n");
scanf("%d",&n);
printf("Enter Arrival time and Burst time of the process\n");
printf("AT\tBT\n");
for(int i=0;i<n;i++)
{
scanf("%d%d",&AT[i],&BT[i]);
}

// Logic for calculating Waiting time


for(int i=0;i<n;i++)
{
if(i==0)
WT[i]=AT[i];
else
WT[i]=burst-AT[i];
burst+=BT[i];
Total+=WT[i];
}
Avg_WT=Total/n;

// Logic for calculating Turn around time

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 28

cmpl_T=0;
Total=0;
for(int i=0;i<n;i++)
{
cmpl_T+=BT[i];
TT[i]=cmpl_T-AT[i];
Total+=TT[i];
}
Avg_TT=Total/n;

// printing of outputs

printf("Process ,Waiting_time ,TurnA_time\n");


for(int i=0;i<n;i++)
{
printf("%d\t\t%d\t\t%d\n",i+1,WT[i],TT[i]);
}
printf("Average waiting time is : %f\n",Avg_WT);
printf("Average turn around time is : %f\n",Avg_TT);
return 0;
}

Output:-
Enter number of process
3
Enter Arrival time and Burst time of the process
At BT
0 2
1 4
2 3
Process , Waiting_time , TurnA_time
1 0 2
2 1 5
3 4 7
Average waiting time is : 1.666667
Average turn around time is : 4.666667

6. To implement the CPU Scheduling Algorithm SJF (Shortest Job First).

Here we are going discuss all things about the SJF scheduling algorithm i.e what is SJF , what are
the advantage of SJF , what is disadvantage of SJF ,Code of SJF.

What is SJF(Shortest job First) scheduling:-

As it is clear by the name of this scheduling algorithm the job which has the
less burst time will get the CPU first. it is the best method to minimize the
waiting time.

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 29

Characteristics:-

 Sjf scheduling can be either preemptive or non-preemptive.


 In SJF CPU is assigned to the process that has the smallest next CPU Burst
time.
 If the next CPU Burst of two process is the same then FCFS scheduling is
used to break the tie.
 This process give the minimum average waiting time for a given processes.

Program of SJF(Shortest job first ) Scheduling algorithm (Non -


preemptive) of Os in c

Code:-

This code is for Non preemptive Shortest job first algorithm


In this code first we are creating the structure for the process in which we are
declaring the id, waiting time, Arrival time, Burst time and turnaround time,
then after an array of the structure type.

logic:-

1. After taking the input first we sort the input on the basis of Arrival time (i.e
the process which have less Arrival time will come first).

Here one more things we will do. we will check that the arrival time of all the
processes are different or not. (Example:- if all the processes comes at the
same time then we don't need to sort the array on the basis of arrival time ) .
for checking this we will use check_ar.

2. After doing this if processes are arrived at the different time then we can
easily calculate the waiting and turnaround time for the first process. and for
other process first we will find the minimum burst time of the process which
are arrived at cmp_time (completion time of the previous process) .

You can easily understand by following code.


#include<stdio.h>
struct process
{
int id,WT,AT,BT,TAT;
};
struct process a[10];

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 30

// function for swapping


void swap(int *b,int *c)
{
int tem;
tem=*c;
*c=*b;
*b=tem;
}

//Driver function
int main()
{
int n,check_ar=0;
int Cmp_time=0;
float Total_WT=0,Total_TAT=0,Avg_WT,Avg_TAT;
printf("Enter the number of process \n");
scanf("%d",&n);
printf("Enter the Arrival time and Burst time of the process\n");
printf("AT BT\n");
for(int i=0;i<n;i++)
{
scanf("%d%d",&a[i].AT,&a[i].BT);
a[i].id=i+1;
// here we are checking that arrival time
// of the process are same or different
if(i==0)
check_ar=a[i].AT;

if(check_ar!=a[i].AT )
check_ar=1;

}
// if process are arrived at the different time
// then sort the process on the basis of AT
if(check_ar!=0)
{
for(int i=0;i<n;i++)
{
for(int j=0;j<n-i-1;j++)
{
if(a[j].AT>a[j+1].AT)
{
swap(&a[j].id,&a[j+1].id);
swap(&a[j].AT,&a[j+1].AT);
swap(&a[j].BT,&a[j+1].BT);
}
}
}
}

// logic of SJF non preemptive algo


// if all the process are arrived at different time

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 31

if(check_ar!=0)
{
a[0].WT=a[0].AT;
a[0].TAT=a[0].BT-a[0].AT;
Cmp_time=a[0].TAT;
Total_WT=Total_WT+a[0].WT;
Total_TAT=Total_TAT+a[0].TAT;
for(int i=1;i<n;i++)
{
int min=a[i].BT;
for(int j=i+1;j<n;j++)
{
if(min>a[j].BT && a[j].AT<=Cmp_time)
{
min=a[j].BT;
swap(&a[i].id,&a[j].id);
swap(&a[i].AT,&a[j].AT);
swap(&a[i].BT,&a[j].BT);
}

}
a[i].WT=Cmp_time-a[i].AT;
Total_WT=Total_WT+a[i].WT;
// completion time of the process
Cmp_time=Cmp_time+a[i].BT;

// Turn Around Time of the process


// compl-Arival
a[i].TAT=Cmp_time-a[i].AT;
Total_TAT=Total_TAT+a[i].TAT;

}
}

// if all the process are arrived at same time


else
{
for(int i=0;i<n;i++)
{
int min=a[i].BT;
for(int j=i+1;j<n;j++)
{
if(min>a[j].BT && a[j].AT<=Cmp_time)
{
min=a[j].BT;
swap(&a[i].id,&a[j].id);
swap(&a[i].AT,&a[j].AT);
swap(&a[i].BT,&a[j].BT);
}

}
a[i].WT=Cmp_time-a[i].AT;

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 32

// completion time of the process


Cmp_time=Cmp_time+a[i].BT;

// Turn Around Time of the process


// compl-Arrival
a[i].TAT=Cmp_time-a[i].AT;
Total_WT=Total_WT+a[i].WT;
Total_TAT=Total_TAT+a[i].TAT;

Avg_WT=Total_WT/n;
Avg_TAT=Total_TAT/n;

// Printing of the results


printf("The process are\n");
printf("ID WT TAT\n");
for(int i=0;i<n;i++)
{
printf("%d\t%d\t%d\n",a[i].id,a[i].WT,a[i].TAT);
}

printf("Avg waiting time is:- %f\n",Avg_WT);


printf("Avg turn around time is:- %f",Avg_TAT);
return 0;
}

Output:-
Enter the number of process
4
Enter the Arrival time and Burst time of the process
AT BT
0 2
2 3
2 4
3 3
The process are
ID WT TAT
1 0 2
2 0 3
4 2 5
3 6 10
Avg waiting time is:- 2.000000
Avg turn around time is:- 5.000000

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 33

7. To implement the CPU Scheduling Algorithm RR (Round Robin).

What is round robin scheduling:-

 In this technique ready queue is treated as circular queue.


 In this technique each process is provided a fix time execute which is called
time quantum (or time slice).
 CPU goes around the ready queue allocating the CPU to each process for a
time interval up to 1 time quantum.
 It is only preemptive.
 This algorithm gives minimum average response time for a given set of
process.
 Widely used scheduling method in traditional OS.
 It is designed especially for time sharing system or multi-tasking system.

Code:-
#include<stdio.h>
struct process
{
int id,AT,BT,WT,TAT;
};

struct process a[10];

// declaration of the ready queue


int queue[100];
int front=-1;
int rear=-1;

// function for insert the element


// into queue
void insert(int n)
{
if(front==-1)
front=0;
rear=rear+1;
queue[rear]=n;
}

// function for delete the


// element from queue
int delete()

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 34

{
int n;
n=queue[front];
front=front+1;
return n;
}
int main()
{
int n,TQ,p,TIME=0;
int temp[10],exist[10]={0};
float total_wt=0,total_tat=0,Avg_WT,Avg_TAT;
printf("Enter the number of the process\n");
scanf("%d",&n);
printf("Enter the arrival time and burst time of the process\n");
printf("AT BT\n");
for(int i=0;i<n;i++)
{
scanf("%d%d",&a[i].AT,&a[i].BT);
a[i].id=i;
temp[i]=a[i].BT;
}
printf("Enter the time quantum\n");
scanf("%d",&TQ);
// logic for round robin scheduling

// insert first process


// into ready queue
insert(0);
exist[0]=1;
// until ready queue is empty
while(front<=rear)
{
p=delete();
if(a[p].BT>=TQ)
{
a[p].BT=a[p].BT-TQ;
TIME=TIME+TQ;
}
else
{
TIME=TIME+a[p].BT;
a[p].BT=0;
}

//if process is not exist


// in the ready queue even a single
// time then insert it if it arrive
// at time 'TIME'
for(int i=0;i<n;i++)
{
if(exist[i]==0 && a[i].AT<=TIME)

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 35

{
insert(i);
exist[i]=1;
}
}
// if process is completed
if(a[p].BT==0)
{
a[p].TAT=TIME-a[p].AT;
a[p].WT=a[p].TAT-temp[p];
total_tat=total_tat+a[p].TAT;
total_wt=total_wt+a[p].WT;
}
else
{
insert(p);
}
}

Avg_TAT=total_tat/n;
Avg_WT=total_wt/n;

// printing of the answer


printf("ID WT TAT\n");
for(int i=0;i<n;i++)
{
printf("%d %d %d\n",a[i].id,a[i].WT,a[i].TAT);
}
printf("Average waiting time of the processes is : %f\n",Avg_WT);
printf("Average turn around time of the processes is : %f\n",Avg_TAT);
return 0;
}

Output:-
Enter the number of the process
3
Enter the arrival time and burst time of the process
AT BT
0 5
2 7
4 6
Enter the time quantum
3
ID WT TAT
0 3 8
1 9 16
2 7 13
Average waiting time of the processes is : 6.333333
Average turn around time of the processes is : 12.333333

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 36

8. To implement the CPU Scheduling Algorithm - Priority Scheduling.

C program to perform Priority Scheduling

The Priority Scheduling Program in C Language is normally implemented in


Operating Systems to schedule multiple process entering the CPU for execution.
This code is for Priority Scheduling Non – Preemptive Algorithm in C
Programming.

In a Priority based Scheduling Algorithm in Operating Systems, every process is


assigned a Priority Number. Based on this Priority Number, the processes are
executed. This scheduling algorithm is normally very useful in real-time systems.
The process having the highest priority (1) is executed first and then priority 2, 3
and so on.

Below is the source code for C Program to input values into an array and display
them which is successfully compiled and run on Windows System to produce
desired output as shown below :

#include<stdio.h>

#include<conio.h>

void main()

int x,n,p[10],pp[10],pt[10],w[10],t[10],awt,atat,i;

printf("Enter the number of process : ");

scanf("%d",&n);

printf("\n Enter process : time priorities \n");

for(i=0;i<n;i++)

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 37

printf("\nProcess no %d : ",i+1);

scanf("%d %d",&pt[i],&pp[i]);

p[i]=i+1;

for(i=0;i<n-1;i++)

for(int j=i+1;j<n;j++)

if(pp[i]<pp[j])

x=pp[i];

pp[i]=pp[j];

pp[j]=x;

x=pt[i];

pt[i]=pt[j];

pt[j]=x;

x=p[i];

p[i]=p[j];

p[j]=x;

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 38

w[0]=0;

awt=0;

t[0]=pt[0];

atat=t[0];

for(i=1;i<n;i++)

w[i]=t[i-1];

awt+=w[i];

t[i]=w[i]+pt[i];

atat+=t[i];

printf("\n\n Job \t Burst Time \t Wait Time \t Turn Around Time Priority \n");

for(i=0;i<n;i++)

printf("\n %d \t\t %d \t\t %d \t\t %d \t\t %d \n",p[i],pt[i],w[i],t[i],pp[i]);

awt/=n;

atat/=n;

printf("\n Average Wait Time : %d \n",awt);

printf("\n Average Turn Around Time : %d \n",atat);

getch();

Shri Sai Institute of Technology, Ratlam (M.P.)


Operating System Practical Assignments 39

OUTPUT

Enter the number of process : 4

Enter process : time priorities

Process no 1 : 3

Process no 2 : 4

Process no 3 : 5

Process no 4 : 6

Job Burst Time Wait Time Turn Around Time Priority

4 6 0 6 4

3 5 6 11 3

2 4 11 15 2

1 3 15 18 1

Average Wait Time : 8

Average Turn Around Time : 12

The End

Shri Sai Institute of Technology, Ratlam (M.P.)

You might also like