You are on page 1of 28

 

Report Presentation Of Final Test


Professor: Lê Anh Ngoc
Subject: Operating System - INS2076
Topic: UBUNTU OS(Server)
GROUP 1
Member: 
Phạm Đức Nghĩa 18071533
Nguyễn Quốc Thái 20070878
Trần Đăng Khải 18071528
Phạm Thế Ngọc Quang 18071536
Nguyễn Minh Đức 18071518

Contents
I. Introduction
1. Introduction of UBUNTU?
2. Features of Ubuntu
3. Ubuntu characteristic
4. Applications:  
a) Google Chrome Browser 
b) Steam
c) WordPress Desktop Client 

II. Process Management


1. Starting a Process
2. Foreground Processes
3. Background Processes
4. Listing Running Processes
5. Stopping Processes
6. Parent and Child Processes
7. Zombie and Orphan Processes
8. Daemon Processes
9. The top Command

III. Manager Management


1. Management of physical memory
2. Management of virtual memory
3. Swapping and paging
IV. Basic Of Implementation 
1. Installing Software 
a) INSTALLING FROM ADD/REMOVE
b)  INSTALLING FROM .deb
c)  INSTALLING FROM .rpm
d)  USE SYNAPTIC PACKAGE MANAGER 
e)  INSTALL BY COMMAND LINE 
f)  COMPILE FROM SOURCE CODE 
2. Manage packages in Ubuntu
I. INTRODUCTION
1. Introduction: 
Ubuntu (Stylized as ubuntu) is a Linux distribution based on Debian and composed
mostly of free and open-source software Ubuntu is officially released in three editions:
Desktop, Server, and Core for Internet of things devices and robots All the editions can
run on the computer alone, or in a virtual machine. Ubuntu is a popular operating
system for cloud computing 
2. Features of Ubuntu: 
Pre-installed Office Softwares 
Best Internet Experience 
Good looks 
Simplicity 
Reliability 
Stability 
Works Fast 
Very Secure 
Completely Free To Use 
Live Mode Supported 
Available For Almost all type of hardware 
Ubuntu Offers Thousand of app. free to use 
Available in many languages. 
Available in many flavors 
Large Community Support 
 
3. Ubuntu characteristic: 
1. hardware autoconfiguration – Ubuntu comes with the drivers for most
hardware built-in. Anyone who’s installed a generic version of Windows (i.e., not one
pre-configured by a PC vendor to work with certain hardware) knows how nice it is
not to have to spend hours hunting around for drivers after installing the operating
system. 
2. multiple desktops – virtual desktops are like tabbed web browsing–you don’t
realize how extraordinarily useful they are until you try them. There are some third-
party tools to achieve the same functionality in Windows, but in my experience few
of them work well, if at all, in Vista and above. 
3. software repositories – being able to install thousands of applications from
Ubuntu’s repositories in a few clicks is a huge plus. Besides the fact that the
software is free and more secure than .exe packages downloaded from random
websites, it’s much more convenient to install programs from a centralized location. 
4. ssh client – this probably only matters to geeks, but having an ssh client built
into the operating system is a major plus for me. There are some decent ssh clients
available for Windows, like but none are available in Windows out-of-the-box, and
even the best of them isn’t as functional as the trusty gnome-terminal. 
5. no antivirus – security practices in the Windows world are profoundly
contradictory. Many of the same companies that write Windows software also make
millions of dollars selling resource-hogging applications to protect Windows
applications from their security flaws. Ubuntu is by no means immune to malware,
but practically speaking, it’s as secure as it needs to be for most users out-of-the-
box, without any expensive antivirus scanners added on. 
 
4. Applications:  
a) Google Chrome Browser 
Almost all the Linux distributions feature Mozilla Firefox web browser by default and it is
a tough competitor to Google Chrome. But Chrome has its own advantages over Firefox
like Chrome gives you direct access to your Google account from where you can sync
bookmarks, browser history, extensions, etc. from Chrome browser on other operating
systems and mobile phones. Google Chrome features up-to-date Flash player for Linux
which is not the case with other web browsers on Linux including Mozilla Firefox and
Opera web browser. If you continuously use Chrome on Windows then it is best choice
to use it on Linux too. 
 
