0% found this document useful (0 votes)
11 views

Ali Shan (System and NetWork Administration)

This lab manual provides a comprehensive guide for students in System and Network Administration, detailing various labs covering topics like operating systems, networking, utility programs, and server configurations. Each lab includes objectives, required materials, estimated completion times, step-by-step instructions, and review questions to enhance learning. The manual also outlines the history and types of operating systems, the evolution of the internet, and practical exercises for system utilities.

Uploaded by

Muizz Asif
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Ali Shan (System and NetWork Administration)

This lab manual provides a comprehensive guide for students in System and Network Administration, detailing various labs covering topics like operating systems, networking, utility programs, and server configurations. Each lab includes objectives, required materials, estimated completion times, step-by-step instructions, and review questions to enhance learning. The manual also outlines the history and types of operating systems, the evolution of the internet, and practical exercises for system utilities.

Uploaded by

Muizz Asif
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 238

1

LAB MANUAL
(System and Network Administration)

Submitted By:

Name: Ali Shan


Roll No: Bsf2100838

Submitted To:

Teacher: Dr. Allah Ditta


1

INTRODUCTION
The objective of this lab manual is to give students step-by-step examples to become
familiar with programming concepts, design, and coding.

F E AT U R E S
To ensure a successful experience for instructors and students alike, this lab manual
includes the following features:

• Lab Objectives—Every lab has a brief description and list of learning


objectives.

• Materials required—Every lab includes information on software you will


need to complete the lab.

• Completion Times—Every lab has an estimated completion time so that you


can plan your activities more accurately.

• Activity Sections—Labs are presented in manageable sections; where


appropriate, additional Activity Background information is provided to
illustrate the importance of a particular activity.

• Step-by-Step Instructions—Every lab provides steps to enhance technical


proficiency; some labs include Critical Thinking exercises to challenge
students.

• Review Questions—Some labs include review questions to help reinforce


concepts presented in the lab.

• SOFTWARE REQUIREMENTS—Computer running Windows 10


1

Content Page
Lab No:1

• What is operating system? History and Types of Operating System.


Lab No:2

• How to connect multiple computing devices and share folder through


Internet? Also describe what is Internet and history of Internet.
Lab No:3

• What is utility program ?And also Apply system utilities practics.


Lab No:4

• How many type of User Account you have ? Create at least three User With
different Names.
Lab No:5

• How you can perform multiple Partition of Hard disk.


Lab No:6

• How to Create a Bootable USB using Rufus.


Lab No:7

• What is control panel? Practice in detail.


Lab No:8

• What is the concept of virtulization ? And How you can install/configue two
OS on same system give good explaination.
1

Lab No:9

• What is window Server and how u can Install Window Server 2012 with your
existing client Machine.

Lab No:10

• Installation and Configuration of Active Directory (AD)


• Promote this server to a domain controller
• Create first Forest and Domain in Active Directory

Lab No:11

• Creating Organizational Units in AD


• Create Users and Groups with OU
• Move Users from One OU to another OU
• Nested couple of groups within another group

Lab No:12

• Installation and Configuration of DNS (Domain Name Service)


Lab No:13

• Installation and Configuration of DHCP (Dynamic Host Configuration


Protocol).
Lab No:14

• Create User and Group Apply Group Policies.


1

Lab No:15

• Installation and Configuration AD , Create Domain and Rename Domain


name
Lab No:16

• Apply Active Permissions Using Share folder and NTFS


Lab No:17

• DOS to Linux cheat sheet


Lab No:18

• Installation of Linux Operating System flavor (ubantu) using VMW


Lab No:19

• Linux Text Editors (VI ,VIM ,JOE)


Lab No:20

• Installation and Configuration of Squid Sever and LAMP Stack


Lab No:21

• Implementation of Preferences in window Server 2012


Lab No:22

• Implementation of LINUX Permission


Lab No:23
 Scheduling Algorithms ( FCFS , SJF, Priority and Round Robin )
1

Lab1: Date: 21/08/2023

Activity No. 1:

What is operating system? History and Types of Operating


System.
An operating system (OS) is a critical software component that acts as an
intermediary between users and computer hardware. It manages and controls
hardware resources, provides services for software applications, and ensures that
multiple programs can run efficiently and concurrently. The OS serves as a
foundation for computer systems, enabling users to interact with their devices and
run various software.

Key Functions of an Operating System:


• Resource Management: One of the most critical functions of an OS is
managing hardware resources. This includes allocating CPU (Central
Processing Unit) time, memory (RAM), storage (hard drives, SSDs), and
various peripherals (printers, graphics cards) efficiently to ensure that multiple
programs can run concurrently without conflicts.

• Process Management: The OS is responsible for creating, scheduling, and


terminating processes (individual program instances). It ensures that processes
run smoothly, sharing CPU time fairly, and managing their interactions to
prevent crashes and data corruption.

• Memory Management: OS handles memory allocation and protection. It


ensures that each running program has access to the right portion of memory
and prevents one program from accessing or altering the memory of another,
which is crucial for system stability and security.
1

• File System Management: It provides a hierarchical structure for organizing


and storing files on storage devices. The OS handles file creation, deletion,
reading, and writing, as well as ensuring data integrity and security.

• Device Management: Operating systems interact with hardware devices, such


as input/output devices (keyboard, mouse, display), storage devices (hard
drives, SSDs), and network interfaces. They manage device drivers and
provide a standard interface for applications to communicate with these
devices.

• User Interface: OSes offer user-friendly interfaces for interacting with


computers. This can include command-line interfaces (CLI), graphical user
interfaces (GUI), or a combination of both. The user interface allows users to
run applications, manage files, and configure system settings.

• Security and Access Control: Operating systems implement security


mechanisms to protect data and system resources. This includes user
authentication, access control lists, and encryption. They also play a crucial
role in safeguarding the system against malware and unauthorized access.

• Networking: In modern computing, networking is integral. Operating systems


provide networking capabilities, allowing devices to connect to local and wide-
area networks, access the internet, and communicate with other devices.

• Error Handling: OSes monitor the system for errors and hardware failures,
providing error messages and recovery mechanisms to minimize disruptions.

History of Operating Systems

1950s-1960s - Early Operating Systems:


1

• Batch Processing Systems: In the early days of computing, there were no


operating systems. Users had to write programs directly in machine code.
Batch processing systems like IBM's Monitor I were developed to automate
job scheduling and improve efficiency. These systems processed a series of
jobs in a predefined order without user interaction.

1960s-1970s -Time Sharing System:


• Time-Sharing Systems: This era witnessed the development of time-sharing
systems like CTSS (Compatible Time-Sharing System) and Multics.
Timesharing allowed multiple users to interact with a computer
simultaneously, dividing CPU time between users. It introduced the concept
of interactive computing.
• UNIX: In the late 1960s, Ken Thompson and Dennis Ritchie at Bell Labs
created Unix, which became a pioneering operating system. It featured a
hierarchical file system, shell for user interaction, and the concept of pipes,
which allowed commands to be combined. Unix's design principles heavily
influenced subsequent operating systems.

1980s - Rise of Personal Computing:


• Personal Computers: The 1980s saw the advent of personal computers (PCs).
These machines, like the IBM PC, typically ran operating systems such as MS-
DOS (Microsoft Disk Operating System). MS-DOS provided a command-line
interface and was prevalent during the early PC era.
• Graphical User Interfaces (GUIs): Apple's Macintosh introduced a graphical
user interface (GUI), which set new standards for user-friendly computing.
Microsoft's Windows followed suit, leading to the widespread adoption of
GUI-based operating systems.

1990s-Present - Modern Operating Systems:


1

• Modern Operating Systems: Operating systems like Microsoft Windows,


macOS, and various flavors of Unix/Linux have become dominant in the
personal computing space. They offer features like multitasking, memory
protection, and advanced file systems.

• Mobile Operating Systems: With the proliferation of smartphones, mobile


operating systems like iOS (Apple) and Android (Google) have gained
prominence. They are designed for touchscreen devices and support app
ecosystems.
• Real-Time Operating Systems (RTOS): RTOSs prioritize deterministic,
real-time responses, making them ideal for applications like robotics,
aerospace, and industrial control systems.

• Embedded Operating Systems: Embedded OSs are tailored for specific


hardware and tasks. They are used in devices like IoT sensors, appliances, and
automotive systems.

• Distributed Operating Systems: These OSs manage interconnected


computers as a single system, often found in clusters or cloud computing
environments.

Types of Operating Systems


Single-User, Single-Tasking: These systems support only one user and one task at
a time.
Single-User, Multi-Tasking: Most modern desktop and laptop operating systems
fall into this category, allowing a single user to run multiple applications
simultaneously.
Multi-User: Systems like Unix and Linux support multiple users concurrently, each
with their own login and processes.
Real-Time Operating Systems (RTOS): Prioritize deterministic, real-time
responses for critical applications.
1

Network Operating Systems: Manage network resources and facilitate file sharing
and communication among multiple computers.
Mobile Operating Systems: Optimized for smartphones and tablets, offering app
ecosystems and touch-based interfaces.
Embedded Operating Systems: Tailored for specific hardware and tasks,
commonly found in IoT devices, appliances, and automotive systems.

Lab2:
How to connect multi computing devices and share folder through
Internet also describe what is Internet and history of Internet.

Step 1: Find IP address using Command Prompt

Step:2 Make a Folder to share and click right to select properties


1
1

Step:4 Select Advanced Sharing


1

Step:6 Select Allow full Control and Click OK

Step: 7 Select Windows key and r (w+r) for Pingging and write the ip address
that we got in step 1 and Click OK

Step:8 The shared folder will look like this after successfully being shared
1
1

What is Internet:
The Internet, often referred to simply as "the Net," is a global network of
interconnected computer networks that allows billions of devices, including
computers, smartphones, tablets, servers, and more, to communicate with each other.
It is a vast infrastructure that facilitates the exchange of information, data, and
services across the world.

History Of Internet

• Early Computer Networks (1950s-1960s): The origins of the Internet can be


traced back to the late 1950s and early 1960s when the U.S. Department of
Defense's Advanced Research Projects Agency (ARPA) initiated research into
building a robust, decentralized computer network. The result was ARPANET,
which established the basic principles of packet switching and the concept of
a distributed network.

• ARPANET (Late 1960s-1970s): ARPANET, which became operational in


1969, was the first wide-area packet-switching network and is often considered
the precursor to the Internet. It connected four universities and allowed
researchers to share information and resources electronically.

• TCP/IP Protocol (1970s): In the 1970s, the Transmission Control Protocol


(TCP) and Internet Protocol (IP) were developed. These protocols provided
the foundation for data transmission across interconnected networks, allowing
different networks to communicate with each other, giving rise to the term
"Internet."

• Commercialization (1980s): The National Science Foundation (NSF) created


NSFNET in the 1980s, which expanded the Internet beyond military and
research applications. The introduction of the Domain Name System (DNS) in
1983 made it easier to navigate the growing network.
1

• World Wide Web (1990s): Tim Berners-Lee, a British computer scientist,


invented the World Wide Web (WWW) in 1989. In the 1990s, the web became
widely accessible to the public, allowing users to browse and access
information through web pages using browsers like Netscape Navigator and
Internet Explorer.

• Dot-Com Boom (Late 1990s): The late 1990s saw a rapid increase in Internet
usage and the emergence of numerous internet-based companies during the
dot-com boom. Many of these companies, however, experienced the dot-com
bubble burst in the early 2000s.

• Broadband and Mobile Internet (2000s): The 2000s witnessed the


widespread adoption of broadband internet and the proliferation of mobile
devices with internet connectivity. This led to a significant increase in online
services, social networking, and e-commerce.

• Web 2.0 and Social Media (Mid-2000s): The concept of Web 2.0 emerged,
emphasizing user-generated content, collaboration, and social interaction
online. Platforms like Facebook, YouTube, and Twitter gained immense
popularity.

• Cloud Computing (2010s): The 2010s saw the rise of cloud computing
services, which enabled users to store and access data and applications
remotely. This technology transformed the way businesses and individuals use
and manage digital resources.

• Internet of Things (IoT) and 5G (2020s): The Internet of Things, in which


everyday objects are connected to the internet, gained momentum. The rollout
of 5G networks promises faster and more reliable internet connectivity, paving
the way for further IoT expansion and advanced technologies.
1

So, The history of the Internet is marked by innovation, collaboration, and rapid
growth, transforming the world into a globally connected society where information,
communication, and commerce are conducted on a scale that was unimaginable just
a few decades ago. Its evolution continues to shape our modern world in countless
ways.

Lab3:
What is utility program ? And also Apply system utilities practices.

What is a Utility Program :


Utility program is a system application that executes a specific task, generally
pertaining to optimal maintenance or operation of the system resources.
1

Common Tasks Performed by Utility Programs


• Disk Defragmentation
• Disk Clean-up
• File Management
• Compression
• Disk Management
• Antivirus and Firewall

1.Disk Defragmentation
Defragmentation is a process which helps reduce the amount of fragmentation in file
systems. Utility programs function by organizing the disk content and storing the
pieces of each file together. It also helps create large amount of free space using
compaction to impede the return of fragmentation. This happens when any operating
system is unable to allocate space for storage as single unit. Steps :
• Select the search bar on the taskbar and enter defrag.
• Select Defragment and Optimize Drives.
• Select the disk drive you want to optimize.
• Select the Optimize button.
1

2.Disk Clean-up
With the help of utility program in computer, users can remove the unnecessary
files that are taking up the space in their system.By removing unused files, the
system will be able to increase the storage space and optimize the overall speed of
the system. Steps :
1. In the search box on the taskbar, type disk cleanup, and select Disk Cleanup from
the list of results.
2. Select the drive you want to clean up, and then select OK.

3.Under Files to delete, select the file types to get rid of. To get a
description of the file type, select it. Select OK.
1

3.File Management
With the help of file management program, users can perform various functions
related to the files saved in the system, such as searching, renaming, opening,
renaming deleting and grouping.

Compression
One of the biggest concerns of any computer system is its storage space. With
time, the limited storage space in the hard disk starts getting smaller. Therefore,
with the help of compression program such as WinZip and WinRAR, important
yet unused files can be compressed, stored and easily extracted when required.
1

4. Compression
One of the biggest concerns of any computer system is its storage space. With time,
the limited storage space in the hard disk starts getting smaller. Therefore, with the
help of compression program such as WinZip and WinRAR, important yet unused
files can be compressed, stored and easily extracted when required.

Steps:

1. Find a folder you want to compress.


2. Right-click on the folder.
3. "Send To" in the drop-down menu.
4. Select "Compressed (zipped) folder."

5. Done.
2

5. Disk Management
Disk Management is one of the most vital programs that an operating system like
Windows provides. With the help of the system utility software and program,
users can seamlessly manage various drives such as hard drives, optical drives,
flash drives, etc. It helps users in partitioning drives, allocating spaces, format
drives, and much more.

6.Antivirus and Firewall


Antivirus and firewall programs such as Windows Defender help users
protect their computers by getting infected with viruses, adware and
malware.
2

Lab4:
How many type of User Account you have ? Create at least three User
With different Names.

• Write control panel on search bar.


• Control Panel app will show on menu.
• Click on it.
2
2

Create Multiple Account in Microsoft:


• Write Control Panel in search bar and click on it.
• Select User Account.
• Select manage another account.
• Select Add a new User in PC setting.
• Here we can create multiple account.
2
2

Add Family Account:


If you want to share your device with other people like your family and
other person then you should make family account.
There are two types of account Adult account or child account. Both provide
different features.
Adult Account:
An Adult account is very similar to a Child account, but adding
someone as part of your family allows them to manage child accounts.

• Open Settings.
• Click on Accounts.
• Click on Family & other users.
• Under the "Your family" section, click the Add a family member
option.
• Select the Add a member option.
• Click the Invite button.
• Click the Confirm option.
• Click the Close button.
2

Create Child & Adult Account:


2

• Open Settings.
• Click on Accounts.
• Click on Family & other users.
• Under "Your family" section, click the Add a family member
option
• Click on Create one for child.
• Write email.
• Add Password.
• Enter First and Last name.
• Select country and enter DOB.
2
3

Local Account:
• Open Settings.
• Click on Accounts.
• Click on Family & other users.
• Under the "Other users" section, click the Add someone else to
this PC option.
• Click the I don't have this person's sign-in Information
option.
• Click the Add a user without a Microsoft account option.
• Confirm the username.
• Create a password.
3

Lab5:

How you can perform multiple Partition of Hard disk.

Disk Management:
Disk Management is one of the most vital programs that an operating system like
Windows provides. With the help of the utility program, users can seamlessly
manage various drives such as hard drives, optical drives, flash drives, etc.
3

To open Disk Management, right-click this pc and select Manage.

Operations can perform using disk-management:


3

• Open
• Extend volume. Create new volume Shrink volume.
• Delete volume.
• Change Volume / partition letter.
• Change File System type.
Open: Is just to open the selected volume in Windows Explore.

Shrink Volume:
3

Create New Volume:


3
3
3
3

Delete volume:
3

Extend Volume:
5

Change Letter of Volume:


5

Change File System:


5

Lab6:
How to create a USB bootable through Rufus .
5

Rufus is one of several programs that allow you to create an “ISO image” on a USB
stick. To create a bootable USB using Rufus, all you need is:

• Your ISO of choice, e.g. Windows 10


• The latest version of Rufus (available online from https://rufus.ie)
• A spare USB stick (an 8GB USB should be plenty for Windows 10 but make sure
you have one that’s large enough for the ISO you’re using)
Once you’ve got these ready, just follow these steps to make your own bootable USB:

Step 1: Open up Rufus and plug your clean USB stick into your computer.

Step 2: Rufus will automatically detect your USB. Click on Device and choose the
USB you want to use from the drop-down menu.

Step 3: Make sure the Boot Selection option is set to Disk or ISO image then click
Select. Rufus will open a file explorer browser window; locate the ISO image you
want to burn onto the USB and select it.
5
5

Step 4: You’ll generally want to create a Standard Windows installation, and


Rufus will automatically detect the correct Partition Scheme based on your device,
so keep the default settings as they are. However, you can also change these if you
want.

Step 5: Give the Volume label a name of your choice, or leave it as it is, and once
again leave the default settings for File system and Cluster size. Now click Start
5

Note: if the USB you’re using isn’t large enough, you’ll get an error message you
letting you know. In this case, you’ll need to start again with a different larger USB.

Step 6: You’ll get a warning saying that any data on the USB will be destroyed (this is
normal). Click OK and Rufus will start creating the ISO image on the USB.

Step 7: Once Rufus has finished creating the ISO image on the USB, you can close it
and your bootable USB is ready to go!

Lab7:
5

What is control panel? Practice in detail.


5

Security and Maintenance


Security Maintenance removes the unused file and shortcuts and other
maintenance task from your computer. Also, do some more cleanup to
speed up your computer. It would able to find and repair the following
issue: Fix Broken shortcuts.
5

Windows Security

A firewall is software or firmware that prevents unauthorized access to a network.


It inspects incoming and outgoing traffic using a set of rules to identify and block
threats.
5

Administrative Tools
The programs can be used to schedule a test of your computer's memory, manage
advanced aspects of users and groups, format hard drives, configure Windows
services, change how the operating system starts, and much, much more.
5

if(n%i==0){

Network and Sharing


The Network and Sharing Center window is the main location for nearly all
networking operations. To display the Network and Sharing Center window
from the Control Panel Home, select View Network Status and Tasks from
beneath the Network and Internet heading
5

Device Manager
It is used to view and manage all the hardware devices installed on a computer, such
as hard drives, sound cards, USB devices, keyboards, and so on.

Program and Features


The Programs and Features tool shows you a complete list of the apps installed
on your PC. It helps you change, repair, or uninstall software programs in just a
few simple clicks
5

Uers Account
A user account is a collection of settings and permissions, specific to a user, that
determines what a user can and cannot do on the computer. These settings
are also used to protect the user's files and folders from access by other
nonauthorised people
5

Troubleshooting
Troubleshooters initially look for common, known causes. For example, when
a laptop won't boot up, an obvious first step is to check whether the power cable
is working. Once common issues are ruled out, troubleshooters must run through
a checklist of components to identify where the failure is happening.

Steps:

1: First open control panel


2: then all control panel items
3: Troubleshooting

These are the steps to perform troubleshooting on system.


5
5

Uninstall Program
Uninstall is the process of removing or deleting an application or software from
electronic devices such as a personal computer, laptop, smartphone, cellphone,
etc. Uninstall helps in removing applications or programs that are not
functioning or working properly, are outdated or are not being used
anymore
5

Internet Option
The Internet Options section of Control Panel allows you to manage Internet and
Internet Explorer settings for your computer. You can configure security settings
and access settings. You can control add-ons, Active-X controls, and other
components.
5

Backup and Restore


Backup and recovery describes the process of creating and storing copies of data
that can be used to protect organizations against data loss. This is sometimes
referred to as operational recovery.
5

Lab8:
What is the concept of virtulization ? And How you can install/configue two
OS on same system give good explaination.

What is the concept of virtulization:

Virtualization is like creating virtual (not physical) versions of computers or


networks inside a real one. It lets you run multiple operating systems or software
setups on a single physical machine, making better use of your computer's resources
and increasing flexibility.

How you can install/configue two OS on same system give good


explaination.

By Installing VMWare Player


6
6

Lab9:
What is window Server and how u can Install Window Server 2012 with
your existing client Machine.

Step: 1 Download Windows Server 2012

Step: 2 Once downloaded click on the setup setting


6

Step: 3
Once you click next, you can start the installation, click "Install now“

Step: 4
Select Windows Server 2012 Data Center Evaluation
6

Step:5
Read the License terms, tick the "I accept the license terms" and click Next

Step: 6
Select the drive (or partition) you want to install Windows on.
Here I'm installing it on the one partition I have here
6

Step: 7
Now once we picked our partition, clicking on next from previous screen will
start the setup. This process might take a while

Step: 8
Once the setup is done, it will restart and start your Windows Server 2012 for
the first time
6

Step: 9
It will ask you then to set up country region for the Administrator user

Step: 10
When the setup is done, it will restart and start your Windows Server 2012 for the
first time. It will ask you then to set up a password for the Administrator user
6

Step: 11
Once the setup is done, you can log in for the first time to your Windows
Server, as the screen says, press Ctrl+Alt+Delete to log in, and use the
password you set in the setup process

Step 12:

Enter Password
6

Step: 13
Open the server manager from the taskbar

Step: 14
Once you Log in, Windows Server 2012 will show the Server Manager
6

Lab10:
Installation and Configuration of Active Directory (AD)

Active Directory stores information about objects on the network and makes this
information easy for administrators and users to find and use.

Use the following steps to install Active Directory on the server:

From the Server Manager dashboard, select Add roles and features

The Roles and Features Wizard launches. This wizard enables you to make modifications to the
Windows Server 2012 instance Click Next.
6

On the Installation Type screen, select Role-based or features based and click next.
7

By default, the current server is selected. Click Next.

On the Server Roles screen, select the check box next to Active Directory Domain Services.
7

To select additional capabilities, click Add Features.

On the Select features screen, Active Directory Domain Service installation process and click on
Next Button.
7

In next window it will gives more options to select additional feature to install. Keep the
default selection. click next to install
7
7

Configuration of Active Directory

After you have installed the AD DS role, you must configure the server for
your domain by using the following steps:
From the task bar, click Open the Server Manager.
Select the yellow notifications icon in the top navigation bar of the Server
Manager window.

The Notifications Pane opens and displays a Post-deployment Configuration notification.


Click the Promote this server to a domain controller link that appears in the notification.

From the Deployment Configuration tab,


7

Select Radial options > Add a new forest. Enter your root domain name in the Root domain
name field and click next button.

Select a Domain and a Forest functional level. Remain it by defaultReview the warning on
the DNS Options tab and Click Next.
7

Confirm and Enter NETBIOS name Click Next

Specify the locations of the Database, Log files, and SYSVOL folders, and then Click Next.
7

Review the configuration options and Click Next.

The system checks if all of the prerequisites are installed on the system. If the system passes
these checks, Click Install.
7

After the server reboots, reconnect to it by using Microsoft Remote


Desktop Protocol (RDP).
7
8

Lab11:
• Creating Organizational Units in AD
• Create Users and Groups with OU
• Move Users from One OU to another OU
• Create Nested Groups

First of all, go to Tools click “Active Directory User and Computer”

Then will see your created Domain Name in my case is “TECH.COM”


8

Then Right Click to Domain Name >new > Organizational Unit.


8

So, Click Organizational Unit to create a “New Organizational Unit” and then give
its name and click ok
8

Create Users and Groups with OU

Now, for creating Users go to Own “Organizational Unit” Right click go to New
Then go to User and click it to add New User
8

Click Next Give Password and select “Password Never Expire”

Created user within OU


8

Created Users similarly

Going to create Groups into OU


8

Click to Group to Create “ New Group” Give its Name and Keep Group
Scope default and Ok

Created Groups Into OU


8

Move Users from One OU to another OU

Into order to move User Right Click User Click to Move then select
Organizational unit where you want to move your user.
8

So, Our user shifted into “Ali Shan Second OU”

Removed From “Ali Shan OU”


8

Keep in mind these OU are different from one and other Nested Couple of
Groups Within another Group

We have two Managers groups:

Sales and Service Managers.

We want to add those groups to a Management group

I have created three Groups (Management, Sale Group, Service Group)


9

• Right-click the Management group and select Properties.


• In the Members tab, click Add, type the names of the groups, and add them
to the group.

Write Name and click “Check Names” this automatically will fetch related name
9

Here you can see Both Groups are Nested into Management Group and
become the member of this Group
9

Lab12:
Installation and Configuration of DNS (Domain Name Service)
DNS in Windows Server is a service responsible for translating domain names into
IP addresses, allowing computers to locate each other on networks. It plays a critical
role in Active Directory, resolves hostnames, and stores resource records for various
network services.

• Open server manager dashboard.


• Click on add roles and features.
9

Click Next

Leave default settings and click Next


9

Click Next

Check DNS Server box.


9

Click “Add Features”.

Leave default settings and click Next.


9

Click Next.

Click Install.
9

Installation in progress.
9

Open tools bar of server manager.


DNS Server installed successfully.

Here the DNS Manager box.


9

Configuration of DNS
• Create Forward lookup Zone
• Reverse Lookup Zone

In order to create Zones Follow this Steps:


• Select Tools then click on DNS.

• Here are the forward and reverse lookup zones on left side of DNS
manager.
1

• To create Forward lookup zone right click on forward lookup zone and
select New zone.
1

Click Next.

• Select primary zone and click next.


1

Write zone name and then click next.

• Select “do not allow dynamic updates” and click next.


1

This dialogue box shows the complete details of the forward zone that
you have created and then click finish.

• Forward lookup zone is created with name “group11.com”.


1

To create new host right click on the zone that you have created and
select “New Host (A or AAAA)”.
1

• The host is now created and the host is pointing to the IP address.
1

• To create Reverse lookup zone right click on reverse lookup zone and
select New zone.

• Click Next.

• Select primary zone and then click on next.


1

Click Next

Select IPV4 Reverse Lookup Zone and Next


1

Give Network Id and Next

Select “do not allow dynamic updates” and click next.


1

Click to Finish

The reverse lookup zone is created.


1

In reverse lookup zone. Right click and select “New Pointer”.


1

Click on Browse and select host Zone then Ok

Then select Forward lookup zone and ok


1

Then Select Our Forward Lookup Zone and Ok.

Select and Ok
1

Select your Host created into forward lookup zone and Ok .


1
1

Lab13:
Installation and Configuration of DHCP (Dynamic Host Configuration
Protocol).
• DHCP stands for Dynamic Host Configuration Protocol.
• Network management protocol
• DHCP is used to dynamically assign an IP address and other networking
parameters to any device.

Installation of DHCP Server:


1. Open Server Manager and click “Add Roles and Features”.
1

2. Here will be given some instructions, read them carefully and then click
“Next”.

3. Select “Role-based or feature-based installation” type and then click


“Next”.
1

4. Select your server, here is only one selected by default. Simply click “Next”.

5. Double click on “DHCP Server” or simply check the box of “DHCP


Server”.
1

6. Checking the box of “DHCP Server” will result in new window showing the
features that will be added by default. Simply click “Add Features”.

7. Window showing the added features. Click “Next”.


1

8. Read the short introduction and requirements of “DHCP Server” and click
“Next”.

9. Role is ready to be installed with some features. Click the “Install” button.
1

10. Server is installed successfully. Close the window by clicking the “Close”.

Post Deployment Configuration:


1. Open Server Manager and click on “Task Details Flag” and then click on
“Complete DHCP configuration”.
1

2. Read some instructions and click the “Commit” button.

3. Close the window and configuration as well by clicking on the “Add Roles
and Features” button.
1

IP Pool Creation and Restriction:


1. Open Server Manager and click on “Tools” tab and select “DHCP

2. This is the interface of DHCP Server. Expand the only given sever under
DHCP named “win-7p2hd486v7u”.
1

3. Now expand the IP version four by clicking on “IPv4”.

4. After expanding IPv4 right click on IPv4 and then click on “New Scope” in
which range of IPs will be defined.
1

5. New Scope Wizard welcoming you, will be popped out. Click on “Next”.

6. Give a Name to the scope and click “Next” after describing it, but it is not
mandatory.
1

7. Here the New Scope Wizard is asking for Start IP address and End IP
address for your pool. Provide it and click “Next”.

8. One or a part of pool can be added to the exclusion. Mention a range of


pool and click “Add”.
1

9. If you want to exclude a single IP Address type it into the “ Start IP


Address box ”

10. By default selected Lease Duration is 8 days and can be up to 1000 days.
Keeping it default, click “Next”.

11. Keep the settings default and click on “Next”.


1

12. Write the Router’s IP or default gateway. After clicking “Add”, click
“Next”.
1

13. Provide DNS Server’s IP address that you want to assign to your client and
after clicking “Add”, click “Next”.

14. WINS Server address was used in older versions for networking. So, click
“Next” without putting something.
1

15. Here wizard is asking for the activation of this scope. Keeping it default
click “Next”.

16. Scope has been created successfully. Close the wizard by clicking “Close”.
1

17. Restart your DCHP Server by right clicking on it, go to All Tasks and click
on Restart.

18. Now your DHCP Server is ready to use and have a scope consisting a pool
of IPs to assign to the clients.
1

IP Reservation:
1. Expand the created scope and right click on Reservations and then click on
“New Reservation…”.

2. Write name, IP address and MAC address and left other options as they are
by default “Add Roles and Features”.
1

3. Reservation named “window 10 VM” has been added.

4. Again Restart you DHCP server


1

5. Still the client has not renewed its IP, that’s why it is inactive.

6. Now the client has renewed its IP to the reserved one for it, that’s why it is
active now.
1

Lab14:
Create User and Group Apply Group Policies.
Group Policy is a hierarchical infrastructure that allows a network administrator in
charge of Microsoft's Active Directory to implement specific configurations for
users and computers.
 Group Policy allows administrators to define options for what users can do on
a network.
 Provides a hierarchical and organized approach to managing policies.
 Levels include the entire domain, individual organizational units (OUs), or
specific user.

In order to implement Policies Follow these steps:


1. First Open Server Manager then dashboard of Windows Server 2012 will be
opened.
2. Left Click on the Tools from the top Menu .
3. Select the option Active Directory Users and Computers.
1

1. Select the Domain tech.com.


2. Right click on the Domain.
3. Move the cursor to the New .
4. Then ,Select the option Organizational Unit.

1. Type a Name for Organizational Unit .


2. Then , Click OK.
3. A new Organizational Unit Named BSIT is created.
4. We can see it on left side bar.
1

1. Right Click on the newly created Organizational Unit Presentation.


2. Move the Cursor to the New.
3. Then , Selects the User.
1

• Then, Selects the User.


• Enter First Name.
• Enter Last Name.
• Enter User logon Name.
• Click Next.

1. Enter a strong password.


2. Confirm password.
3. Choose“password never
expires ”.
4. Click Next.
1

1. Read the details .


2. Click on Finish.
3. A User Named Ali Shan is created.

Creating Group:
1. Right Click on the Organizational Unit that is Presentation.
2. Move the cursor to the New.
3. Then Selects the Group.
1

1. Type a Name for the Group.


2. Here we typed the Name BSIT.
3. Click OK.
4. A Group Named BSIT is created.

Adding Users to Groups:


1. Right Click on the User name Ali Shan.
2. Click on : Add to group.
1

1. Enter name of Group where we want to add User.


2. We want to Add this User into BSIT Group.
3. So , Enter the Name Ali Shan.
4. Click OK.
5. A message is displayed indicating the successful completion of the operation.
1

1. Open Dashboard.
2. Click on tools.
3. Select Group Policy
Management.

Expand the domain Tech.com


1

1. Expand the OU Presentation.


2. Click on create a GPO in this domain

1. Enter a Name for GPO.


2. We entered the name Control Panel Setting.
3. Click OK.
4. A new GPO Named Control Panel Setting is created.
1

1. Right click on the new GPO Control panel setting


2. Click on Edit

A new window of Group Policy Management Editor Opens

Expand Policies in User Configuration


1

Now open and expand Control Panel


1

1. Now we are going to apply the policy Prohibit access to Control Panel 2.
Now right click on the policy and then Click on Edit

1. Select the option Enabled to enable thePolicy


2. Click on Apply and click OK
1

1. Now go back to the policy Control Panel setting


2. Here you can see that the policy is enabled or not

To apply this policy to the Users and Groups ,Click on the Add Button at the bottom.
1

 Enter the name of the User and Click OK.


 The Policy is applied to this User.
 Similarly , we are going to apply this policy to the Group. And click ok.

1. Now Click on Domain Tech.com


2. Select second option “Link and Existing GPO”

1. Now select your GPO and click ok button.


2. Now this GPO is Linked to tech.com Domain
1

1. Go to the Control Panel.


2. We can see the Control Panel all settings.
3. Now, to see the results of our policy ,restart your Windows Server.

1. After restart, open Control Panel again.


1

2. We can see that Control Panel is not opening .


3. This means that we have successfully performed the practical.

Lab15:
Installation and Configuration AD, Create Domain and Rename Domain
name

Installation and Configuration already done into previous Lab Now, just
“Rename the Domain Name” For this create New Forward lookup Zone
1
1

Keep it default and click Next to continue

Give Zone Name in my case it is “shan.com”


1

Allow both nonsecure and secure dynamic update

Review your forward lookup zone and continue


1

Here created forward lookup zone with name “shan.com”

Open cmd and run Commands: cd C: /


After this run, random/list
1

Now, go into C derive look domainlist file and open it and change all old domain name
with new domain name and I changed “Ali.com to shan.com”
But NetBIOSName keep in upper case

Run Commands Defined into Screenshorts.

After this your system will reboot and show pop up click close
1

Now you will switch your user click Arrow and select other and then login
With Administration and your actual password such as
1

In Order to verify go local sever and look you domain name it will be change

Now I required some few requirements about domain So, again come into
Terminal and run these commands
1. gpfixup /olddns:Ali.com /newdns:shan.com
2. gpfixup /oldnb:dc /newnb:shan
3. rendom/clean
4. random/end
1

Now Domain Name will be updated from old to new But in my case is

“ Ali.com to shan.com ”

Congratulations Our domain name is Changed into “SHAN”


1

Lab16:
Apply Active Permissions Using Share folder and NTFS
"Active Permissions" typically refers to the current set of permissions or access
rights granted to a user, system, or application for specific resources or actions
within a computer system, network, or software application. These permissions
determine what actions a user or system is allowed to perform and what resources
they can access.

Before going to Apply premissions Using Share folder and NTFS kindly
enable their machines settings such as

1. Right click WiFi option go to “ Network and Internet Setting”


2. Go to “Advance network setting” and then go “ Advance Sharing setting”

There will be three kind of Networks Private, Public and All Networks enable
these option from each network

1. Private Network:
Enable “Network discovery” and “ File and printer sharing”
2. Public Network :
Enable “Network discovery” and “ File and printer sharing”
3. All Networks
Enable “Public Folder Sharing” and disable “Password Protected Sharing”

After this Proceed Next Toward Next steps ……


ACTIVE PERMISSIONS BY USING SHARED FOLDER :
1

1. Click on the desired folder and click properties.

2. Now, Click on the sharing tab and click the share button.

3. Next, Choose which person you want to add and click on the “add” button.
1

4. Choose the desired person as I have choosen the “Everyone” and then, Click
on permission level to allow the desired permissions.
1

5. You can choose the


permissions according
to your need. I have
choosen Read/Write
both this time.

After that click on the


Share button below

Your desired folder has been shared now.


1

Click on the “Done”

6. You can also share the folder by


using Advanced Sharing
For that, Click on the Advanced
Sharing.

7. Enable the “Share this folder” and click on the permissions button
1

8. Now, Click on the users as I have choosen the “Everyone”


Then you can Allow or Deny the permissions as you wanted to.

9. As, I have allowed all the permissions here. Next, Click on Apply and then
click OK.
1

10. On RUN, Type the IP address of the other system and Click OK
1

Here are the results of desired folder which we have shared

ACTIVE PERMISSIONS BY USING NTFS:

1. Click on the desired folder <<Properties

2. Then click on Security Tab


1

3. From user, click on everyone and for changing permissions click edit.

4. Now, click on advanced tab.


For example, if a user is given access to a folder, they also receive access to its files
and subfolders. Likewise, if you assign a permission to an Active Directory group,
any nested groups within it receive the same permission.
1

5. Now, disable the Inheritance permission for the desired folder and click “
Convert inherited permissions into explicit permissions on this object.

6. We have the disabled inheritance turned on , Just simply click apply and ok.

7. The desired permissions have been assigned.


1

We can change it later according to our need.

Finally, we can access to the desired folder on the other system using NTFS.
1

Lab17:
DOS to Linux cheat sheet

What is Linux and why it is used?


Linux is an open source operating system (OS). An operating system is the software that
directly manages a system's hardware and resources, like CPU, memory, and storage.

Now,we are going to run linux commands to perfoms different tasks ………
1. touch command (for create a file)
1

2. clear command (for clear terminal)

3. mkdir command (for create directory)


1

4. How to create file inside directory

5. sudo command (for run as super user)

6. rm command (for delete file)


1

7. rmdir (to delete directory)

Deleted Directory

8. cp command (for copy file )


1

9. mv command (for move from one place to another)

10. ls command (for list each and everything)

11. mv command (for Rename file/Directory)


1

12. exit command (to exist prompt )

13. Date command (to display date)

14. echo command (for display message)


1

15. pico command (for edit file)

16. mv command (for Rename folder)

17. cat command (to display content of file)


1

18. diff command (to compare content of files)

19. grep command (to find string from file)

20 . pwd command (to show you current location )

21. man command (for display help for command )


1

22 . chmod command (to change premission)


1

23. hostname command (to check hostname)

24. mount command (for mount file system)


1

Lab18:
Installation of Linux Operating System flavor (ubantu) using VMW

First of all run your vmw and click create New Virtual Machine

Then Browse and give path of “ubantu iso file”

Then you can see your ubantu iso file into Browse box
1

Give all credentials and click Next

Here I gave name “Ali Shan” and Password “ ********”


1

You will see you virtual machine name and Next.

Give space for Installing ubantu recommended space is 20GB and Next
1

Review the Information and Finish.

Then reboot and install some requirements automatically keep relax


1

Select English by default and Next.

And select Normal Installation and Continue.


1

Select “Erase and install ubantu” and install

Keep relax it coping “some files and requirements” for running properly
1

Just continue ….

Give credential in such a way I gave .


1

Install ubantu OS

Copying files……..
1
1

Lab19:
Linux Text Editors (VI, VIM, JOE)

Introduction to VI, VIM and JOE Editors:


VI Editor: A classic text editor for Unix-like systems, Vi is known for its efficiency with a
modal interface featuring normal, insert, and command-line modes.

VIM Editor: An enhanced version of Vi, Vim introduces additional features like syntax
highlighting, split screens, and plugins, maintaining Vi's modal structure while providing
a powerful and extensible text editing environment.

JOE Editor: Joe is a text editor for Unix-like systems designed to be user-friendly and
accessible to users familiar with other text editors like WordStar and Emacs. It is known
for its simplicity and ease of use.

Let’s come toward practical work…….

Here I created and open a file “AliShan” by using vi command


1

Press Enter then it will open file “AliShan” and press “i” to Insert text

After writing something then press :wq (for save and quite)
1

VIM Editors:

First of all, install vim using command such as “sudo apt install vim”
1

How to verify “ vim --version”

Vim command with file name which you want to create

It will Open File Then You Can Write Something But as like VI Commands
1

Here my file text displayed when I used “ cat command”


1

JOE Editor:

First of all, install joe using command such as “sudo apt install jeo”

Write joe with file name and then it will open into editor same file

Here Write Something into your file and press for (save and exit)
Ctrl +K
Ctrl+X
1

I write Alphabets of English Language ……

Here Displayed my file text

Here file created file displayed on to desktop ……….


1

Lab20:

• Installation and Configuration of Squid Sever and LAMP Stack

• Squid is a proxy cache server which provides proxy and cache services for
Hyper Text Transport Protocol (HTTP), File Transfer Protocol (FTP), and
other popular network protocols.

• It acts as an intermediary between web servers and clients. When a client sends
a request for content, Squid fetches the content from the web server and creates
a local copy. Then, if a request is made again, it shows the local, cached copy
instead of making another request to the web server. In this way, performance
is improved and network bandwidth is optimised. It can also filter web traffic,
helping to improve security.

Key Features:
 Caching: Squid caches frequently requested web content, such as images, web
pages, and other objects, locally. This reduces the need to fetch the same
content repeatedly from the internet.
 Proxy: Squid acts as an intermediary between client machines and web
servers. Clients send their requests to Squid, and Squid forwards those
requests to the web servers.
 Access Control: Squid allows administrators to control access to the internet
by defining rules and policies. This includes specifying which clients or
networks are allowed to access certain content.

First update using the command “sudo apt-get update ”


1

Now install squid by using the command “ sudo apt-get install squid”

Open the configuration file of squid and make changes.


1

Squid Configuration File

Here Change the access from deny all to allow all and block the file that
contains the domains to be blocked

Here Change the “ http_access deny all ” to “http_access allow all”


1

Open the file that contains the name of domains to be blocked

Blocked websites

Now Restart the squid server


1

using command “ifconfig” to check IP

Open the browser>setting>proxy and add the IP manually

Now search for the domain you blocked


2

Other are accessible


2

LAMP Stack
A LAMP stack is a bundle of four different software technologies
 Linux (Operating System)
 Apache (Web Server)
 MySQL (Database Server)
 PHP (Scripting Language)
They provide a proven set of softwares for delivering high-performance web
applications. It's widely used for hosting dynamic websites and web applications.

Here's a brief overview of how these components interact in a typical LAMP setup:

 Client Request:
When a user makes a request by entering a URL into their browser, a request is sent to
the Apache web server.
2

 Apache:
Apache receives the request and, based on its configuration, forwards PHP requests to
the PHP processor.
 PHP:
PHP processes the server-side script embedded in the requested web page. It can
interact with the MySQL database to fetch or update data dynamically.
 MySQL:
MySQL handles the storage and retrieval of data requested by PHP scripts. It stores
information such as user accounts, content, and other application data.
 Response:
The dynamic content generated by PHP, possibly incorporating data from the MySQL
database, is sent back to the Apache web server.
 Apache:
Apache delivers the final web page, incorporating the dynamic content generated by
PHP, to the user's browser.

Apache Installation & Configuration


Open the terminal. Enter the command “sudo apt update”.

Now, enter the command “sudo apt-get upgrade”.


2

Use the following command “sudo apt-get install apache2” to install Apache.

Open configuration file of apache2 using nano


(sudo nano/etc/apache2/apache2.conf) and change the server name.
2

Chage the ServerName “ServerName :localhost”

Test the configuration of Apache2 using “sudo apache2ctl configtest”


2

Check all the softwares installed in the server using “sudo ufw app list”

To allow the app use, sudo ufw allow in “Apache Full”

Then enable the firewall via command “sudo ufw enable”

Check the status

Write http://localhost
2

To create a web page use following Command: cd /var/www/html


When you enter into that file enter command sudo nano lamp.html
It will open the html file.

Go to the browser, and enter localhost/lamp.html. It will show the web page.
2

MySQL Installation & Configuration

Open the terminal. Enter the command “sudo apt-get update.”

Install the MySQL Server by sudo apt-get install “mysql-server”


2

Type sudo mysql to run MySQL so that we can alter the user.

Run the command for secure installation “sudo mysql_secure_installation”


2

Here you can enter the queries and execute them.

PHP Installation & Configuration


Open the terminal. Enter the command “sudo apt-get update.”

Install the php by “sudo apt install php”


2

To confirm that php has been installed, check the version by using command
php version

Create a sample php file with the following Command,

“sudo nano / var/www/html/check.php”

And write the following php code > press ctrl+x to exit.

Type the following command to check the php file.


2

Output of PHP program


2

Lab21:
Implementation of Preferences in window Server 2012

Manage settings for applications, control panel items, and network components

Not as strict - users can sometimes make changes, but preferences can be re-applied
by administrators.

Scope - Users, computers

Examples:

Configuring things like mapped drives, printer settings, and other personalization
options.

In order to implement Preferences

1. Right click on the new GPO

2. Click on Edit
2

A new window of Group Policy Management Editor Opens

 Expand Preferences in User Configuration


2

 Now open and expand Windows Settings

 Now we are going to apply the Preference Create Shortcut


 Now right click on the shortcut
2

 Right click on shortcut then go to New select shortcut

 Go to Action icon select Create option

 Writ the Name of shortcut that is Shortcut1.


2

 Now select the location where you want to Create shortcut

 In target path select the folder whose shortcut we want to create on desktop

 In Icon file select the Icon picture Click OK


2

 Click on Apply then Press Ok


2

 Before restarting there is no shortcut Folder is shown on the desktop

 After restart the shortcut folder (shortcut1) is showing on our desktop


2

Lab22:
Implementation of LINUX Permission
The ls -al command in Linux is used to list detailed information about files and
directories in a directory.
Here's a breakdown of what each part of the commanddoes:

ls: The command to list files and directories.


-a: Option to show hidden files and directories (those starting with dot).
-l: Option to display detailed information in a long format.

Here I Applied into my Linux terminal

What is total 120


2

Cumulative disk space:


The number following total is a representation of the cumulative disk space,
in blocks, allocated for the files being displayed. It's not just a straightforward
sum of file sizes but a reflection of how file systems handle space and how ls
calculates it.
2

4. How to change Owner and group name file/directory


In Unix-like operating systems, each file and directory is associated with three sets
of permissions: owner, group, and other. These permissions define who can read,
write, or execute a file or directory. The three sets of permissions are often
represented by the symbols "r" (read), "w" (write), and "x" (execute).
2

How to apply Linux permission

Previous I changed permission of file “shan” and change user to verify either it
apply to other user or not
2

Now I am going to apply permission on user group “group user” first I create
group and then add user to that group .

Here I changed the user group of file with “usergroup”


2

Here I switch user and I check this user have only read permission .

Permission on other user


2

Apply same permission on all the users

Other way without using a keyword I changed permission

How I Changed permission of individual user and want to keep same for other
users by using Absolute mode?

How to use pipe command and reverse output order.


2

Lab23:
Scheduling Algorithms ( FCFS , SJF, Priority and Round Robin )

First-Come-First-Serve (FCFS):

Description: The simplest scheduling algorithm where processes are executed in the
order they arrive.
Advantages: Easy to understand and implement.
Disadvantages: Poor in minimizing waiting time, especially for long processes.

Example of FCFS algorithm:


2

#include<iostream>

using namespace std;

// Function to find the waiting time for all processes

void findWaitingTime(int processes[], int n, int bt[], int wt[]) {

wt[0] = 0;

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

wt[i] = bt[i - 1] + wt[i - 1];

// Function to calculate turn around time

void findTurnAroundTime(int processes[], int n, int bt[], int wt[], int tat[]) {

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

tat[i] = bt[i] + wt[i];

// Function to calculate average time

void findavgTime(int processes[], int n, int bt[]) {

int wt[n], tat[n], total_wt = 0, total_tat = 0;

findWaitingTime(processes, n, bt, wt);

findTurnAroundTime(processes, n, bt, wt, tat);

// Display processes along with all details

cout << "Processes " << " Burst time " << " Waiting time " << " Turnaround time\n";

// Calculate total waiting time and total turnaround time

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

total_wt += wt[i];

total_tat += tat[i];

cout << " " << processes[i] << "\t\t" << bt[i] << "\t "
2

<< wt[i] << "\t\t " << tat[i] << endl;

cout << "Average waiting time = " << (float)total_wt / (float)n;

cout << "\nAverage turnaround time = " << (float)total_tat / (float)n;

// Driver code

int main() {

int n;

// Input the number of processes

cout << "Enter the number of processes: ";

cin >> n;

int processes[n];

int burst_time[n];

// Input burst times for each process

cout << "Enter burst times for each process:\n";

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

cout << "Burst time for process " << i + 1 << ": ";

cin >> burst_time[i];

processes[i] = i + 1; // Assigning process IDs

// Calculate and display average times

findavgTime(processes, n, burst_time);

return 0;

}
2

Shortest Job Next (SJN) or Shortest Job First (SJF):


Description: Selects the process with the shortest burst time first.
Advantages: Reduces waiting time and improves turnaround time.
Disadvantages: Predicting the exact burst time is difficult, and it may lead to
starvation for longer processes.

Example of SJF algorithm:

#include<iostream>

using namespace std;

int main()

int n,temp,tt=0,min,d,i,j;

float atat=0,awt=0,stat=0,swt=0;

cout<<"enter no of process"<<endl;

cin>>n;

int a[n],b[n],e[n],tat[n],wt[n];

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

cout<<"enter arival time "; //input

cin>>a[i];

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

cout<<"enter brust time "; //input

cin>>b[i];

}
2

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

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

if(b[i]>b[j])

temp=a[i];

a[i]=a[j];

a[j]=temp;

temp=b[i];

b[i]=b[j];

b[j]=temp;

min=a[0];

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

if(min>a[i])

min=a[i];

d=i;

tt=min;

e[d]=tt+b[d];

tt=e[d];

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

if(a[i]!=min)
2

e[i]=b[i]+tt;

tt=e[i];

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

tat[i]=e[i]-a[i];

stat=stat+tat[i];

wt[i]=tat[i]-b[i];

swt=swt+wt[i];

atat=stat/n;

awt=swt/n;

cout<<"Process Arrival-time(s) Burst-time(s) Waiting-time(s) Turnaround-time(s)\n";

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

cout<<"P"<<i+1<<" "<<a[i]<<" "<<b[i]<<" "<<wt[i]<<" "<<tat[i]<<endl;

cout<<"awt="<<awt<<" atat="<<atat; //average waiting time and turn around time

Priority Scheduling:

Description: Each process is assigned a priority, and the process with the highest
priority is selected for execution.
Advantages: Allows for priority assignment based on factors like importance or
deadlines.
2

Disadvantages: May lead to starvation if lower-priority processes never get a


chance.

Example of Priority Scheduling algorithm:

#include<iostream>

#include<algorithm>

#include<vector>

using namespace std;

struct Process {

int processId;

int burstTime;

int priority;

int waitingTime;

int turnaroundTime;

};

// Function to calculate waiting time, turnaround time, and average times

void calculateTimes(vector<Process>& processes) {

// Sorting processes based on priority (higher priority first)

sort(processes.begin(), processes.end(), [](const Process& a, const Process& b) {

return a.priority > b.priority;

});

processes[0].waitingTime = 0;

// Calculate waiting time

for (int i = 1; i < processes.size(); ++i) {

processes[i].waitingTime = processes[i - 1].waitingTime + processes[i - 1].burstTime;

}
2

// Calculate turnaround time

for (int i = 0; i < processes.size(); ++i) {

processes[i].turnaroundTime = processes[i].waitingTime + processes[i].burstTime;

// Function to display the process details and average times

void displayResults(const vector<Process>& processes) {

float totalWaitingTime = 0, totalTurnaroundTime = 0;

cout << "Process\tBurst Time\tPriority\tWaiting Time\tTurnaround Time\n";

for (const Process& p : processes) {

cout << p.processId << "\t\t" << p.burstTime << "\t\t" << p.priority << "\t\t"

<< p.waitingTime << "\t\t" << p.turnaroundTime << endl;

totalWaitingTime += p.waitingTime;

totalTurnaroundTime += p.turnaroundTime;

// Display average times

cout << "\nAverage Waiting Time: " << totalWaitingTime / processes.size() << endl;

cout << "Average Turnaround Time: " << totalTurnaroundTime / processes.size() << endl;

int main() {

int n;

// Input the number of processes

cout << "Enter the number of processes: ";

cin >> n;
2

vector<Process> processes(n);

// Input burst times and priorities for each process

cout << "Enter burst times and priorities for each process:\n";

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

processes[i].processId = i + 1; // Assigning process IDs

cout << "Process " << i + 1 << " - Burst Time: ";

cin >> processes[i].burstTime;

cout << "Process " << i + 1 << " - Priority: ";

cin >> processes[i].priority;

// Calculate and display times

calculateTimes(processes);

displayResults(processes);

return 0;

Round Robin (RR):


Description: Allocates a fixed time slice (quantum) to each process in a circular
order.
Advantages: Fairness, prevents starvation, and simple implementation.
Disadvantages: Higher turnaround time for certain types of processes, and the choice
of quantum affects performance.

Example of Round Robin algorithm:


2

#include <iostream>
using namespace std;

// Function to find the waiting time for all processes


void findWaitingTime(int processes[], int n,
int bt[], int wt[], int quantum)
{
int rem_bt[n];
for (int i = 0; i < n; i++)
rem_bt[i] = bt[i];

int t = 0;

while (1)
{
bool done = true;

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


{
if (rem_bt[i] > 0)
{
done = false;

if (rem_bt[i] > quantum)


{
t += quantum;
rem_bt[i] -= quantum;
}
else
{
t = t + rem_bt[i];
wt[i] = t - bt[i];
rem_bt[i] = 0;
}
}
}

if (done == true)
break;
}
}

// Function to calculate turn around time


void findTurnAroundTime(int processes[], int n,
int bt[], int wt[], int tat[])
{
for (int i = 0; i < n; i++)
tat[i] = bt[i] + wt[i];
}

// Function to calculate average time


void findavgTime(int processes[], int n, int bt[],
int quantum)
{
2

int wt[n], tat[n], total_wt = 0, total_tat = 0;

findWaitingTime(processes, n, bt, wt, quantum);


findTurnAroundTime(processes, n, bt, wt, tat);

cout << "PN\t "


<< "\tBT "
<< " WT "
<< " \tTAT\n";

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


{
total_wt = total_wt + wt[i];
total_tat = total_tat + tat[i];
cout << " " << processes[i] << "\t\t" << bt[i] << "\t " << wt[i] << "\t\t " << tat[i] << endl;
}

cout << "Average waiting time = "


<< (float)total_wt / (float)n;
cout << "\nAverage turn around time = "
<< (float)total_tat / (float)n;
}

int main()
{
int n;

// Input the number of processes


cout << "Enter the number of processes: ";
cin >> n;

int processes[n];
int burst_time[n];

// Input burst times for each process


cout << "Enter burst times for each process:\n";
for (int i = 0; i < n; ++i)
{
processes[i] = i + 1;
cout << "Process " << i + 1 << " - Burst Time: ";
cin >> burst_time[i];
}

int quantum;

// Input the time quantum for Round Robin


cout << "Enter the time quantum for Round Robin: ";
cin >> quantum;

// Run Round Robin scheduling


findavgTime(processes, n, burst_time, quantum);

return 0;
}
2

You might also like