0% found this document useful (0 votes)
18 views16 pages

Ubuntu Linux: Desktop Environments & Processes

The document provides an overview of the Linux Ubuntu operating system, focusing on its desktop environments, process management, and inter-process communication (IPC). It discusses the transition from Unity to GNOME as the default desktop environment, the process creation and termination mechanisms, and the differences between user-level and kernel-level threads. Additionally, it covers scheduling parameters and the scheduler's design aimed at achieving efficient resource allocation and performance.

Uploaded by

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

Ubuntu Linux: Desktop Environments & Processes

The document provides an overview of the Linux Ubuntu operating system, focusing on its desktop environments, process management, and inter-process communication (IPC). It discusses the transition from Unity to GNOME as the default desktop environment, the process creation and termination mechanisms, and the differences between user-level and kernel-level threads. Additionally, it covers scheduling parameters and the scheduler's design aimed at achieving efficient resource allocation and performance.

Uploaded by

Abu Musa Sakib
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Linux Ubuntu

Operating System
Done by:
Samira Fairuz Ahmed - 1721380
Sweety Barua - 1721150
Sanjib Kumar - 1722036
6. PROGRAMMER INTERFACE:

The desktop distribution’s most important part is its used desktop environment because the
usability, feel and look of the operating system depends on the desktop environment. Ubuntu
has several releases of desktop environments. Various desktop environments available for
Ubuntu Linux operating system are GNOME, Unity, LXDE, KDE, Xfce and MATE. (This Hosting
Rocks, 2018) Previously, Ubuntu’s default desktop environment was Unity, which was specially
invented and designed for Ubuntu. But now, Ubuntu comes with GNOME by default. For
Ubuntu, the other options for environments work just as well. Some of Ubuntu’s releases like
Lubuntu, Xubuntu, Ubuntu MATE come with pre-installed environments. Ubuntu’s friendly
user interface makes it one of the best suitable distribution for beginners. Additionally, it is also
very suitable for experienced users because it offers customized options too. Hence, any level
of users have the ability to log in graphically and use all applications without any need of typing,
whereas expert users still can access the core of the system when needed. (Garrels, M., 2008)

The latest version of Ubuntu uses the GNU Network Object Model Environment (GNOME) for
graphical user interface (GUI) which has the look and appeal of Windows Vista without many of
the problems. It also uses a command line interface to interact with the core of the system.
(Rouse, M., 2006)

GNOME provides the users with various desktop appearances as shown in Fig2. Using GNOME,
the user interface can be edited to look like other operating systems such as Windows 98 or
Mac OS. GNOME also provides programmers with a widget library, using GNOME’s user
interface, that helps them in developing applications. (Rouse, M., 2006)

Moreover, GNOME provides a collection of applications similar to the ones that can be found in
the Windows Office 97 product such as the following:

 Web browser.
 Database manager.
 Spreadsheet program.
 Word processor
 E-mail program.
 Presentation developer. (Rouse, M., 2006)

Ubuntu programs were developed using GNU compilers and assembly language in the earliest
versions, however some of the programs were still developed using low level language because
of the its fast execution time. Today, high-level language, mainly c programming, is also used
since it is easy to understand and debug. New advanced compilers are used by programmers
for developing complex programs comprising of hardware interaction, process communication
and Multithreading. (Garrels, M., 2008)

7. PROCESS CREATION, TERMINATION AND COMMUNICATION (IPC):

The basic principle of UNIX process management separated into two steps; two operations that
are usually combined into one: the creation of a new process and the running of a new
program. A new process is created by the fork() system call, and a new program is run after a
call to exec(). These are two distinctly separate functions. New process can be created with
fork() without running a new program and its PID becomes a parent process id, i.e. PPID of the
child process —the new subprocess (child process) simply continues to execute exactly the
same program, at exactly the same point of execution, that the first (parent) process was
running. Similarly, running a new program can be done without creating a new process first.
Any process may call exec() at any particular time. New binary object is loaded into the
process’s address space and the new executable starts running in the context of the existing
process. Sometimes the parent process is just interested in the child termination event. If user
is comfortable using the terminal, commands like killall or xkill can be used to force
troublesome programs to close or terminate. Another alternative is to use the System Monitor
app instead. The main process must maintain a fixed-size pool of sub-processes, while the
processes in the pool does the actual payload. Occasionally, workers die and the main process
has to spawn more processes in response to keep the pool size unaltered. For this and similar
situations, the Linux kernel provides a family of wait() system calls to keep the child process
termination waiting. However, due to this way of the reporting of the child process exit status
back to the parent is implemented, parent processes have to explicitly await their children
terminations. Otherwise, a zombie state occurs.