b)  Steam 
Gaming on Linux is a real deal now, which was a distant dream few years ago. In 2013,
Valve announced Steam gaming client for Linux and everything has changed since
then. Earlier users were hesitant to switch to Linux from Windows just because they
would not be able to play their favourite games on Ubuntu but that is not the case
now.Some users might find installing Steam on Linux tricky but it worth all your efforts
as thousands of Steam games are available for Linux. Some popular high-end games
like Counter Strike: Global Offensive, Hitman, Dota 2 are available for Linux, you just
need to make sure you have minimum hardware required to play these games. 
 
c) WordPress Desktop Client 
WordPress has its dedicated desktop client for Ubuntu from where you can manage
your WordPress sites. You can also write and design separately on desktop client
without need for switching browser tabs. If you have websites backed by WordPress
then this desktop client is must have application for you as you can also keep track of all
the WordPress notifications in one single window. You can also check stats for
performance of posts on website. Desktop client is available in Ubuntu Software Centre
from where you can download and install it. 

 
II. PROCESS MANAGEMENT
1. Starting a Process 
When you start a process (run a command), there are two ways you can run it − 
 
Foreground Processes 
Background Processes 
 
2. Foreground Processes 
By default, every process that you start runs in the foreground. It gets its input from the
keyboard and sends its output to the screen. 
 
You can see this happen with the ls command. If you wish to list all the files in your
current directory, you can use the following command – 
$ls ch*.doc 
This would display all the files, the names of which start with
ch and end with .doc – 

 
The process runs in the foreground, the output is directed to my screen, and if the ls
command wants any input (which it does not), it waits for it from the keyboard. 
 
While a program is running in the foreground and is time-consuming, no other
commands can be run (start any other processes) because the prompt would not be
available until the program finishes processing and comes out. 
3. Background Processes 
A background process runs without being connected to your keyboard. If the
background process requires any keyboard input, it waits. 
 
The advantage of running a process in the background is that you can run other
commands; you do not have to wait until it completes to start another! 
 
The simplest way to start a background process is to add an ampersand (&) at the end
of the command. 
$ls ch*.doc & 
This displays all those files the names of which start with ch and end with .doc – 

Here, if the ls command wants any input (which it does not), it goes into a stop state
until we move it into the foreground and give it the data from the keyboard. 
That first line contains information about the background process - the job number and
the process ID. You need to know the job number to manipulate it between the
background and the foreground. 
Press the Enter key and you will see the following − 

The first line tells you that the ls command background process finishes successfully.
The second is a prompt for another command. 
4. Listing Running Processes 
It is easy to see your own processes by running the ps (process status) command as
follows − 

 
One of the most commonly used flags for ps is the -f ( f for full) option, which provides
more information as shown in the following example – 

Here is the description of all the fields displayed by ps -f command – 


 
There are other options which can be used along with ps command −

5. Stopping Processes 
Ending a process can be done in several different ways. Often, from a console-based
command, sending a CTRL + C keystroke (the default interrupt character) will exit the
command. This works when the process is running in the foreground mode. 
If a process is running in the background, you should get its Job ID using
the ps command. After that, you can use the kill command to kill the process as follows
− 

 
Here, the kill command terminates the first_one process. If a process ignores a regular kill command,
you can use kill -9 followed by the process ID as follows −

 
 
6. Parent and Child Processes 
Each unix process has two ID numbers assigned to it: The Process ID (pid) and the
Parent process ID (ppid). Each user process in the system has a parent process. 
Most of the commands that you run have the shell as their parent. Check the ps
-f example where this command listed both the process ID and the parent process ID. 
7. Zombie and Orphan Processes 
Normally, when a child process is killed, the parent process is updated via
a SIGCHLD signal. Then the parent can do some other task or restart a new child as
needed. However, sometimes the parent process is killed before its child is killed. In
this case, the "parent of all processes," the init process, becomes the new PPID
(parent process ID). In some cases, these processes are called orphan processes. 
When a process is killed, a ps listing may still show the process with a Z state. This is a
zombie or defunct process. The process is dead and not being used. These processes
are different from the orphan processes. They have completed execution but still find
an entry in the process table. 
8. Daemon Processes 
Daemons are system-related background processes that often run with the
permissions of root and services requests from other processes. 
A daemon has no controlling terminal. It cannot open /dev/tty. If you do a "ps -ef" and
look at the tty field, all daemons will have a ? for the tty. 
To be precise, a daemon is a process that runs in the background, usually waiting for
something to happen that it is capable of working with. For example, a printer daemon
waiting for print commands. 
If you have a program that calls for lengthy processing, then it’s worth to make it a
daemon and run it in the background. 
9. The top Command 
The top command is a very useful tool for quickly showing processes sorted by various
criteria. 
It is an interactive diagnostic tool that updates frequently and shows information about
physical and virtual memory, CPU usage, load averages, and your busy processes. 
Here is the simple syntax to run top command and to see the statistics of CPU
utilization by different processes – 
$top 
III. MANAGER MANAGEMENT 
Memory management under ubuntu has two components  
 The first deals with allocating and freezing physical memory page, group
