Linux with Operating System Concepts



Download 5,65 Mb.
Pdf ko'rish
bet120/254
Sana22.07.2022
Hajmi5,65 Mb.
#840170
1   ...   116   117   118   119   120   121   122   123   ...   254
Bog'liq
Linux-with-Operating-System-Concepts-Fox-Richard-CRC-Press-2014

kernel
. We examine the kernel in detail shortly. The operating system also contains 
device 
drivers,
which are programs that allow the operating system to communicate with differ-
ent types of hardware devices. For each device added to the computer, a device driver is 
required. Many common device drivers come with the operating system but others must 
be installed when the device is being installed. The operating system also contains 
utility 
programs
that add to the capability of the operating system in terms of performance, moni-
toring, and so forth. For instance, disk defragmentation and backup programs are utilities.
8.2.1 Operating Systems and Modes of Operation
It is the operating system that manages system resources for us. This means that the user is not 
allowed to directly access system resources. This might seem odd because it is the user who 
has all the power and control, right? Not so. When the user selects Open from the File menu 
and selects a file through the pop-up window, the user is not actually causing the computer to 
open the file. Instead, the user is specifying an action for the application software to perform. 
The application software then requests the action to be performed by the operating system.
*
As the main memory sizes were very small in earlier computers, programmers would often have to split their programs 
into two or more segments. They would write the code so that, when the first segment had been used, the program would 
then load the next segment over the first one in the memory, thus creating an overlay.


Installing Linux

317
It is the operating system that decides if and how the action should be carried out. First, 
the operating system must decide if the request is permissible. Does the user have adequate 
access rights to the resource? Second, the operating system will decide how the item is to 
be treated. A file, for instance, can be opened with full access or as a read-only file. Third, 
the operating system issues the command(s) to the resource(s) by communicating through 
the appropriate device driver(s).
This leads us to a discussion of how access is controlled in the computer. Most comput-
ers use two modes of execution: 
user mode
and 
privileged mode
. User mode should be self-
explanatory in that this is the mode for all users and in this mode, the user can only make 
requests. The privileged mode, also known as administrator mode, monitor mode, system 
mode, or supervisor mode, is able to control all aspects of the computer from memory 
movement to disk access to network access to handling of interrupting situations. In user 
mode, any such operation is a request requiring that the operating system kernel deter-
mine if the requesting user has sufficient access to the requested resource.
Given a request, the operating system first takes control of the computer. It does so by 
switching modes from user to privileged mode and then examines the request and the user 
or application that generated the request. The mode is indicated by a flag, usually stored as 
1 bit in a control register of the CPU. Upon completion, the operating system changes mode 
back to user mode and relinquishes control back to the user. All this is hidden from the user.
In some operating systems, there are several different levels of user modes. The Multics 
operating system, for instance, had a hierarchical set of privileges. The Intel processors 
starting with the 80286 introduced a protected mode to handle address space issues. 
Another mode developed for Intel starting with the 286 was the real mode, used to dif-
ferentiate whether a program’s code was using newer instructions made available starting 
with the 286 processor, or older code written for the original 8086 processor.
Along with the division of operating modes is a division in memory. There is the user’s 
address space (or users’ address spaces) and the operating system’s address space. Requests 
to access memory outside one’s address space typically lead to a 
memory violation
that can 
either cause a terminating error in the program or at least an interrupt to the operating 
system to decide how to handle it.
The operating system, on the other hand, is free to access any or all address spaces as 
needed. Within the operating system, there may be further divisions so that, for instance, 
the kernel has one address space and other utility programs have their own address spaces. 
In this way, errors caused by some subcomponent of the operating system may not inter-
fere with the kernel.
8.2.2 System Calls
How do applications communicate with the operating system to place requests? This is 
handled through a mechanism known as a 
system call
. A system call is implemented either 
as a function call or a message passed to the kernel. In Linux, system calls are implemented 
as C functions.
Depending on the version of Linux you are working with, there are between 300 and 
400 system calls available. The idea is that application software is programmed to place 


318

Linux with Operating System Concepts
system calls so that, when the program needs to invoke the kernel, it does so by calling a 
kernel function. The system call invokes the kernel that then switches mode and executes 
the system call. During the execution of the system call, if the operation requested is not 
appropriate for the software or user, the system call is not completed and either an error 
arises or the application is informed via an error code that describes the problem.
One drawback of the system call is that it requires a good deal of overhead because the 
system is switching from one process (the application) to another (the operating system), 
from one mode (user) to the other (privileged), and from one address space to another. 
Further, it is possible that this switch will also require the use of virtual memory.
Some examples of Linux system calls are presented in Table 8.1. Although you as a Linux 
user may never have to directly deal with system calls, it is useful in understanding this 
concept. As a Linux developer (whether operating system or application software), you 
would have to understand system calls.
8.2.3 The Kernel
The kernel is a single program in charge of basic system operations such as process execu-
tion, memory management, resource (device) management, and interprocess communica-
tion. There are three schools of thought in designing operating system kernels: monolithic 
kernels, microkernels, and hybrid kernels.

monolithic
kernel is one in which the kernel is a single program that operates solely 
within the privileged mode and in its own address space. Communication between the user 
TABLE 8.1 
Examples of Linux System Calls

Download 5,65 Mb.

Do'stlaringiz bilan baham:
1   ...   116   117   118   119   120   121   122   123   ...   254




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish