Anda di halaman 1dari 7

LINUX : OPERATING

SYSTEM
OPERATING SYSTEM CASE STUDY - 2017

Date of submission:
5th April, 2017

Submitted By:
Sajal Gupta (151/EC/13)

Sanjana Goyal (156/EC/13)


ACKNOWLEDGEMENTS
Feeling gratitude and not expressing it is like wrapping a present and not
giving it
-William Arthur Ward

We would like to thank Prof. Savita Yadav from the bottom of the heart for her support and
motivation. She not only taught us but also instilled in us quest to learn more every day.

Report was completed successfully because of the grace of the god and the blessings of my
parents.
LINUX OPERATING SYSTEM
I. INTRODUCTION
Linux is the third most popular operating system after Microsoft Windows and MacOS. It is
free to use as its source code is easily available. It derives its functionality from UNIX
operating system. It is multi-user, multi-tasking and multiprocessor operating system.

II. SIGNIFICANCE
i. It run on multiple hardware platforms
ii. Good speed and stability
iii. Its free
iv. It can be improved, adapted and fixed (in case of bugs) by users.

III. LINUX ARCHITECTURE


It comprises of 5 main components:

i. Hardware: Hardware layer consists of peripheral devices.


ii. Kernel: It forms the core component of LINUX operating system. It acts as the
interface between hardware and application programs or system programs. It has
various modules to interact directly with the hardware and thus performs all the
major activities of the system.
iii. Shell: It acts as the interface between Kernel and application programs. It takes
command from the user and executes it using Kernel functions. Shell can be either
CLI or GUI.
iv. System Library: Application programs and system utilities accesses Kernels features
using System library functions as these libraries do not require Kernels code access
rights.
v. System Utility: These programs are responsible to perform specialized, individual
level tasks.

Linux Operating System operates in 2 modes Kernel mode and User mode.
IV. LINUX PROCESS MANAGEMENT

i. PROCESS STATES: It consists of 5 states that are defined by an array of mutually


exclusive flags i.e. only one state can be set at a time.
a. Running: job executing on CPU
b. Interruptible: jobs which are waiting for a condition interrupts, signals etc.
c. Uninterruptible: sleeping processes cannot be woken up by signals.
d. Stopped: stopped process
e. Zombie: process terminates before waiting for parent

ii. PROCESS SCHEDULING: Different scheduling algorithms are used in different versions of
Linux.
a. Linux 2.4: Multilevel Feedback Queue with priority levels ranging from 0 to 140.
b. Linux 2.6.0 2.6.22: O (1) scheduler Irrespective of the number of processes
running, it schedules processes with a constant amount of time.
c. Linux 2.6.23: Rotating staircase deadline CPU usage is equally distributed
among users.

iii. PROCESS SYCHRONISATION: The principle used for process synchronisation is time
slicing. Time slicing refers to providing every single process a fixed time for its execution.
If the process execution is not completed by then, it will be put in a suspended mode till
it gets its time slice. The switching between different processes occurs so fast that the
user is not able to visualize it.

Linux kernel provides some synchronization mechanisms:-


a. Atomic Operation: This operation helps in avoiding race condition and deadlock.
Atomic operators are operations like add and subtract, which are performed in
one clock cycle. A common use of the atomic integer operations is to implement
counters.
b. Semaphores: Semaphores put processes on wait queues and put task on sleep,
therefore they are also called sleeping lock. 2 types of semaphores are present:
1. Basic semaphore
2. Reader Writer semaphore
c. Spin-Lock: It is used in multi-processor systems. In case the lock is not available,
it keeps thread in light loop and keeps checking the availability of lock. It is
suitable to use in interrupts because it doesnt put the processes in sleep.
d. Sequence Lock: It is suggested when there are many readers and few writers. It
maintains a counter for sequence. When the shared data is written, a lock is
obtained and a sequence counter is incremented by 1. Write operation makes
the sequence counter value to odd and releasing it makes even. In case of
reading, sequence counter is read before and after reading the data.

V. DEADLOCKS
Linux is smart enough to recognise a deadlock situation and sort it out. When a deadlock
occurs in Linux, Linux will print an error message and kill the parent process so you are
not stuck with orphaned child processes.
VI. MEMORY MANAGEMENT
Linux is a virtual memory system i.e. addresses seen by users do not directly correspond
to physical addresses used by the hardware.

Advantages of virtual memory system:-

i. Programs can allocate far more memory than is physically available


ii. It allows mapping of program memory to device memory.

Address types used in Linux are as follows:-

i. User Virtual Address: These are the regular addresses seen by user-space
programs.
ii. Physical Address: The addresses used between the processor and the system's
memory.
iii. Bus Address: The addresses used between peripheral buses and memory.
iv. Kernel logical Address: These are mapped addresses of main memory which are
seen as physical addresses.
v. Kernel virtual Address: They are same as logical addresses. They are mapped
from kernel space address to a physical address.

SWAPPING IN LINUX

Linux divides the RAM into blocks of memory called Pages. Swapping is the process in
which a page of memory is copied to swap space (space on hard disk) to free that page
of memory.

Linux has 2 forms of swap space:

i. Swap partition : a section in hard disk solely used for swapping


ii. Swap file: a special swapping file that resides in the system.

SEGMENTATION
Linux prefers paging over segmentation for the following reasons:
I. It is easier to use similar set of linear addresses. Hence, it is preferred when
processes use the same segment instead of different segments.
Ii. One of the advantages of Linux is that it can be used over a wide range of
architectures. RISC architecture prohibits the use of segmentation.

PAGING
Paging is a memory allocation technique that allows non-contiguous physical addressing
of a process. Wherever a free frame is available in main memory, a physical page
belonging to the process can be loaded into it and the page table of process will take
care of mapping the logical address to correct physical frames in memory.
These page tables are stored in main memory and can be stored in virtual memory as
well. When a program is running, part of this page table is in the main memory. Linux
uses a Demand Paging feature wherein a system call is made by the user to hint that a
certain page may be needed soon.

Linux follows a three page table structure:


1. Page Directory
2. Page Middle Directory
3. Page Table

Linux manages memory using a buddy algorithm.


REFERENCES
1. https://www.quora.com/What-is-difference-between-paging-and-swapping
2. https://www.slideshare.net/pakmuzammil/os-linux?qid=56124d44-016b-4376-94d9-
bb1142acbeeb&v=&b=&from_search=10
3. https://www.ibm.com/developerworks/library/l-kernel-memory-access/
4. https://www.tutorialspoint.com/operating_system/pdf/os_linux.pdf
5. http://www.ecs.csus.edu/csc/iac/csc139/extras/Linux.pdf
6. https://www.sics.se/~amir/files/download/os-lab/linux1.pdf

Anda mungkin juga menyukai