of page, and small blocks of memory 
 The second handles virtual memory, which is memory mapped into the
address space of running processes 
1. Management of physical memory  
Linux is available for a wide range of architecture  so many architecture this linux
operating system can be used and hence. They need to be an architecture which is
independent of describing memory/. 
Linux split this physical memory into 4 different zone due to the hardware
characteristics. they call this this zone DMA 32, zone normal and and zone high
memory .They will see what each one of these zone s refer to if want to see the physical
addresses that is supported in that particular machine. We can use the DME as Gm the
command. If the D message command is given after booting it will show us their
physical addresses of third different zone. 
Zone_ DMA is memory in the lower physical memory ranges which certain
devices require: 
First is on DMA which the memory in the lower physical memory ranges and this
required by a certain is a to Isi in the x86 32 bit architecture. Some of the devices they
will access only the lower 16 MB of the physical memory using DMA and this region of
the physical memory is called zone DMA and and zone in DMA is  generally been used
by some specific devices. For example they can be used for transfers with the network
cards the. The network cards can access can use only 24 bit addresses and hence they
can address one 16 and those cards will use the DMA zone some some card drives.
They can access only or utilize the DMA zone and the next zone called the DMA 32 is 4
GB  in size and this is used for data exchange with cards which can address up to 32
bits but some devices even though they support 24 or 64 bit addressing. They can
access only the first 4Gb and hence. They even use this zone DMA 32 
Physical memory which is not mapped into the kernel address space is called
ZONE_HIGHMEM 
 In 32-bit Intel architecture ( 223 = 4 GB address space), kernel is mapped
to first 896 of the address space, remaining memory is high memory allocated
from ZONE HIGHMEM 
ZONE_NORMAL has everything else – through normal regularly mapped pages-
used for processes 
Memory within ZONE_NORMAL  is directly mapped by the kernel into the upper region
of the linear address space. Many kernel operations can only take place using
ZONE_NORMAL so it is the most performance critical zone. All architectures may not
have all zones. For example, modern Intelx86- bit architecture has small 16MB
ZONE_DMA and the rest of its memory is ZONE_NORMAL, no high memory 
Relationship of Zones and physical Addresses on 80X86 
Zone  Physical memory  
ZONE_DMA  <16MB 
ZONE_NORMAL  16..896 Mb 
ZONE_HIGHMEM  >896 
 
For each zone, the kernel maintains a list of free pages. When a request for physical
memories arrives, the kerel satisfies the request using the appropriate zone. The
physical memory manage in Linux is called page allocator 
Each zone has its own allocator 
-Allocate and frees all physical pages for the zone 
-Capable of allocating ranges of physically contiguous page on the request  
Use a buddy system to keep track of available physical page.  
Buddy system 
Adjacent units of allocatable memory are paired together. Each allocatable memory
region has an adjacent partner( or buddy).When 2 allocated partner region are freed 
up, they are combined to form a larger region ( buddy heap). The lager region also has
a partner with which it can combine to form a still larger free region. If there is a request
for a small region and if a region of that size is not available, a larger region is split into
2 partner. If we can allocate for for a smaller request if it is still larger it will again to split
into 2 more partner but the splitting can’t happen till it goes to size of a page that is
smallest allottable is single page. 
Splitting of Memory in a buddy heap 
For example 

 
 
