What is an operating
system?
An operating system (OS) is a software
program that manages the hardware and
software resources of a computer.
The OS performs basic tasks, such as
controlling and allocating memory,
prioritizing the processing of instructions,
controlling input and output devices,
facilitating networking, and managing files.
Process Management
The most central concept in any operating
system is the process: an abstraction of a
running program.
Everything else hinges on this concept, and
it is important that the operating system
designer (and student) understand this
concept well.
Introduction to
Processes
All modern computers
can do several things at the same
time. While running a user program, a computer can also
be reading from a disk and outputting text to a screen or
printer.
In a multiprogramming system, the CPU also switches
from program to program, running each for tens or
hundreds of milliseconds. While, strictly speaking, at any
instant of time, the CPU is running only one program, in
the course of 1 second, it may work on several programs,
thus giving the users the illusion of parallelism.
Pseudoparallelism - working on several programs at
the same time
Multiprocessor - two or more CPUs sharing the same
physical memory (Hardware parallelism).
Process Creation
Operating systems need some way to make
sure all the necessary processes exist. In very
simple systems, or in systems designed for
running only a single application (e.g.,
controlling a device in
real time), it may be possible to have all the
processes that will ever be needed be present
when the system comes up. In general-purpose
systems, however, some way is needed to
create and terminate processes as needed
during operation. We will now look at some of
the issues.
Process Termination
After a process has been created, it starts
running and does whatever its job is.
However, nothing lasts forever, not even
processes. Sooner or later the new
process will terminate, usually due to one
of the following conditions:
1. Normal exit (voluntary).
2. Error exit (voluntary).
3. Fatal error (involuntary).
4. Killed by another process (involuntary).
Process state
1. Running (actually using the CPU at
that instant).
2. Ready (runnable; temporarily
stopped to let another process run).
3. Blocked (unable to run until some
external event happens).
Threads
In traditional operating systems, each process has
an address space and a single thread of control. In
fact, that is almost the definition of a process.
Nevertheless, there are often situations in which it is
desirable to have multiple threads of control in the
same address space running in quasi-parallel, as
though they were separate processes (except for the
shared address space).
These threads of control are usually just called
threads, although some people call them
lightweight processes.
Process vs Threads
Scheduling