Lecture 1
Lecture 1
Krishnendu Rarhi ©
Dr. Krishnendu Rarhi ©
Dr. Krishnendu Rarhi ©
Dr. Krishnendu Rarhi ©
Dr. Krishnendu Rarhi ©
Dr. Krishnendu Rarhi ©
Introduction to Operating System
So, what happens when a program runs?
• Well, a running program does one very simple thing: it executes
instructions.
• Many millions (and these days, even billions) of times every
second, the processor fetches an instruction from
memory, decodes it (i.e., figures out which instruction this is),
and executes it (i.e., it does the thing that it is supposed to do,
like add two numbers together, access memory, check a
condition, jump to a function, and so forth).
• After it is done with this instruction, the processor moves on to
the next instruction, and so on, and on, until the program finally
completes.
Dr. Krishnendu Rarhi ©
Of course, modern processors do many bizarre and
frightening things underneath the hood to make
programs run faster, e.g., executing multiple
instructions at once, and even issuingand
completing them out of order! But that is not our
concern here; we are just concerned with the Another early name for
the OS was the
simple model most programs assume: that supervisor or even the
master control
instructions seemingly execute one at a time, in an program. Apparently,
the latter sounded a
orderly and sequential fashion. little overzealous (see
the movie Tron for
details) and thus,
printf("%s\n", str); A elapsed. Once a second has passed, the code prints
the input string passed in by the user (in this
Spin(1); A example, the letter “A”), and continues. Note the
program will run forever; by pressing “Control-c”
} ˆC (which on UNIX-based systems will terminate the