Slab allocator 
Allocates memory for kernel data structures 
A slab id made up of one or more physically contiguous pages. A number of slabs
together form something call cache. The slab allocator consists of a variable number of
caches that are linked together on a doubly  linked circular list call a cache chain. For
each unique kernel data structure, there is a single cache: cache for nodes, cache for
file objects. Each cache is populated with objects that instantiations of the kernel data
structure represents. 
 
The slab- allocation algorithm uses caches to store kernel objects 
When a cache is created, a number of objects are allocated to the cache 
The number if object in the cache depends on the size of the associated slab 
 A 12 KB slab ( 3 contiguous 4- kb pages ) can store six 2-kb objects 
All object in the cache are initially marked free. When a new object is needed for a
kernel data structure, the allocator can assign any free object from the cache to satisfy
the request 
 New task is created- new process descriptor object ( struct task_ struct) to
be  assigned 
 Cache will fulfill the request using a free slab 
A slab may be in one of three possible states  
 Full: All object in the slab are marked as used 
 Empty : All object in the slab are marked as free 
 Partial: The slab consists of both uses and free objects 
The slab allocator first attempts to satisfy the request with a free object in a partial slab.
If none exits the object is assigned from an empty slab. If no empty slab are available, a
new slab is allocated from contiguous physical page and assigned to a cache: memory
for the object is allocated from this slab. The slab allocator has three principle aim:  
 The allocation of small blocks of memory to help eliminate internal
fragmentation that would be otherwise caused by the buddy system 
 The caching of commonly used object so that system does not waste time
allocating initializing and destroying objects. Benchmarks on Solaris showed
excellent speed improvements for allocations with the slab allocator 
 The better utilization of hardware cache by aligning object to the L1 or L2
caches 
2. Management of virtual memory 
The Virtual memory system maintain the address space accessible to each process: 
 It creates page of virtual memory on demand, and manages the loading of
those pages from dish or their swapping back out to dish as required 
The Virtual memory manager maintains two separate views of a process’s address
space. 
A logical view describing instruction concerning the layout of the address space: 
 The address space consists of a set of nonoverlapping regions, each
representing a continuous, page- aligned subset of the address space 
A physical view of each address space which is stored in the hardware page table
for the process: 
Page table entries have the current location of each page of the virtual
memory- Where it is in disk or  physical memory 
Several types of virtual memory regions 
 The backing store describe from where the pages for a region come from  
 Regions are usually backed by a file or by nothing 
 A virtual memory region is also defined by the region’s reaction to
write( shared- page sharing to private – copy- on -write 
The kernel creates a new virtual address space. We have 2 situation: 
 When a  processes runs a new program with the exec system call 
 Upon  creation of new process by the fork system call 
While we are executing a new program as a part of this x’q system  call the process
is now given a new completely empty virtual address space so the virtual address
space or the process which was there earlier is now totally erased and there is a
completely empty virtual address space now and if we give a program as argument
to this exit system call the file corresponding to that executable will be used and
regions will be copied or pages will be copied from that file to this region now this
new process will get an entirely new at address space or entirely new text data and
stack regions. The program-loading routines populate the address space with virtual
memory regions. 
Creating a new process with  fork involves creating a complete copy of the existing
process virtual address space 
 The kernel copies the parent process’s VMA descriptors, the create a new
set of tables for the child. 
 The parent’s page tables are copied directly into the child’s, with the
reference count of each page converted being increment 
 After the fork the parent and child share the same physical page of
memory in their address spaces. 
  If the virtual memory region is private, the pages for the regions are
marked as read- only and copy-on-write is set. 
3. Swapping and paging 
The Virtual paging system relocated pages of memory from physical memory out to disk
when the memory is need for something else. 
No whole- process swapping. 
Only individual pages are moved. 
The VM paging system can be divided into 2 section: 
 The page out-policy algorithm decides which pages to write out to disk,
and when (LFU) 
 The paging mechanism actually carries out the transfer, and page data
back in to physical memory as needed 
IV. BASIC OF IMPLEMENTATION 
  
 INSTALLING SOFTWARE  
1.
For Windows users, after switching to Linux, installing, removing and
upgrading a software will be extremely stressful. In Windows we only have 1
very common way is to click on the setup.exe or install.exe file. In Linux, we
have quite a few ways to do it. In this article I will introduce some common
ways when installing software in Ubuntu.  
a) INSTALLING FROM ADD/REMOVE: This is the simplest and most effective
way. Installing this way will be easier to remove and upgrade. However,
this method only works when the device has an internet connection.
You just need to go to Applications -> Add / Remove…, find the
software you want to install, select and Apply, wait for Ubuntu to
download the packages to install.  
  
