0% found this document useful (0 votes)
25 views6 pages

Input and Output Management - Linux

This document discusses the types of management in the Linux operating system, including memory management, processes, file systems, and input/output. Memory management in Linux uses three-level paging and the buddy allocation algorithm. The most common file systems are Ext3 and ReiserFS. Input and output are managed through device drivers and can be redirected.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views6 pages

Input and Output Management - Linux

This document discusses the types of management in the Linux operating system, including memory management, processes, file systems, and input/output. Memory management in Linux uses three-level paging and the buddy allocation algorithm. The most common file systems are Ext3 and ReiserFS. Input and output are managed through device drivers and can be redirected.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Study on the types of management of the Linux OS [Article] Page 1 of 6

Study on the types of management of the Linux OS

Autor: Silas Antônio Cereda da Silva <[Link] at [Link]>


12/07/2007

Introduction

Linux is a Unix-like operating system that was developed by Linus Torvalds inspired by
Minix system, which is a simplified version of Unix, and which ultimately came from the Multics system.
Linux is an example of open source development and free software. Its code
the source is available under the GPL license for anyone to use, study, modify, and distribute
freely.

A Linux system is capable of running on a wide range of computational architectures. It is


used in supercomputers, personal computers, and even in mobile phones.

In this article we will discuss Memory Management, Process Management,


File System and also Input/Output Management of the Linux Operating System
in order to gain an understanding of the structure of this operating system.

Memory management in Linux

In Linux, the memory works as follows: processes that are running have
memory priority, when a process ends and if there is space in memory, residues remain
of this process in memory for a future return of this process to be faster. If this
RAM memory is full with processes that are running, then the use of the
SWAP memory (swap). (LIMA, 2007)

Each process in Linux, on a 32-bit machine, has 3GB of address space.


virtual for itself, with 1GB remaining reserved for its page tables and other data of
core. The 1GB of core is not visible when the process runs in user mode, but becomes
accessible when the process makes a call to the kernel. The address space is generated
when the process is created and overwritten in a call to the exec system.

The virtual address space is divided into areas or regions organized into pages.
Contiguous and homogeneous. This means that each area consists of a series of pages.
consecutive with identical protection and paging properties. The code segment and the
Mapped files are examples of areas. There may be gaps in the virtual address space.
between these areas. Any reference to memory for an empty space results in a page fault
fatal. The page size is fixed.

Linux uses a three-level paging scheme. Although it has been used in the processor
Alpha, this scheme is also used in a modified way in all architectures. Each
the virtual address is broken into up to four fields. The directory field is used as an index of
global directory, with a private one for each process. The found value is a
pointer to one of the intermediate page directories, which is indexed by a field of the
Study on the types of management of the Linux OS [Article] Page 2 of 6

virtual address. The selected entry points to the final page table, indexed by
field page of the virtual address. The found entry points to the requested page. In
Pentium, which uses two-level paging, each intermediate page directory has only
an entry, so that, effectively, the entry of the global directory is who chooses the table of
page to use.

Linux manages memory using the buddy algorithm, with the addition of an array in which the
the first element is the head of a list of blocks with a size of one unit, the second
element is the head of a list of blocks with a size of two units, the next element
points to blocks of four units and so on. In this way, any block of
The power of two can be quickly found.

This algorithm generates considerable internal fragmentation, because if you want a block of 65
pages, you need to request and obtain a block of 128 pages.

To mitigate this problem, Linux has a second memory allocation that obtains blocks,
using the companion algorithm, and then the shards (smaller units) to manage units
minors separately. A third memory allocator is also used when the memory
The requested memory only needs to be contiguous in virtual space, not in physical memory.
TANEMBAUM, 2005

For protection, there is a virtual memory manager preventing processes in Kernel mode.
and in User mode they mix.

The Linux file system

It is through a file system that data is recorded and retrieved in a


storage device in a computer.

The file system is independent of hardware and BIOS, being specified by the software of
operating system at the time of installing the system or in the configuration of devices
additional storage after installation. (AUGUSTO, 2005)

The Linux file system was initially the Minix file system. However, due to
cause of the limit of 14 characters imposed on file names and the maximum size of 64 MB
For the files, there was prompt interest in improving the file system. The first
The improvement was the Ext file system, which allowed file names of 255 characters and
files up to 2GB. However, it was slower than the Minix file system, prompting
Thus the continuity of research. (TANEMBAUM, 2005)

Currently, there are more than 20 file systems supported by Linux, among them the most
used are Ext3 and ReiserFS.

The Ext3 file system was developed by Dr. Stephen Tweedie and collaborators at Red
It was an ext2 with journaling capabilities and became supported in version 2.4 of Linux.
In ext3, the journal uses a layer called JDB (Journaling Block Device), which uses a
different method in data recovery, instead of storing bytes that need to be written,
it stores modified blocks of the file system in memory to be able to track the
pending operations, the advantage is that he does not need to deal with the complexity of
writing bytes in the journal and the disadvantage is that the journal ends up getting larger (SILVA, 2004).

The ReiserFS file system was created by Hans Reiser specifically for Linux, currently
Study on the types of management of the Linux OS [Article] Page 3 of 6

it is sponsored by SuSE and maintained by the company NameSys (being the default filesystem of
distributions of GNU/Linux from SuSE), ReiserFS does not use fixed-size blocks, but adjusts the
size according to the file, it is very fast when reading smaller files.

ReiserFS supports files larger than 2GB, and access to the directory tree is more
faster than ext3, uses an efficient data structure called 'balanced tree' or tree
balanced because it treats the entire partition as if it were a single database table containing
directories, files, and metadata files, this improves the performance of applications that
they work with small files (which are read in just one I/O from the hard drive), in a file system
like ext2, disk space is allocated in blocks that vary from 512 to 4096 bytes or even larger, if
the file exceeding an exact multiple of the block size will result in disk space wastage
ReiserFS does not allocate in fixed spaces or blocks; it allocates the exact size that the file needs.

Unfortunately, ReiserFS does not work perfectly with the NFS network file system.
(Network File System), there are some patches to solve the problem, but they do not resolve it
completely. (SILVA, 2004)

I/O Management

Input and output management in Linux is implemented through device drivers, a device for
each device. Device drivers are coupled to the operating system when the kernel is generated.
Whenever a new device is added to the system, the corresponding driver must be
attached to the kernel. Access to devices is in the form of special files.

In Linux, all I/O operations are performed as a sequence of bytes, with no existence of the
concept of registration or access methods. In this way, the I/O system calls can manipulate
any type of device uniformly.

Special files can be accessed in the same way as any other file, using
simply the read and write system calls. Linux works with two types of operations
input and output: one block-oriented and the other character-oriented.

Block-oriented operations are generally associated with devices with high rates of
transfer, like disks, and aim to minimize the number of transfers between the
device and memory, using buffer caches (see figure below). For example, when a
a disk read operation is performed, a block is transferred to memory and, subsequently,
processed.

Program

File System

Cache buffer

device driver

Disco

Character-oriented devices are usually associated with slow devices, such as


terminals, where the data transfer rate between the device and memory is performed characteristic of
character.
Study on the types of management of the Linux OS [Article] Page 4 of 6

Input and output redirection


The user can, through I/O redirection, redefine where a command or program
it will receive your input and where it will send your output. The input of a command is the data about
on which the command will operate. This data can come from a file specified by the user, from
a system file, from the terminal or the output of another command. The output of a command is the
result of the operation he performs on the input. The output of the commands can be printed on the
terminal screen, sent to a file, or serve as input to another command.

A Linux command usually requires an input (generally a file) and an output in order
to display the results. When no filename is specified, the shell assumes that the
The user's keyboard will be your input. The keyboard is considered the standard input of the system. And when
Some results need to be displayed, the shell assumes that the screen will be the standard output of the system.

Process management

In operating systems, a process is the way to represent a program in execution. It is the


process that uses the resources of the computer - processor, memory, etc - for the execution of the
tasks for which the machine is intended. (ALECRIM, 2005)

The Linux process management model has undergone a remarkable evolution.

Since its inception, aided by the Bazaar1 development model, these algorithms have been
countless times criticized and improved by scholars around the world, this makes Linux
today has one of the best sets of algorithms for process management ever seen.

A process can be described as part of a program that is apparently running. This


apparent exists only because a certain process can enter and exit numerous times from
processor in a single second, and at a certain moment it may not be in the
processor and still apparently running.

Like any time-sharing system, Linux can give the impression of


simultaneous execution of the processes, allowing for a very short amount of time for each one
them. To succeed in this task, he follows a series of rules that do not waste time on
hardware with unnecessary operations and can choose which process should be executed
at that exact moment.

What decides this choice in the kernel is the process scheduler, which is largely
responsible for the productivity and efficiency of the system. More than just a simple mechanism of
time division, he is responsible for a policy of handling processes that allows for the
best possible results.

The function of 'start kernel' is responsible for creating a thread, this is the process number
zero, the first and the ascendant of all other processes.

This function is also responsible for calling the "Init" function, which in turn uses the call
from the "execve" system to run the executable init, which will be process number 1, better known
as init. We can call it God and the father of all other processes, it is the second process to be
created and one of the last to die. His children live like us human beings, they are born, they
they develop, have a more or less productive life, can have countless.
Study on the types of management of the Linux OS [Article] Page 5 of 6

One of the things that the scheduler needs to be aware of is the state that each process is in.
structure that stores the data of each process we have an array of possible states where
only one of the options below will be active.

TASK RUNNING - In execution or waiting to be executed.


TASK INTERRUPTIBLE - The process is suspended until a certain condition is met.
true.
TASK UNINTERRUPTIBLE - Like the previous state, except for the fact that its state
it will not be modified when it receives a signal. It is important for the processes that
need to execute a certain task without being interrupted.
TASK STOPPED - Process execution has been stopped.
TASK ZOMBIE - The process is finished, but the parent process has not executed yet.
system call to return information about the dead process 'wait', the
Information is not discarded as it may still be useful.

By default, Linux limits the resources that each process can have. That is, how much resources of
the system can use. This is a protection so that if the user does something wrong, it does not
prejudices the stability of the system.

Linux processes are preemptive, which means that when a process enters the state
TASK RUNNING the kernel will check if there is a higher priority than the process
current. If there is, the current process is interrupted and the one with higher priority starts to
to roll.

The priority of a process in Linux is constantly changing, the scheduler remains


informed about what the processes are doing and thus it becomes possible to adjust the priority.
In this way, the processes that were prohibited from using the CPU for a long period
time, has its priority automatically increased, contrary to the processes that
those who spent a long time inside the CPU are penalized by having their priority decreased.

The Linux scheduling algorithm works by dividing CPU time into slices. In a
each process has a specific duration time that is computed as soon as this
Fatigue starts. Generally, different processes have different execution times. When the time
when the execution of a process ends, it is removed from the CPU and another process that is running is
placed in its place.

A slice ends when all processes have exhausted their allotted execution time, thus the
scheduler is responsible for calculating the execution time for all processes and a new
The kernel starts. For Linux to choose which process to run, it needs to select which one has the
higher priority, there are two types of priority:

Static Priority - Defined by the user for processes that require real-time,
values range from 1 to 99 that are never modified by the scheduler.
Dynamic Priority - This is applied to conventional processes. The priority
the dynamics of conventional processes is always inferior to priority processes
static. If there is a process with static priority in the TASK RUNNING state
no dynamic process will run until it stops executing.

(TOLEDO, 2005)
Study on the types of management of the Linux OS [Article] Page 6 of 6

Conclusion

It is concluded that the Linux operating system is of great use to the user because it is a
open source and free system. The research conducted on its management, memory,
processes, I/O and files, was of great importance to discover a little more about this
operating system.

The information obtained about memory allocation and process scheduling reveals that
There is still plenty of subject to explore in future research on this OS.

Bibliographic references
AUGUSTO, K. EXT3 and ReiserFS file systems in GNU/Linux. 2005.
Available at:
[Link]
Accessed on: November 8, 2007.

SILVA, G. R. L. Introducing oneself into the universe of filesystems. 2004.


Available at:
[Link]
Accessed on November 8, 2007.

LIMA, S. A. de. Understanding memory management in Linux. 2007.


Available at:
[Link]
Accessed on: November 8, 2007.

TOLEDO, M. Gerenciamento de Processos no Linux. 2005.


Available at:
[Link]
Accessed on November 8, 2007.

TANENBAUM, A. S. Modern Operating Systems. 2nd Ed. 2005.

AECRIM, E. ext3 file system. 2003.


Available at:
[Link]
Accessed on: November 8, 2007.

[Link]

Return to the website

You might also like