This model is known for great simplicity. To specify every detail of the environment of a new
program in the system call that runs that program is not necessary. The new program simply
runs in the existing environment. If a parent process requires to modify the environment in
which a new program is to be run, it can do that by forking and also running the original
executable in a child process. It will make any system calls it requires to modify that child
process before finally executing the new program. Under UNIX, a process encompasses all the
information that the operating system must maintain to track the context of a single execution
of a single program. Under Linux, we can break down this context into few specific sections.

IPC stands for “Inter- process communication”. IPC Linux mechanisms are derived from
traditional UNIX. Allows processes to share information. Some are more suitable for specific
applications. For example, those that connects over a network or exchange SMS messages with
other local applications. (EmbLogic, 2014)

The system allows a collection of system calls that enables the user mode process to send and
receive messages to other processes, semaphores and share a memory area with other
processes. IPC is needed because of many reasons including speedup, convenience, modularity
and information sharing. (EmbLogic, 2014) Three main methods are provided by Ubuntu, which
are:
 Pipes and FIFOs:
They are mainly used to implement the interactions between processes. The pipe may
be filled with a process or extracted by a process. (EmbLogic, 2014)

Fig9: Two processes connected with a pipe.

(Two processes connected with a pipe, 2007)


 Message Queues:
It is the mechanism of setting up a message queue between processes to transfer and
exchange short blocks, which called messages in an asynchronous way (As shown in
Fig10). (EmbLogic, 2014)

Fig10: Message passing method.

(Message Passing Method, 2018)

 Shared Memory:
In this mechanism, two processes share a common area of memory to share their
resources or data. It is used when processes have to share large amounts of data
efficiently. (EmbLogic, 2014)
8. PROCESS MANAGEMENT SYSTEM-CALLS:

A process is the context in which all user-requested activity is serviced within the operating
system. Linux uses a process model similar to those of other versions of UNIX to be more
compatible. However, Linux operates differently from UNIX in a few key places. Process
management is an integral part of the Ubuntu operating system. The management takes place in
the kernel space and consists of the required tools to handle the processes which run in the terminal and

the graphical user interface. A process is a program under execution, it can also be called as a task
in Linux. A single program can create many processes if it runs several times. The operating
system is responsible for allocating resources like memory, CPU, I/O devices to processes,
enabling processes to exchange and share the information, protecting the resources of each
process from other processes. As a result, the OS has to keep up with a data structure for each
process, in order to describe the resource and state of that process, which gives the OS the
ability to apply control over each process.

A process in Ubuntu OS could be in one of the following states, as shown in Fig3:


1. Ready: it occurs when a process is ready to run.
2. Waiting: it occurs when a process is waiting for an interrupt or for a system resource.
3. Stopped: it occurs when a process is completed. This process may be restarted again.
4. Executing: when the process is running, this state occurs.
5. Zombie: if the process is terminated its information will still be available in the process
table. It occurs when the child process dies before the parent process.

Fig 3: Process States of Ubuntu OS.

(Process States of Ubuntu OS, 2017)

The system libraries provide many types of functionality. At the simplest level, the libraries
allow applications to make system calls to the Linux kernel. Making a system call involves
transferring control from unprivileged user mode to privileged kernel mode; the details of this
transfer vary from one architecture to the other. The libraries take care of collection of the
system-call arguments and arrangement of those arguments in the special form necessary to
make the system call. Complex versions of the basic system calls may also be provided by the
libraries. They additionally provide routines that do not correspond to system calls at all, such
as sorting algorithms, mathematical functions, and string-manipulation routines. All the
functions necessary to support the running of UNIX or POSIX applications are implemented in
the system libraries.

Linux’s fork() system call duplicates a process without loading a new executable image. Linux
also provides the ability to create threads via the clone() system call. However, Linux does not
distinguish between processes and threads. In fact, Linux generally uses the term task —rather
than process or thread—when referring to a flow of control within a program. The clone()
system call behaves identically to fork(), except that it accepts as arguments a set of flags that
dictate what resources are shared between the parent and child (whereas a process created
with fork() shares no resources with its parent).
Fig: 1

9. PROCESS VS THREAD:

In this particular operating system the lack of distinction between processes and threads is
possible because Linux does not hold a process’ entire context within the main process data
structure; it holds the context within independent sub-contexts. Thus, a process’s file-system
context, file-descriptor table, signal-handler table, and virtual memory context are held in
separate data structures. The process data structure simply contains pointers to these other
structures, so any number of processes can easily share a sub-context by pointing to the same
sub-context and incrementing a reference count.

Linux uses a one-one threading model, with no distinction between processes and threads --
everything is simply a runnable task. On Linux, the system call clone clones a task, with a
configurable level of sharing, among which are:

CLONE_FILES: share the same file descriptor table (instead of creating a copy)

CLONE_PARENT: don't set up a parent-child relationship between the new task and the old
(otherwise, child's getppid() = parent's getpid())

CLONE_VM: share the same memory space

fork() calls clone(least sharing) and pthread_create() calls clone(most sharing). Forking costs a
tiny bit more than pthread_creating because of copying tables and creating mappings for
memory, but the Linux kernel developers have tried (and succeeded) at minimizing those costs.
Switching between tasks, if they share the same memory space and various tables, will be a tiny
bit cheaper than if they aren't shared, because the data may already be loaded in cache.
However, switching tasks is still very fast even if nothing is shared -- this is something else that
Linux kernel developers try to ensure (and succeed at ensuring).
10. USER LEVEL THREAD AND KERNEL LEVEL THREAD: MODELS

A thread is a lightweight process that can be managed independently by a scheduler. It uses


parallelism to improve the application performance. A thread shares information like data
segment, code segment files etc. with its peer threads while it contains its own registers, stack,
counter etc. The two main types of threads are user-level threads and kernel-level threads.

The user-level threads are implemented by users and the kernel is not aware of the existence of
these threads. It handles them as if they were single-threaded processes. User-level threads are
small and much faster than kernel level threads. They are represented by a program counter
(PC), stack, registers and a small process control block. Also, there is no kernel involvement in
synchronization for user-level threads. Unlike the user-level threads kernel-level threads are
handled by the operating system directly and the thread management is done by the kernel.
The context information for the process as well as the process threads is all managed by the
kernel. Because of this, kernel-level threads are slower than user-level threads.

Some of the advantages of user-level threads are as follows −

 They are easier and faster to create than kernel-level threads and can also be more
easily managed.
 User-level threads can be run on any operating system.
 There are no kernel mode privileges required for thread switching in user-level threads.
Some of the disadvantages of user-level threads are as follows −

 Multithreaded applications in user-level threads cannot use multiprocessing to their


advantage.
 The entire process is blocked if one user-level thread performs blocking operation.

Some of the advantages of kernel-level threads are as follows −

 Multiple threads of the same process can be scheduled on different processors in


kernel-level threads.
 The kernel routines can also be multithreaded.
 If a kernel-level thread is blocked, another thread of the same process can be scheduled
by the kernel.

Some of the disadvantages of kernel-level threads are as follows −

 A mode switch to kernel mode is required to transfer control from one thread to
another in a process.
 Kernel-level threads are slower to create as well as manage as compared to user-level
threads.

11. PROCESS/THREAD SCHEDULING PARAMETERS:

In order to put the processes to work, a kernel system should be used which is the process
scheduler. The process scheduler allocates the limited resource of the processor time by
dividing them between the runnable processes on the system. It has the responsibility for
achieving the best utilization of the system and providing users with the idea that many
processes are executing concurrently. The primary decision that the scheduler should make is
selecting which process to be run next from a given set of runnable processes. (Shichao's Notes,
2018)

The scheduler of Ubuntu OS is based on priority. It schedules the processes based upon their
dynamic and static priorities. It was designed and implemented by motivated developer called
Ingo Molnar. (Sarkar, C., 2014)

An extensible hierarchy of scheduler module called schedule class was introduced in 2.6.23.
Scheduling classes are implemented using thesched_class structure. This class contains tools to
functions that have to be called when an event occurs. (Sarkar, C., 2014) There are two
schedule classes, which are:

1. Completely Fair Schedule class: it schedules processes using Completely Fair Scheduler
(CFS) algorithm. The processes that have a policy set to SCHED_BATCH, SCHED_
NORMAL and SCHED_IDLE are scheduled by this scheduling class. The implementation
of this class can be found in kernel /sched_fai r.c.

2. RT schedule class: it schedules processes using a mechanism defined in POSIX standard,


which is the real-time mechanism. The processes that have a policy set to SCHED_RR,
SCHED_FIFO are scheduled using this class. Equally important, kernel/sched_rt.c is the
implementation of this class. (Sarkar, C., 2014)

The following are the most common used kernel 2.6 scheduler polices:

1. SCHED_NORMAL :
it can be also called SCHED_OTHER. It is A time-shared, conventional process. Each task
assigned a “Nice” value using this formula: PRIO = MAX_RT_PRIO + NICE + 20. A time
slice is assigned and the tasks which at the same priority are round-robined. (Hung, Y.,
2016)
2. SCHED_FIFO :
It is a First In First Out real-time policy. Using this policy, the process runs until they quit
the CPU voluntarily. The FIFO RT tasks have maintained priority levels and the cannot
be pre-empted. It is a simple scheduling algorithm that does not need time slicing.
(Hung, Y., 2016)
3. SCHED_RR :
It is a Round Robin real-time policy. Using this policy, the process is assigned with a
time quantum and runs till the time quantum is over. If all RR tasks of a specific priority
level consume their timeslices, then their time quantum is refilled again to continue
running. Equally important, The Priority levels of this tasks are maintained. (Hung, Y.,
2016)

The main goal of designing the new scheduler of Linux was to implement fully O(1) scheduling
that will make every algorithm in the scheduler finishes its execution in a constant time. Also, it
aims to provide a good interactive performance so the system must react and reschedule the
interactive tasks at the moment even during considerable system load. (Robert, 2003)
References:

Anthony J.S, 2015. Linux File systems Explained - Community Help Wiki. [ONLINE]. Available
from: [Link]
_ga=2.233015326.1845672649.1544766582-1553649625.1544375033.

Arora, H., 2012. Linux Memory Management – Virtual Memory and Demand Paging. [Online].
Available from: [Link] .

Brief Comparison of the File Systems in Ubuntu, 2015. [Online]. Available from:
[Link]
_ga=2.233015326.1845672649.1544766582-1553649625.1544375033

Canonical, 2018a. Ubuntu release cycle. [ONLINE]. Available


from: [Link] [Accessed: 13 December 2018].

Canonical, [Link] Releases. [ONLINE] Available from: [Link]

Components of the Ubuntu Linux System, 2018.[Online].Available from:


[Link]

An Introduction to Ubuntu. [ONLINE]. Available


from: [Link]

EmbLogic, 2014. Understanding Inter Process Communication in Linux: Introduction to


Interprocess Communication. [ONLINE]. Available
from: [Link]
introduction-to-interprocess-communication/.

Garrels, M., 2008. The user interface. [ONLINE]. Available


from: [Link]

Geeks for Geeks, 2018. Operating System | Process Management | Introduction. [ONLINE].
Available from: [Link]
management-introduction/.
Gnome Desktop in Ubuntu 17.04, 2017. [Online].Available from:
[Link]

Hung, Y., 2016. Linux Kernel: Process Scheduling. [ONLINE]. Available


from: [Link]

Just more thoughts, 2011. Ubuntu 11.04 - Memory management (3/6). [ONLINE]. Available
from: [Link]
[Link].

Kili, A., 2017. All You Need To Know About Processes in Linux. [ONLINE]. Available
from: [Link]

Linuceum, 2010. An Introduction to Ubuntu Linux. [ONLINE]. Available


from: [Link]

Process States of Ubuntu OS, 2017. [Online].Available from:


[Link]

Robert, 2003. The Scheduling Algorithm | The Linux Process Scheduler. [ONLINE]. Available
from: [Link]

Rouse, M., 2006. What is GNOME (GNU Network Object Model Environment). [ONLINE].
Available from: [Link]
Object-Model-Environment.
Chapter3: Memory Management. [ONLINE]. Available
from: [Link]

Sarkar, C., 2014. Scheduling in Linux. [ONLINE]. Available


from: [Link]
[Link].

Shared Memory Method, 2007. [Online]. Available from:


[Link]
memory-in-linux.

Shichao's Notes, 2018. Chapter 4. Process Scheduling - Shichao's Notes. [ONLINE]. Available
from: [Link]

Silberschatz, A., Galvin, P. & Gagne, G., 2016. Operating System Concepts. 9 th edition. New
Delhi: Wiley India.
Slab Allocator in Linux, 2018. [Online].Available from:
[Link]
allocation.

Splitting of Memory in the Buddy System, 2018.[Online]. Available from:


[Link]

Techotopia, 2014. The History of Ubuntu Linux. [ONLINE]. Available


from: [Link]

The device-driver block structure, 2012. . [Online]. Available from:


[Link]

The Structure of VFS, 2014. [Online]. Available from:


[Link]

This Hosting Rocks, 2018. Linux Mint vs Ubuntu: Detailed Comparison. [ONLINE]. Available
from: [Link]

Tutorials point, 2016. Operating System - Linux. [ONLINE]. Available


from: [Link]

Two Processes Connected With a Pipe, 2007. [Online]. Available from:


[Link] .

Ubuntu Releases, 2010. [Online]. Available from:


[Link]

Ubuntu Versions, 2010. [Online] Available from:


[Link]

User - Level & Kernel level threads. Available from:

[Link]

Ubuntu Designing. Available from:


[Link]
Ubuntu software philosophy. Available from:
[Link]
%20software%20repository%20is,in%20our%20Free%20Software%20Philosophy.

Ubuntu software shells. Available from:


[Link]
%20Bash%20is%20the%20shell,that%20is%20%2Fbin%2Fsh

You might also like