Note, in the ListBox Show (upper right), select “All available applications” to
see all available applications.  
b) INSTALLING FROM .deb:  
Find software.  
   
The basic syntax to search for software is:  
 apt-cache search [search term 1] [search term 2] … [search term n]  
 You just need to replace [search terms] with the software name, and do not
include the [].  
This way is as simple as the first, because the .deb package is already
precompiled, so you don't need to do much. You just need to use the mouse
to activate the package and the program will automatically install (just like the
setup.exe file in Windows). When installing, sometimes appears asking for
dependencies. You can find those packages and install them.  
  
If you prefer to use commands, type in Terminal:  
 $ sudo dpkg -i [ten_goi].deb  
 When installing a bunch of .deb packages:  
 $ sudo dpkg -i *.deb  
c) INSTALLING FROM .rpm:  
This is the compiled package for Redhat. To switch to the .deb package for
Ubuntu, you can install alien software:  
$ sudo apt-get update  
$ sudo apt-get install alien  
 Move to the directory containing the .rpm . file  
 $ sudo alien -k [ten_file].rpm  
 – This command will convert .rpm package into .deb . package  
– The -k parameter will preserve the version number  
 Then you install the .deb package like method 2.  
d)  USE SYNAPTIC PACKAGE MANAGER (IN UBUNTU IT’S KYNAPTIC)   
Go to System > Administration > Synaptic Package Manager, find the
package you need to install and then Install/Reinstal/Remove…  
   
  
e) INSTALL BY COMMAND LINE (detailed in the following section) To install any
package, just type in Terminal:  
 sudo apt-get install [ten_goi]  
 Removed:  
 sudo apt-get remove [ten_goi]  
f)   COMPILE FROM SOURCE CODE  
 If you only have the source code on hand, do the following:  
 - Install compiler program:  
 $ sudo apt-get install build-essential  
 – Get the source code (can use wget command to download)  
 – Extract: tar xvzf [ten_file] (.tar.bz2, .tar.bz, tar.gz, ...)  
 – Compile and install: into the unzipped folder  
 $ ./configure  
 $ make  
 $ sudo make install  
 Sometimes the installation fails due to lack of dependent libraries. You can
see them when reporting errors  
2.   Manage packages in Ubuntu:  
 dpkg: this is the most basic and simplest package manager in Debian. You
can refer to the following table:  
Syntax   Description   Eg  
Install the package or
dpkg -i {.deb package}   dpkg -i zip_2.31-3_i386.deb  
upgrade if already installed  
Install all packages in the
dpkg -R {Directory-name}   dpkg -R /tmp/downloads  
directory  
Remove the package except
dpkg -r {package}   dpkg -r zip  
the configuration files  
Remove package including
dpkg -P {package}   dpkg -P apache-perl  
configuration files  
List installed packages, dpkg -l dokg -l | less  
dpkg -l   versions and short dpkg -l ‘*apache*’  
description   dpkg -l | grep -i ‘sudo’  
List installed individual
dpkg -l {package}   packages, versions and dpkg -l apache-perl  
short description  
dpkg -L apache-perl  
dpkg -L {package}   List installed files  
dpkg -L perl  
List the files inside the dpkg -c dc_1.06-
dpkg -c {.Deb package}  
.deb . package   19_i386.deb  
Find the package on which dpkg -S /bin/netstat  
dpkg -S {/path/to/file}  
the file depends   dpkg -S /sbin/ippool  
Detailed package
description: group, version,
dpkg -p {package}   maintenance, structure, dpkg -p lsof  
package dependencies,
description, etc.  
dpkg -s {package} | grep Find if the package is
dpkg -s lsof | grep Status  
Status   installed or not  
Sourse: http://www.cyberciti.biz/howto/question/linux/dpkg-cheat-sheet.php  
apt:  
Syntax   Description   Eg  
apt-get install zip  
apt-get
apt-get install {package}   Install or upgrade packages  
install lsof samba mysql-
client  
Remove the package except
apt-get remove {package}   apt-get remove zip  
the configuration files  
apt-get –purge remove Remove packages including apt-get –purge
{package}   configuration files   remove mysql-server  
apt-get update apt-get apt-get update  
System update  
upgrade   apt-get upgrade  
apt-get update apt-get dist- System upgrade to new apt-get update  
upgrade   version   apt-get dist-upgrade  
apt-cache search keywords   Find packages by keyword   apt-cache search alien  
apt-cache show program   Get package information   apt-cache show out  
  
  
Step 1: First we need to download the original Ubuntu ISO installation file. You can get
the ISO file from the Ubuntu website. An ISO file is a CD image file that will need to be
burned to disc before you can use it. 
  
