Linux with Operating System Concepts



Download 5,65 Mb.
Pdf ko'rish
bet52/254
Sana22.07.2022
Hajmi5,65 Mb.
#840170
1   ...   48   49   50   51   52   53   54   55   ...   254
Bog'liq
Linux-with-Operating-System-Concepts-Fox-Richard-CRC-Press-2014

static
entity.
The process, on the other hand, is an 
active
entity. As the process executes, the data 
change—variables change values, portions of the program move between swap space and 
memory, and possibly also move within memory as well, and the location within the pro-
gram that the processor is about to execute also changes, instruction by instruction. In the 
latter case, the memory location of the next instruction to be executed is stored in a register 
often called the program counter (PC). The PC along with other registers (instruction reg-
ister or IR, stack pointer or SP, status flags or SF, data registers such as an accumulator, or 
AC, and so forth) constitute the state of the running program along with the current values 
of the data (variables). Thus, the state changes, often as each new instruction is executed.
The operating system must keep track of the program’s state and does so through a data 
structure often called the 
process status word
(PSW). The PSW will be a collection of the 
most important pieces of information about the running process such as the current values 
in the PC, IR, SF, and so on.
Aside from keeping track of a process’ status, the operating system is in charge of sched-
uling when processes run, and of changing the process’ status as needed. For instance, 
a process which requires time-consuming input will be moved from “ready for CPU” to 
“waiting for input.” Handling the scheduling and movement of processes is called process 
management.


128

Linux with Operating System Concepts
Different operating systems have implemented different forms of process management. 
These are
• Single tasking
• Batch
• Multiprogramming
• Multitasking
• Multithreading
• Multiprocessing
We briefly discuss these here although Linux primarily performs multitasking and 
multithreading.
4.2.1 Single Process Execution
In single tasking, the operating system starts a process and then the CPU’s attention is 
entirely held by the one process. This means that the computer is limited to running only 
the one process until either that process terminates or the user suspends that process. In 
many operating systems that performed single tasking, suspending a process was only pos-
sible by terminating the process. Single tasking has many drawbacks. Among them, there 
is no chance of having the computer do more than one thing until that particular task is 
over. Additionally, if the process has to perform some time-consuming input or output 
task, the processor remains idle while the I/O takes place. Only the most rudimentary 
operating systems today would be limited to single tasking because of these drawbacks.
Batch processing is much like single tasking with three differences. First, in batch pro-
cessing, there may be multiple users wishing to use the system at one time. Since the system 
is single tasking though, the system will only concentrate on one user’s process at a time. 
Therefore, the second difference is that users submit their programs to run (jobs) using a 
separate, possibly offline system. This system is responsible for scheduling when the sub-
mitted job will be selected by the CPU for execution. Third, since the job may run any time 
from immediately to days later, the job cannot be expected to run interactively.
To support the lack of interactivity, a user must submit the input with the job as well as 
the destination for the output. Typically the input will be a file stored on some storage device 
or placed as a series of strings of data to be read by the program during execution. A com-
mon way to specify the data is through “cards.” In earlier days of computing, cards were lit-
erally punch cards containing the data. This was eventually replaced by lines of code using 
an operating system language like JCL (Job Control Language). Today, if batch processing 
is used, the input is stored in a disk file whose name is provided when the process runs. 
Similarly, when submitting the program, the user would specify the output’s destination.
The offline system not only receives user requests to run processes but also schedules 
them using some type of scheduling algorithm. During the era of batch processing, a 


Managing Processes

129
number of different scheduling algorithms were developed. The simplest, and perhaps fair-
est, is first come first serve, often known as FIFO for first-in first-out.
In an organization where some users’ processes are more critical than others, a priority 
scheme could be used. At a university, for instance, the highest priority might be given to 
administration processes with faculty processes given the next highest priority. Processes 
submitted by graduate students might come next followed by those of undergraduate stu-
dents. Although not a fair scheme, it represents the needs or priorities of the university. 
Within each priority level, submitted jobs might be organized in a simple first come first 
serve order.
Another scheduling algorithm is called shortest job first. In this case, the scheduler esti-
mates the execution time needed by the process and orders the waiting jobs in ascending 
order of this estimated time. It has been shown that this scheduling algorithm guarantees 
the minimum average waiting time. The opposite approach is called longest job first. As 
both of these scheduling algorithms estimate execution time, they may not actually yield 
the minimum (or maximum) average waiting time.
Whichever algorithm is applied for scheduling, it is the scheduler’s task to order the jobs 
and place them in a 
queue
(waiting line) reflecting the scheduled ordering. In the case of 
the priority scheme, we would have one queue per priority level.
4.2.2 Concurrent Processing
One of the great inefficiencies of batch processing is that of I/O. Imagine, for instance, that 
input is to be read from magnetic tape. During execution of the current process, if it needs 
to input from tape file, this will cause a pause in the execution because of the relative slow-
ness of tape input. During this time, the CPU idles.
It would be nice to give the CPU something to do while waiting. This leads us to an 
improved form of process management called multiprogramming. In multiprogramming, 
the CPU continues to only execute a single process, but if that process needs to perform 
time consuming I/O, that process is removed from its current position of being executed 
by the CPU and moved by the operating system into an I/O queue. The operating system 
then selects the next waiting process for execution by the CPU. In doing so, to the user it 
appears as if there is more than one process currently executing. We will call this concur-
rent processing. Multiprogramming is one form, we look at others below.
The movement of processes requires a new operation known as a 

Download 5,65 Mb.

Do'stlaringiz bilan baham:
1   ...   48   49   50   51   52   53   54   55   ...   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