16.04 LTS is the most stable version of Ubuntu and is currently officially supported by
technical support, as well as being constantly updated from Ubuntu's servers. This
version is expected to be supported until April 2021. This option will give you the best
compatibility with your current hardware.. 
  

 
Select the version and download the installation file  
If you have a Windows 8 computer or one that supports the UEFI standard, download
the 64-bit version of Ubuntu. Most older machines should download the 32-b . version 
  
 
 
Select the version and download the installation file 
Step 2: Next we need to burn the ISO file to disc. Open the burning program of your
choice. There are many free and paid software available that you can easily download
from the internet.. 
  
Windows 7, 8, 10 and Mac OS X can all burn ISO files to a disc without having to
download a separate program. 
  
 
Step 3: Boot from disk. When you have finished burning the disc, restart the computer
and choose to boot from disc. You may have to change your boot options by accessing
BIOS Settings while your computer is rebooting. Depending on the model, those buttons
are usually F12, F2, or Del.  
Step 4: Try Ubuntu before installing. Once you boot from the disk, you will be given the
option to try Ubuntu without installing. The operating system will run from disk, and you
will have the opportunity to explore and experience the operating system. 
Open the Examples folder to see how Ubuntu handles files and explore this operating
system.

 
Once you're done exploring, open the Install file on the Desktop to begin the installation 
  

 
Step 5: Installing Ubuntu on your computer will require at least 4.5 GB of free disk
space. You will need more free space if you want to install more software and create
more files. If you are installing on a laptop, make sure it is connected to a power source,
as the installation may drain the battery faster than usual. 
Click Download updates while installing and Install this third-party softwares. Third-
party software will allow you to play MP3 files as well as watch Flash videos (such as
YouTube).  

Step 6: Establish a wireless connection. If your computer does not connect to the
Internet via Ethernet, you can configure your wireless connection in the next step. 
If you do not have an internet connection in the previous step, press the Back button
after establishing the wireless connection so that you can enable automatic updates. 
Step 7: Choose what to do with your current operating system. If you already have
Windows installed on your system, you will be presented with a few options for how you
want to install Ubuntu. You can install it alongside your previous Windows installation,
or you can replace your Windows installation with Ubuntu. 
If you install it alongside an older version of Windows, you'll be given the option to
choose an operating system every time you restart your computer. Your Windows files
and programs will not be affected. 
 

If you replace the Windows installation with Ubuntu all your Windows files, documents
and Windows will be deleted. 

395 / 5.000 
Step 8: Set your partition size. If you are installing Ubuntu alongside Windows, you can
use the slider to adjust the amount of space you want to specify for Ubuntu. Remember
that Ubuntu will take up about 4.5 GB when it is installed, so be sure to leave some extra
space for programs and files. When you're happy with your installation, click Install. 
 
  

 
Step 9: Choose your geographic location. If you are connected to the Internet, this
should be done automatically. Select your current time zone and click Continue to
continue to the next step.  
 

Step 10: Set your keyboard layout. You can choose from a list of options or click the
“Detect keyboard layout” button to have Ubuntu automatically select the correct
option.  

Step 11: Enter your login information. Enter the name, the name of the computer (to be
displayed on the network), select the user name and enter the password. You can
choose to have Ubuntu log in automatically, or ask for your username and password
when it starts. 

 
Step 12: Wait for the installation to complete. Once you choose your credentials, the
installation will begin. During the setup, various tips for using Ubuntu will be displayed
on the screen. Once done, you will be prompted to restart your computer and Ubuntu
will load. 
 
  
 

You might also like